Unable to open this exercise
Common exam pitfall
Students often omit the DECLARE keyword or use a colon in the wrong position.
Students often use FLOAT or DOUBLE instead of the standard Cambridge REAL keyword.
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 |
|---|---|---|---|
| Whole numbers (positive, negative, zero) without decimals. | Typically stored in 2 to 4 bytes using two's complement. |
|
| Numbers with fractional or decimal components. | Stored using floating-point representation (mantissa & exponent). |
|
| Exactly one alphanumeric character, symbol, or space. | One character; encoded byte width depends on the encoding. Enclosed in single quotes. |
|
| An ordered sequence of zero or more characters. | Enclosed in double quotes. |
|
| Logical truth states; takes only one of two values. | Evaluates exclusively to |
|
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
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 Check: Identify Correct Variable Declarations
• Multiple ChoiceWhich statement is the syntactically correct declaration for a variable named TotalCost that will store monetary decimal amounts in Cambridge pseudocode?
Interactive exercises for Module 2 and beyond require an active plan.