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

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

What number does indexing start at in Pseudocode?

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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
6
Q

Conditional branching

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

Conditional execution (no branching)

A

IF bexp THEN
statements
ENDIF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
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
9
Q

While loop

A

WHILE bexp
statements
ENDWHILE

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

For loop

A

FOR var ← iexp1 TO iexp2
statements
ENDFOR

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

Repeat/until loop

A

REPEAT
statements
UNTIL bexp

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

How many times does each loop run?

A

While: Zero or more times
For: A specific number of times
Repeat/until: At least once

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

In a Pseudocode for loop, where does the count variable have scope?

A

Only within the for loop

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

One line comment

A

comment

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

Function definition with n (possibly no) parameters

A

FUNCTION fname(param1, … , paramn)
statements
RETURN exp
ENDFUNCTION

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

Return statement

A

RETURN exp

17
Q

Procedure definition with n (possibly no) parameters

A

PROCEDURE pname(param1, … , paramn)
statements
ENDPROCEDURE

18
Q

Calling a subroutine with identifier name with n parameters

A

name(param1, … , paramn)

19
Q

Modulo operator

A

iexp1 MOD iexp2

20
Q

Binary boolean operators

A

AND, OR and XOR

21
Q

Unary boolean operators

A

NOT

22
Q

Length function

A

LEN(var)

23
Q

Opens a file to read or write

A

OPEN filename to read/write

24
Q

Returns the nth line of an external file

A

READLINE(file, n)

25
Q

Writes (over) the nth line of an external file with value

A

WRITELINE(file, n, value)

26
Q

Goes through a file until the end

A

WHILE NOT eof(filename) …

*eof = End Of File

27
Q

Closes a file

A

CLOSE filename

28
Q

Writes message to output

A

OUTPUT message

29
Q

Gets the user’s input

A

USERINPUT

30
Q

An integer expression

A

iexp

31
Q

A boolean expression

A

bexp

32
Q

A series of one line statements. A statement is terminated by a new line

A

statements