Pseudocode Flashcards

1
Q

Write code to display output on a screen

A

OUTPUT A

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

Write code to perform string operations (length)

A

LEN(‘StringExp’)

LEN(‘computer science’)

= 16 (including spaces)

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

Write code to find position of char in string

A

POSITION (‘StringExp’ , ‘CharExp’)

POSITION(‘computer science’, ‘m’

= 2 (indexing starts at 0)

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

Write code to perform string operations (substring)

A

SUBSTRING(IntExp, IntExp, ‘StringExp’)

SUBSTRING(2, 9, ‘computer science’)

= ‘mputer s’

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

Write code to perform string operations (concatenation)

A

StringExp + StringExp

‘Computer’ + ‘Science’

= ‘computerscience’

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

Converting string to integer

A

STRING_TO_INT(StringExp)

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

Converting string to real

A

STRING_TO_REAL(StringExp)

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

Converting integer to string

A

INT_TO_STRING(IntExp)

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

Converting real to string

A

REAL_TO_STRING(RealExp)

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

Converting character to character code

A

CHAR_TO_CODE(CharExp)

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

Converting character code to character

A

CODE_TO_CHAR(IntExp)

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

Integer Division

A

IntExp DIV IntExp

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

Count controlled iteration (For loop)

A

FOR Identifier arrow IntExp TO IntExp STEP IntExp

ENDFOR

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

Condition controlled iteration (While)

A

WHILE BoolExp
#statements
ENDWHILE

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

If/elseif/else structure

A
IF BoolExp THEN 
   #S
ELSE IF BoolExp THEN 
   #S
ELSE 
   #S 
ENDIF
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Assigning array

A

Identifier arrow [IntExp]

17
Q

Assigning 2D array

A

Identifier arrow [IntExp][IntExp]

18
Q

Updating element in array

A

Identifier [IntExp] arrow Exp

19
Q

Find Array length

A

LEN(Identifier)

20
Q

For loop for length of array

A

FOR identifier IN array
#statements (identifier can be used as a local
variable here (eg. i)
ENDFOR

21
Q

Declaring a record

A
RECORD Record_identifier 
     field1 :  datatype
     field2 :  datatype
   …
ENDRECORD
22
Q

Declaring variable with record

A

VarName arrow Record_identifier(value1,value2,…)

23
Q

Assigning a value to a field in a record

A

VarName.field arrow Exp

24
Q

Accessing values of files in records

A

VarName.field

25
Q

how to write Subroutine

A
SUBROUTINE identifier (parameters) 
    # statements 
ENDSUBROUTINE
26
Q

Return value in subroutine

A

RETURN Exp

27
Q

Calling subroutines

A

Identifier (parameters)

28
Q

Generate random number

A

Identifier arrow RANDOM_INT(StartValue, EndValue)

This function is inclusive