Pseudocode Structure Flashcards Preview

Computer Science GCSE > Pseudocode Structure > Flashcards

Flashcards in Pseudocode Structure Deck (32):
1

Variable assignment

var ← exp

2

One-dimensional array assignment

var[iexp] ← exp

3

Two-dimensional array assignment

var[iexp1][iexp2] ← exp

4

What number does indexing start at in Pseudocode?

1

5

Array initialisation of n elements

var ← [exp1, exp2, ... , expn]

6

Conditional branching

IF bexp THEN
statements
ELSE
statements
ENDIF

7

Conditional execution (no branching)

IF bexp THEN
statements
ENDIF

8

Multi-branching conditional with n choices

CASE exp OF
exp1: statements
...
expn: statements
ELSE
statements
ENDCASE

9

While loop

WHILE bexp
statements
ENDWHILE

10

For loop

FOR var ← iexp1 TO iexp2
statements
ENDFOR

11

Repeat/until loop

REPEAT
statements
UNTIL bexp

12

How many times does each loop run?

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

13

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

Only within the for loop

14

One line comment

# comment

15

Function definition with n (possibly no) parameters

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

16

Return statement

RETURN exp

17

Procedure definition with n (possibly no) parameters

PROCEDURE pname(param1, ... , paramn)
statements
ENDPROCEDURE

18

Calling a subroutine with identifier name with n parameters

name(param1, ... , paramn)

19

Modulo operator

iexp1 MOD iexp2

20

Binary boolean operators

AND, OR and XOR

21

Unary boolean operators

NOT

22

Length function

LEN(var)

23

Opens a file to read or write

OPEN filename to read/write

24

Returns the nth line of an external file

READLINE(file, n)

25

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

WRITELINE(file, n, value)

26

Goes through a file until the end

WHILE NOT eof(filename) ...

*eof = End Of File

27

Closes a file

CLOSE filename

28

Writes message to output

OUTPUT message

29

Gets the user's input

USERINPUT

30

An integer expression

iexp

31

A boolean expression

bexp

32

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

statements