Unable to open this exercise
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.
Independent Practice: A student record
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.
Interactive exercises for Module 2 and beyond require an active plan.
Run code to inspect step-by-step variable trace states.