Year 11 · Computer Science · Spring 1
Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
A full Paper 2 under time
Exam practice7.7 Trace tables7.9 Writing and amending algorithms10.3 Expressions and circuits
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
You will learn to
- Complete a full Paper 2 in 1 hour 45 minutes.
- Use a timing plan that leaves about 30 minutes for the scenario question.
- Use the mark scheme to mark the paper and sort each lost mark by its cause.
- Update your tracker from the result.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Success criteria
You have got it when you can say:
- I can write my timing plan on the front page before I start.
- I can attempt every question, including the scenario question.
- I can say whether each lost mark came from knowledge, misreading, time or carelessness.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
Text in a WHERE clause goes in…
A BracketsB No quotesC Single quotes: 'Red'
C. Single quotes: 'Red'
- Last unit
In 8-bit two's complement, 11111111 is…
A 255B −1C −127
B. −1
- Earlier this year
FOR i ← 1 TO 10 … NEXT i runs the loop…
A 10 timesB 9 timesC 11 times
A. 10 times
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (1 of 7)
- Algorithm
- A precise, ordered set of steps that solves a problem.
- Program development life cycle
- The four stages of making a program: analysis, design, coding and testing.
- Structure diagram
- A top-down diagram that shows how a system is split into sub-systems.
- Pseudocode
- A structured, code-like way of writing an algorithm that is not tied to one language.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (2 of 7)
- Totalling
- Adding values into a running total, for example Total ← Total + Value.
- Counting
- Adding 1 to a counter each time something happens.
- Bubble sort
- Sorting by comparing neighbouring items and swapping them if they are in the wrong order, pass after pass.
- Validation
- An automatic check that input data is reasonable and follows set rules.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (3 of 7)
- Check digit
- An extra digit calculated from the other digits, used to catch typing errors.
- Trace table
- A table used in a dry run to record the value of each variable as an algorithm runs.
- Logic gate
- An electronic component that takes one or two inputs and gives one output by a fixed rule.
- Truth table
- A table that lists every possible input combination and the output for each one.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (4 of 7)
- Logic circuit
- Two or more logic gates joined together to give one output.
- Logic expression
- A written description of a circuit using gate names, such as X = A AND NOT B.
- NOT
- A one-input gate whose output is the opposite of its input; also called an inverter.
- AND
- A gate whose output is 1 only when both inputs are 1.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (5 of 7)
- OR
- A gate whose output is 1 when at least one input is 1.
- NAND
- NOT AND: the output is 0 only when both inputs are 1.
- NOR
- NOT OR: the output is 1 only when both inputs are 0.
- XOR (EOR)
- Exclusive OR: the output is 1 when the two inputs are different.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (6 of 7)
- Input
- A signal going into a gate or circuit, such as a sensor reading of 1 or 0.
- Output
- The single result signal that comes out of a gate or circuit.
- Working column
- An extra truth-table column holding the output of one gate inside a circuit.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Key words (7 of 7)
- Sum of products
- An expression made by AND-ing the inputs of each row with output 1, then OR-ing those groups together.
The explanation · step 1 of 13 · part 1 of 2
Plan your 105 minutes
Paper 2 is 75 marks in 1 hour 45 minutes. That is 105 minutes.
The last question is the 15-mark scenario question. It needs about 30 minutes.
| Part | Marks | Time |
|---|---|---|
| All questions before the scenario | 60 | About 65 minutes |
| The scenario question | 15 | About 30 minutes |
| Check your answers | About 10 minutes |
The explanation · step 1 of 13 · part 2 of 2
Plan your 105 minutes (continued)
Start at 09:00. Start the scenario by 10:05. Start checking at 10:35. The paper ends at 10:45.
Write your three clock times on the front page as soon as you sit down.
Do not leave the scenario for the last ten minutes. It is 15 marks: one fifth of the paper.
The explanation · step 2 of 13
When you get stuck
- Put a star next to the question and move on. Come back at the end.
- Write something for every question. A blank always scores zero.
- In the scenario, write the plan as comments first. Each requirement met earns marks, even if the code is unfinished.
- In a trace table, fill one row at a time. Do not jump ahead in your head.
The explanation · step 3 of 13
Reviewing the paper
Mark the paper with the scheme. Then sort every lost mark into one of four types.
| Type of lost mark | Example | Fix |
|---|---|---|
| Did not know it | Could not complete a NAND truth table | Study page and quiz for that point, then a new question |
| Misread the question | Wrote >= when the question said 'more than' | Underline the key words before you answer |
| Ran out of time | The scenario was half written | Use the timing plan in every practice paper |
| Careless slip | Wrote a value in the wrong trace-table column | Use the last 10 minutes to check |
Each type has a different fix. Count your lost marks by type. Fix the biggest group first.
7.7 Trace tables · The explanation · step 4 of 13 · part 1 of 2
What a trace table is
A dry run means working through an algorithm by hand, line by line, without a computer.
A trace table records the dry run. It has one column for each variable, and one for the output.
Write a new value in a column only when that variable changes. Move to a new row when the loop goes round again.
A dry run lets you check an algorithm before it is coded. It also shows exactly where a logic error happens.
7.7 Trace tables · The explanation · step 4 of 13 · part 2 of 2
What a trace table is (continued)
Do not fill every cell. Cambridge mark schemes usually want a value only where it changes. Copying values down is not wrong but takes time and causes mistakes.
7.7 Trace tables · The explanation · step 5 of 13 · part 1 of 6
Worked dry run
This algorithm reads numbers until the user types -1. A value that only means 'stop' is called a rogue value.
Input data: 12, 7, 20, 9, -1. Follow each row of the table below and check you agree.
Then use the toy. Pick Counting (WHILE), a similar rogue-value loop, and press Step to run it one line at a time.
7.7 Trace tables · The explanation · step 5 of 13 · part 2 of 6
Worked dry run (continued)
| Value | Total | Count | Highest | OUTPUT |
|---|---|---|---|---|
| 0 | 0 | 0 | ||
| 12 | 12 | 1 | 12 | |
| 7 | 19 | 2 | ||
| 20 | 39 | 3 | 20 | |
| 9 | 48 | 4 | ||
| -1 | 12 20 |
7.7 Trace tables · The explanation · step 5 of 13 · part 3 of 6
Worked dry run (continued)
7.7 Trace tables · The explanation · step 5 of 13 · part 4 of 6
Worked dry run (continued)
DECLARE Value : INTEGER
DECLARE Total : INTEGER
DECLARE Count : INTEGER
DECLARE Highest : INTEGER
Total ← 0
Count ← 0
Highest ← 0
INPUT Value
WHILE Value <> -1 DO
Total ← Total + Value
Count ← Count + 1
IF Value > Highest
THEN
Highest ← Value
ENDIF
INPUT Value
ENDWHILE
OUTPUT Total / Count, " ", Highest7.7 Trace tables · The explanation · step 5 of 13 · part 5 of 6
Worked dry run (continued)
total = 0
count = 0
highest = 0
value = int(input())
while value != -1:
total = total + value
count = count + 1
if value > highest:
highest = value
value = int(input())
print(total / count, highest)7.7 Trace tables · The explanation · step 5 of 13 · part 6 of 6
Worked dry run (continued)
The rogue value -1 is not added to the total. The loop checks the value before using it. That is why there is an `INPUT` before the loop and another at the end of it.
There is something to try for this step in the IGCSE library.
The explanation · 8 more steps
More on the lesson page
The lesson page has the rest of the explanation, step by step:
- Be precise, and amend with care
- The 15-mark scenario question: plan first
- Model answer in pseudocode and Python
- How the 15 marks are awarded
- From a statement to an expression
- From an expression to a circuit
- From a circuit to an expression
- From a truth table to an expression
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Quick quiz · 1 of 3
XOR gives 1 when…
- A Both inputs are 1
- B Exactly one input is 1
- C Neither input is 1
B. Exactly one input is 1
Exclusive OR: one or the other, not both.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Quick quiz · 2 of 3
A truth table for 3 inputs has…
- A 8 rows
- B 3 rows
- C 6 rows
A. 8 rows
2 to the power of 3 combinations.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Quick quiz · 3 of 3
NAND is…
- A NOT followed by AND
- B OR followed by NOT
- C AND followed by NOT
C. AND followed by NOT
Not-AND: the opposite output of AND.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Exit ticket
Answer on paper before you go. Then check.
With A = 1 and B = 1, A OR B is…
A 0B 2C 1
C. 1 OR is true when at least one input is 1, including both.
X = (A AND B) OR C with A = 0, B = 1, C = 1 gives…
A Cannot tellB 0C 1
C. 1 A AND B = 0. Then 0 OR 1 = 1.
Year 11 · Computer Science · Paper 2 practice: algorithms, programming, logic, databases · Lesson 5 of 5
Homework and the challenge
Homework
Quiz mixes: 'IGCSE Computer Science: 10 at random' every evening.
End-of-unit challenge
The spring mock: a full Paper 2 under time.