pseudocode Flashcards

1
Q

if statement

A

IF, THEN, ENDIF

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

case

A

CASE, OF, OTHERWISE, ENDCASE

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

for loop

A

FOR, TO, NEXT

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

repeat loop

A

REPEAT
UNTIL

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

while loop

A

WHILE, DO, ENDWHILE

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

algorithm

A

sets out steps to complete a given task

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

types of algorithm

A

totalling, counting, finding max min and average, linear search, bubble sort

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

constant

A

unchangeable variable
eg.CONSTANT hourlyrate <- 6.5

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

arrays

A

stores elements of same data type

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

declare 1d array

A

DECLARE cars: ARRAY [1:7] OF STRING

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

DECLARE 2D ARRAY

A

DECLARE cars: ARRAY [1:7, 1:2] OF INTEGER

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

storing 1d array

A

cars[1] <- “dodge”

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

storing 2d array

A

cars [1,2] <- 2

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

string operation finding length

A

finds number of characters in a string
LENGTH(“days”)
or
LENGTH(days)

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

string operation turning into lower case

A

LCASE(“days”)
or
LCASE(days)

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

string operation turning upper case

A

UCASE(“days”)
or
UCASE(days)

17
Q

string operation printing part of a word

A

SUBSTRING (“happy days”, 1, 5)
1- first character till fifth

18
Q

rounding an integer

A

ROUND(10.6, 1)
rounds 10.6 to one decimal place

19
Q

random

A

random outputs any number between 1 and 0 inclusive
RANDOM()

20
Q

what happens when a function is called in the middle of the program

A

A call statement is used in order to make use of a function
Parameters are / may be passed (from the main program) to the function
function performs its task
and returns a value

21
Q

calling procedures without perameters

A

PROCEDURE password()
INPUT password1
OUTPUT password1
ENDPROCEDURE
CALLpassword()

22
Q

calling proceudres with perameters

A

PROCEDURE operation (num1:INTEGER, num2:INTEGER)
DECLARE resukt
result<- numb1+numb2
OUTPUT result
CALL operation(2,3)

23
Q

calling function without perameter

A

FUNCTION cars RETURNS STRING
INPUT car
RETURN car
ENDFUNCTION
OUTPUT (cars)

24
Q

calling function with perameter

A

FUNCTION operation (numb1: INTEGER) RETURNS INTEGER
DECLARE calculation
calculation <- numb1 *numb1
RETURN calculation
ENDFUNCTION
OUTPUT (operation(5))

25
Q

why are files used

A

to store data permenantyl which can then be accesssed later
can be shared with other computers, data exchange
enables permemnant storage with easy access even after computer or program has been closed

26
Q

how do you view contents in a file

A

you open the file,
OPENFILE <identifier> FOR <file>
eg.
OPENFILE breakfast FOR READ
OPENFILE breakfast FOR WRITE</file></identifier>

27
Q

why do you use READ in file handling

A

to read data from file

28
Q

why do you use WRITE in file handling

A

to write data into file, a new file is created any any existing data is lost

29
Q

how is data read from a file

A

OPENFILE breakfast FOR READ
READFILE breakfast, bread
CLOSEFILE breakfast

30
Q

how is data written into a file

A

OPENFILE breakfast FOR WRITE
WRITEFILE breafast, drinks
CLOSEFILE breakfast

(drinks is a variable)