Unable to open this exercise
In Cambridge International examinations, algorithms written in pseudocode must adhere strictly to the standardized conventions defined in the syllabus. This ensures unambiguous readability and consistency across all computing tasks.
1. Golden Rules of Cambridge Pseudocode
1. Keywords in UPPERCASE
All language reserved words and control structures must be capitalized:
- Declarations:
DECLARE,CONSTANT - Input / Output:
INPUT,OUTPUT - Selection:
IF,THEN,ELSE,ENDIF,CASE,OF,OTHERWISE,ENDCASE - Iteration:
FOR,TO,STEP,NEXT,WHILE,DO,ENDWHILE,REPEAT,UNTIL - Subroutines:
PROCEDURE,ENDPROCEDURE,FUNCTION,RETURNS,ENDFUNCTION,CALL - Boolean Literals:
TRUE,FALSE
2. Assignment Arrow (<-)
In Cambridge pseudocode, the assignment operator is the arrow <-:
Counter <- Counter + 1
TaxRate <- 0.175
IsValid <- TRUE
Exam Warning: Using = for assignment (e.g., Counter = Counter + 1) is an error. The = sign is reserved exclusively as a relational operator for comparing equality.
3. Meaningful Identifiers
Variable, constant, and subroutine names must be self-documenting:
- Good:
TotalPrice,StudentName,Index,IsRegistered - Often unclear without context:
x,temp1,a,foo
2. Standard Cambridge Data Types
Data Type | Description | Exam Literal Examples |
|---|---|---|
| Whole numbers (positive, negative, or zero) without fractional parts. |
|
| Floating-point numbers with fractional / decimal components. |
|
| Exactly one alphanumeric character, symbol, or punctuation mark. |
|
| An ordered sequence of zero or more characters enclosed in double quotes. |
|
| Logical truth values taking only one of two states. |
|
3. The Identifier Table
An identifier table is a useful design aid for recording names, types and purposes:
Identifier | Data Type | Purpose / Description |
|---|---|---|
|
| Unique alphanumeric candidate registration code (e.g. "C1042") |
|
| Total raw marks achieved on examination (0 to 100) |
|
| Calculated percentage score rounded to one decimal place |
|
| Flags whether candidate met the minimum passing threshold (>= 50%) |
|
| Letter grade awarded ('A', 'B', 'C', 'D', 'E', 'U') |
Written practice and self-review
A student wrote the following Cambridge pseudocode declarations:
DECLARE 1stScore : INT
DECLARE Total Score : REAL
Identify the three syntax errors in these declarations according to Cambridge pseudocode standards and explain how each should be corrected.
Write an explanation before checking the theory. Check that each claim answers the question, uses the correct concept and explains why it applies. Discuss uncertain points with a teacher. The structured exercise below checks specific facts; it does not automatically mark this explanation.
Maintainability practice
Use meaningful identifiers, suitable comments, procedures/functions for coherent tasks and named constants for fixed values. In a ticket program, replace x with TicketTotal and a repeated price literal with a named constant; indent the body of each selection and loop. Explain why a comment such as “ignore the terminating -1” is more helpful than repeating “add one” beside Count <- Count + 1. Short conventional loop names can still be clear in context.
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.
Independent Practice: A named report
Read a person's name and integer age, then output the name and age on separate lines. Choose meaningful identifiers.
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.
Interactive exercises for Module 2 and beyond require an active plan.
Run code to inspect step-by-step variable trace states.