Computer ScienceExam code: 0984

Programming Concepts

Programming

A short reminder of the keywords, operators and string functions on one page.

Pseudocode keywords for variables and constants

DECLARE <identifier> : <data type>
CONSTANT <identifier> ← <value>

Data types

INTEGERREALCHARSTRINGBOOLEAN

Arithmetic

+-*/^DIV(a, b)MOD(a, b)

Comparison

=<><><=>=

Logical (Boolean)

ANDORNOT

String functions

LENGTH(s)SUBSTRING(s, start, length)UCASE(s)LCASE(s)

Common pseudocode pitfalls

  • Single = for equality in CIE pseudocode (not ==).
  • Single quotes for CHAR, double quotes for STRING.
  • ← is the only operator; = means equality (comparison), so never use it to assign a value.
  • are 1-indexed in CIE pseudocode (not 0-indexed like Python).
  • Always declare a before using it, with the right data type.
  • Use MOD(a, b) for "is divisible by" rather than dividing and checking the fractional part.

Quick check

3 short questions on this note. See what has stuck, and where to look if something hasn't.

About 1 minute

Build on this topic