Pseudocode Flashcards

1
Q

Pseudocode - assign a variable (x)

A

x = 3

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

Pseudocode - cast a string varaible

A

str(3)

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

Pseudocode - cast a float variable

A

float(“3.14”)

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

Pseudocode - cast an integer variable

A

int(“3”)

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

Pseudocode - make a global variable (userid)

A

global userid = 123

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

Pseudocode - print a string (hello)

A

print (“hello”)

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

Pseudocode - gather an input (name)

A

name = input(“enter name: “)

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

Pseudocode - print (hello) 8 times
use iteration

A

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

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

Pseudocode - 2 ways to ask for (password) until it matches (computer)

A

while answer!=”computer”
answer=input(“What is the password?”)
endwhile

OR

do
answer=input(“What is the password?”)
until answer==”computer”

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

Pseudocode - MOD gives the ___ - 12MOD5

A

remainder - 2

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

Pseudocode - DIV gives the ___ - 17DIV5

A

quotient - 3

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

Pseudocode - if, elif, else

A

if … then

elif … then

else

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

Pseudocode - how to get the length of a string (name)

A

stringname.length

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

Pseudocode - how to get a substring

A

string.substring(start postion, num of chara)
shows (a,b) a-b

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

Pseudocode - make a function (triple)

A

function triple (number)
return number*3
endfunction

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

Pseudocode - do we assume pass by ref or value

A

value
it will specify if relevant

16
Q

Pseudocode - pass by reference

A

changes the variable

17
Q

Pseudocode - pass by value

A

doesnt change variable

18
Q

Pseudocode - make a procedure

A
19
Q

Pseudocode - function

A

returns something

20
Q

Pseudocode - procedure

A

executes something
no return

21
Q

Pseudocode - make an array (name) with 5 names

A

array names[5]
name 0,1,2,3,4

22
Q

Pseudocode - print the 4th name in an array

A

print(names[3])

23
Q

Pseudocode - make a 2d array 8x8 (board)

A

array board[8,8]

24
Q

Pseudocode - open a file (myfile) and make (x) the first line

A

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

25
Q

Pseudocode - open a file (myfile) and print the file out

A

myFile = openRead(“sample.txt”)
while NOT myFile.endOfFile()
print(myFile.readLine())
endwhile
myFile.close()

26
Q

Pseudocode - write a comment (comment)

A

// comment

27
Q

Pseudocode - do we assume methods and attributes are private or public

A

public
will be stated if not

28
Q

Pseudocode - make a methods and attributes private and public

A

public and private.
private attempts = 3
public procedure setAttempts(number)
attempts=number
endprocedure
private function getAttempts()
return attempts
endfunction