Pseudocode Flashcards
Write code to display output on a screen
OUTPUT A
Write code to perform string operations (length)
LEN(‘StringExp’)
LEN(‘computer science’)
= 16 (including spaces)
Write code to find position of char in string
POSITION (‘StringExp’ , ‘CharExp’)
POSITION(‘computer science’, ‘m’
= 2 (indexing starts at 0)
Write code to perform string operations (substring)
SUBSTRING(IntExp, IntExp, ‘StringExp’)
SUBSTRING(2, 9, ‘computer science’)
= ‘mputer s’
Write code to perform string operations (concatenation)
StringExp + StringExp
‘Computer’ + ‘Science’
= ‘computerscience’
Converting string to integer
STRING_TO_INT(StringExp)
Converting string to real
STRING_TO_REAL(StringExp)
Converting integer to string
INT_TO_STRING(IntExp)
Converting real to string
REAL_TO_STRING(RealExp)
Converting character to character code
CHAR_TO_CODE(CharExp)
Converting character code to character
CODE_TO_CHAR(IntExp)
Integer Division
IntExp DIV IntExp
Count controlled iteration (For loop)
FOR Identifier arrow IntExp TO IntExp STEP IntExp
ENDFOR
Condition controlled iteration (While)
WHILE BoolExp
#statements
ENDWHILE
If/elseif/else structure
IF BoolExp THEN #S ELSE IF BoolExp THEN #S ELSE #S ENDIF