Structuring Your Responses
Learn it by playing
Answer these questions to earn energy, then fish and explore. No account needed.
Notes
General Approach to Programming Questions
- Programming questions appear in both Paper 1 (algorithm understanding) and Paper 2 (design, write, test, refine).
- Paper 2 includes a fixed **15-mark programming question** at the end.
- Answers must be in **CIE pseudocode**, Structured English, or a high-level language.
- Before writing a program, ask five key questions: inputs, outputs, processes, constructs, subprograms.
Five Key Questions for Programming
- **What are the inputs?** – Identify data the program receives (e.g., user input, file).
- **What are the outputs?** – Determine what the program displays or saves.
- **What processes take place?** – Describe the transformations or calculations.
- **What constructs will I need?** – Choose sequence, selection (IF), iteration (WHILE, FOR), assignment, string operations.
- **Do I need to use subprograms?** – Use built-in functions (e.g., SUBSTRING, LCASE) or user-defined procedures/functions.
Example: String Manipulation Question
- Question: store a string, extract a substring, output lowercase.
- Use **SUBSTRING(Quote, Start, Number)** – returns Number chars from position Start (1-indexed).
- Use **LCASE(Quote)** to convert to lowercase.
- Answer: assign Quote, set Start=25, Number=8, OUTPUT SUBSTRING, OUTPUT LCASE.
What is a Trace Table?
- A **trace table** tracks variable values as a program runs line by line.
- Tests ability to simulate code and record outputs accurately.
- Typically worth **3–6 marks**, often involving iteration, selection, and arrays/lists.
- The table structure is usually provided; you fill in missing values.
Command Words for Trace Table Questions
- **Complete** – Fill in the table with correct values.
- **State** – Give a single value/output/result.
- **Explain** – Say why something happens or changes.
- **Identify** – Spot where something goes wrong or doesn't match expectations.
Steps to Tackle a Trace Table
- **1. Read the code carefully** – Understand loops, IF statements, variable changes.
- **2. Use the trace table provided** – Headings and row count guide iterations.
- **3. Work line by line** – Simulate in head/paper, update each variable after every change.
- **4. Watch for variable resets** – Variables inside loops reset each iteration.
- **5. Show final output clearly** – Write exactly as it would appear on screen.
Trace Table Worked Example
- Algorithm: total=0, count=1, WHILE count≤3: input number, IF number>10 THEN total+=number, count+=1, OUTPUT total.
- Inputs: 12, 8, 15. Output: 27.
- Trace table rows: line number, count, number, total, output.
- Use a dash (–) when a column is not relevant; keep neat.
Common Mistakes and Tips
- **Read code exactly as a computer would** – don't skip lines.
- Use a pencil and annotate each step.
- Don't fill in lines that just mark end of IF/WHILE (e.g., line 7, 9).
- If only 5–6 rows used, something is likely missing.
Example series circuit with cell, switch, lamp, and ammeter.
Particle arrangement in solid, liquid, and gas states.
Practice questions
Free preview — 8 of 40 questions. Sign up to see them all.
1.What is the purpose of a trace table in computer science?
Easy- ATo follow the values of variables as a program runs
- BTo draw a diagram of the program's structure
- CTo convert high-level code to machine code
- DTo store the program's output
2.In the context of trace tables, what does the command word 'Complete' mean?
Medium- AFill in the table with correct values
- BGive the value/output/result
- CSay why something happens or changes in the program
- DSpot where something goes wrong or doesn't match expectations
3.Which of the following is NOT a question you should ask yourself when attempting a programming question?
Easy- AWhat are the inputs?
- BWhat are the outputs?
- CWhat is the file size?
- DWhat constructs will I need to use?
4.In CIE pseudocode, which function is used to convert a string to lowercase?
Easy- ALCASE()
- BUPPERCASE()
- CLOWER()
- DTOLOWER()
5.Given the string Quote = 'Learning Never Exhausts The Mind', what is the result of SUBSTRING(Quote, 25, 8)?
Medium- A'The Mind'
- B'The Min'
- C'he Mind'
- D'The Mind' (including the space)
6.In a trace table, what is a common mistake that students make?
Hard- ASkipping or misreading a line
- BUsing too many rows
- CWriting the output first
- DUsing a pencil
7.In the trace table worked example with inputs 12, 8, 15, what is the final output?
Medium- A27
- B35
- C20
- D12
8.When completing a trace table, why should you use a new row whenever a variable or output changes?
Hard- ATo accurately track each step of the program's execution
- BTo make the table look longer
- CTo avoid using too many rows
- DTo confuse the examiner
Unlock all 40 questions, slides, flashcards & more
Create a free account to see every question, the slides, flashcards and revision notes for this topic.
Past papers
Past-paper practice for this topic is coming soon.