Variables, Data Types & OUTPUT in Cambridge Pseudocode

Programming begins with representing and manipulating data in computer memory. In Cambridge IGCSE Computer Science, algorithms are formalized using standardized pseudocode conventions.


1. What is a Variable?

A Variable is a named location in computer memory whose value can change during program execution:

  • Each variable has an Identifier (name), a Data Type, and a Current Value.
  • In Cambridge pseudocode, all variables must be declared explicitly before they can be assigned values or referenced.

Declaration Syntax:

DECLARE <Identifier> : <DataType>

2. Standard Cambridge Data Types

Data Type

Definition

Memory Representation & Range

Example Cambridge Literals

INTEGER

Whole numbers (positive, negative, zero) without decimals.

Typically stored in 2 to 4 bytes using two's complement.

0, 42, -15, 1000

REAL

Numbers with fractional or decimal components.

Stored using floating-point representation (mantissa & exponent).

3.14159, 19.99, -0.75

CHAR

Exactly one alphanumeric character, symbol, or space.

One character; encoded byte width depends on the encoding. Enclosed in single quotes.

'A', '7', '#', ' '

STRING

An ordered sequence of zero or more characters.

Enclosed in double quotes.

"Cambridge IGCSE", ""

BOOLEAN

Logical truth states; takes only one of two values.

Evaluates exclusively to TRUE or FALSE.

TRUE, FALSE


3. The Assignment Operator (<-)

In Cambridge pseudocode, the assignment operator is the arrow <-:

TotalMark <- 85
StudentName <- "Sarah"
IsEnrolled <- TRUE

Exam Warning: Using = for assignment (e.g. TotalMark = 85) uses the wrong operator. The = symbol is reserved solely for relational equality comparisons in conditions.


4. Producing Output (OUTPUT)

The OUTPUT statement transmits text, variables, or expressions to the user interface:

OUTPUT "Candidate Name: ", StudentName
OUTPUT "Final Score: ", TotalMark, " / 100"

Multiple items are separated by commas. String literals must always be enclosed in double quotes.

AI Socratic Tutor

All-Access
Sign in or create an account. AI Tutor is an All-Access benefit.
Sign Up

Need guidance? Ask a question or use the hint below.

AI Socratic Tutor is an All-Access Benefit

Unlock step-by-step Socratic hints, algorithm trace table walkthroughs, and error diagnostics for every Cambridge exercise.

You're chatting with an AI tutor, not a person. AI can make mistakes, so double-check its answers.

Exam-Style Question: Trace Variable Assignments and Output

+35 XP

Task

Trace the execution of this algorithm:

Score1 <- 15
Score2 <- 25
Total <- Score1 + Score2
Score1 <- Score1 * 2
OUTPUT "Score: ", Score1, " Total: ", Total

Complete the trace table rows.

Trace Table Matrix
# Score1 Score2 Total OUTPUT
1
2
3
4
5

All-Access Required

Interactive exercises for Module 2 and beyond require an active plan.

Trace Table Assertions
○ Variable assignment and output trace matches expected values