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.

Independent Practice: A student record

+30 XP

Read a student name followed by an integer score. Store each using an appropriate type. Output the name, then the score, on separate lines.

Write a complete program. Read inputs in the stated order. Output only the requested results, one per line, without input prompts. Test with your own values before submitting.

solution.pseudo
All-Access Required

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

○ First record
○ Zero score