OCR Pseudocode Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Assigning global variables

A

global userid = 123

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

For Loops

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

While loops

A

while answer != “”
answer = input()
endwhile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Do until loops

A

do
answer = input()
until answer == “”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

if else statements

A

if entry == “a” then
print(“”)
elseif entry == “b” then
print(“”)
else
print(“”)
endif

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Initiliasing an array called names with 5 items

A

array names[5]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Files

A

myFile = openRead(“text.txt”)
x = myFile.readLine()
myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Printing every line in a file

A

while not myFile.endOfFile()
print(myFile.readLine())
endwhile
myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

An example class

A

class Dog inherits Pet
private breed
public procedure new(pName, pBreed)
super.new(pName)
breed = pBreed
endprocedure
public function getBreed()
return breed
endfunction
endclass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Creating an instance of a class (object)

A

myDog = new Dog(“Bob”, “Pitbull”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Example of an 8 by 8 2d array called board

A

array board[8,8]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Assigning [0,0] position in a 2d array

A

board[0,0] = “rook”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly