Back to marketplace

paper 2 - OCR reference language

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

how do you declare a constant in the OCR reference language?

Back (Answer)

using the keyword const (e.g. const pi = 3.14

#2
Front (Question)

how can variables in the main program can be made global in OCR reference language?

Back (Answer)

with the keyword global (e.g. global userID = 123)

#3
Front (Question)

what would 13MOD5 give?

Back (Answer)

3

#4
Front (Question)

what would 17DIV5 give?

Back (Answer)

3

#5
Front (Question)

give a statement in OCR reference language that will print “Hello” 8 times.

Back (Answer)

for i=0 to 7 print (“Hello”) next i

#6
Front (Question)

what does the ‘step 2’ command do in for loops in OCR reference language? Explain an example of it being used

Back (Answer)

it increases the counter (i) by 2 each time. E.g., the program: for i=0 to 7 step 2 print (“Hello”) next i Will print “Hello” 4 times, because the step 2 command increases the counter (i) by 2 each time.

#7
Front (Question)

give an example of a DO…UNTIL loop in OCR reference language

Back (Answer)

do answer = input(“New answer”) until answer != “Correct”

#8
Front (Question)

which command will return the length of the string in OCR reference language?

Back (Answer)

stringname.length (e.g. the program subject = “Computer Science” print (subject.length) would return 15)

#9
Front (Question)

how would you print a substring in OCR reference language?

Back (Answer)

stringname. subString (startingPosition, numberOfCharacters) e. g. when subject = “Computer Science”, subject.substring(3,5) will return “puter” (remember it starts at the 0th character)

#10
Front (Question)

when subject = “Computer Science”, what would subject.left(4) return?

Back (Answer)

“Comp”

#11
Front (Question)

when subject = “Computer Science”, what would subject.right(3) return?

Back (Answer)

“nce”

#12
Front (Question)

how would you convert the variable Subject into upper case letters?

Back (Answer)

Subject.upper

#13
Front (Question)

how would you convert the variable Subject into lower case letters?

Back (Answer)

Subject.lower

#14
Front (Question)

in OCR reference language, what command is used to open a file to read from?

Back (Answer)

open(“filename.txt”)

#15
Front (Question)

In OCR reference language, which command would be used to return a line of text from the file myFile?

Back (Answer)

x = myFile.readLine()

#16
Front (Question)

what is the command endOfFile used for in OCR reference language?

Back (Answer)

it is used to determine the end of the file, for example, myFile.endOfFile will return true if the program has reached the end of the file

#17
Front (Question)

write a program to print out the contents of a file called sample.txt

Back (Answer)

myFile = open("sample.txt") while NOT myFile.endOfFile() print(myFile.readLine()) endwhile myFile.close()

#18
Front (Question)

what command is used to write to a file in OCR reference language?

Back (Answer)

writeLine e.g. myFile = open("sample.txt") myFile.writeLine("Hello World") myFile.close() would make "Hello World" the contents of sample.txt (any previous contents are overwritten)

#19
Front (Question)

how are arrays declared in OCR reference language?

Back (Answer)

with the keyword ‘array’. e.g. array people[5] would create an array called ‘people’ with 6 spaces (it is 0 based)

#20
Front (Question)

how do you declare a 2D array in OCR reference language?

Back (Answer)

array arrayName[no. of records, no. of fields] e.g. array board [8,8] board [0,0] = “rook”

#21
Front (Question)

how do you define a function in OCR reference language?

Back (Answer)

function functionName(parameter) e.g. function triple(number) creates a function called 'triple' that takes 'number' as an argument

#22
Front (Question)

how do you call a procedure in OCR reference language?

Back (Answer)

procedure procedureName(parameter) e.g. procedure greeting(name) would create a procedure called 'greeting' that takes the parameter 'name'

#23
Front (Question)

how would you cast the string “3” as an integer in OCR reference language?

Back (Answer)

int(“3”)

#24
Front (Question)

how would you cast the string “3.14” into a float in OCR reference language?

Back (Answer)

float(“3.14”)