Pseudocode Structure Flashcards

1
Q

Variable assignment

A

var ← exp

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

One dimensional array assignment

A

var[iexp] ← exp

Remember indexing starts at 1 not 0

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

Two dimensional array assignment

A

var[iexp1][iexp2] ← exp

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

Array initialisation of n elements

A

var ← [exp1, exp2, … , expn]

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

Conditional (if AND else statements) branching

A
IF bexp THEN
statements
ELSE 
statements
ENDIF
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Conditional execution (no alternative branching / else)

A

IF bexp THEN
statements
ENDIF

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

Multi‐branching conditional with n choices.

A
CASE exp OF 
exp1: statements 
...
expn: statements 
ELSE statements 
ENDCASE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Conditional looping with the condition at the start of the loop / while loop

A

WHILE bexp
statements
ENDWHILE

Remember no colon

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

Count controlled looping / for loop

A

FOR var ← iexp1 TO iexp2
statements
ENDFOR

Remember no colon and no ‘in’

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

Conditional looping with the condition at the end of the loop. The loop must always execute at least once.

A

REPEAT
statements
UNTIL bexp

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

raw_input equivalent

A

USERINPUT

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

Function definition with n (possibly none) parameters.

A

FUNCTION fname(param1,…,paramn)
statements
ENDFUNCTION

Remember the statements must include at least one RETURN statement

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

Procedure definition with n (possibly none) parameters.

A

PROCEDURE pname(param1,…,paramn)
statements
ENDPROCEDURE

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

Modulo operator / remainder percentage sign thing

A

iexp1 MOD iexp2

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

Function that returns integer value that is length of an array or a string / length of…

A

LEN (var)

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

Returns the nth line of an external file (indexing starts at one)

A

READLINE(file, n)

17
Q

(Over)Writes the nth line of file with value. If n exceeds the previous line numbers of file plus one then the gap is filled with blank lines.

A

WRITELINE(file, n, value)

18
Q

Print equivalent

A

OUTPUT “ “