Book 8 · Chapter 0
How Paper 2 works
B8·0This chapter is in the ebook.
Read it in full on cswithzak.com. Every question has its mark scheme and every program is ready to run. The free practice for each section is below, with the short code the book prints beside it.
About this chapter
This chapter is about how the paper works rather than one syllabus section. Its companion material arrives with the chapter.
The paper at a glance
Short code B8·0·10
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
Reading the question: command words
Short code B8·0·11
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
How Python answers are marked
Short code B8·0·12
temp = int(input("Enter the temperature: "))
while temp < -10 or temp > 50:
temp = int(input("Out of range. Enter again: "))
print("Accepted:", temp)input() prints its prompt before it waits.Output
Enter the temperature: Out of range. Enter again: Accepted: 23
quantity = int(input("How many tickets (1 to 20)? "))
while quantity < 1 or quantity > 20:
quantity = int(input("1 to 20 only. Enter again: "))
print("Booked:", quantity)Output
How many tickets (1 to 20)? 1 to 20 only. Enter again: 1 to 20 only. Enter again: Booked: 4
total = 17
print("Total:", total)
print("Total: " + str(total))print(), or str() before +. Both print the same words; the comma also adds the space.Output
Total: 17 Total: 17
Trace tables, the examiner's way
Short code B8·0·13
hot = 0
cold = 0
total = 0
print("start", hot, cold, total)
for day in range(5):
temp = int(input())
if temp >= 30:
hot = hot + 1
elif temp < 10:
cold = cold + 1
total = total + temp
print(day, temp, hot, cold, total)
print("output:", hot, cold, total / 5)Output
start 0 0 0 0 31 1 0 31 1 12 1 0 43 2 8 1 1 51 3 30 2 1 81 4 -2 2 2 79 output: 2 2 15.8
count = 0
biggest = 0
n = int(input())
print("start", count, biggest, n)
while n != 0:
count = count + 1
if n > biggest:
biggest = n
n = int(input())
print(count, biggest, n)
print("output:", count, biggest)Output
start 0 0 7 1 7 3 2 7 9 3 9 0 output: 3 9
Flowcharts in Paper 2
Short code B8·0·14
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
Short programming questions
Short code B8·0·15
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
SQL answers
Short code B8·0·16
SELECT Name, Form
FROM PUPIL
INNER JOIN CLUB ON PUPIL.ClubID = CLUB.ClubID
WHERE ClubName = 'Chess'
ORDER BY Name;Output · 3 rows
| Name | Form |
|---|---|
| Bilal | 10A |
| Dina | 11A |
| Eesa | 10B |
SELECT COUNT(PupilID)
FROM PUPIL
INNER JOIN CLUB ON PUPIL.ClubID = CLUB.ClubID
WHERE MeetDay = 'Tuesday';Output
COUNT(PupilID) 3
SELECT Name, Form
FROM PUPIL
INNER JOIN CLUB ON PUPIL.ClubID = CLUB.ClubID
WHERE ClubName = Chess;Output
ERROR: Chess is not a column — text values must be in quotes: ClubName = 'Chess'.
The 15-mark scenario: how it is built
Short code B8·0·17
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
A worked scenario, point by point
Short code B8·0·18
# Recycling drive: bottles collected by each class on each day
classes = ["7A", "7B", "8A", "8B"]
DAYS = 3
# (a) one row per class, one column per day, every element 0
bottles = []
for c in range(len(classes)):
row = []
for d in range(DAYS):
row.append(0)
bottles.append(row)
# (b) input each count, re-input until it is 0 to 500
for c in range(len(classes)):
for d in range(DAYS):
print("Bottles for", classes[c], "on day", d + 1)
count = int(input())
while count < 0 or count > 500:
print("Must be 0 to 500. Enter it again")
count = int(input())
bottles[c][d] = count
# (c) each class's total and daily average
totals = []
for c in range(len(classes)):
total = sum(bottles[c])
totals.append(total)
average = round(total / DAYS, 1)
print(classes[c], "collected", total, "- average", average)
# (d) the highest total, and every class that reached it
highest = max(totals)
print("Highest total:", highest)
for c in range(len(classes)):
if totals[c] == highest:
print("Winner:", classes[c])classes, bottles, totals, DAYS) is used exactly as given.Output
Bottles for 7A on day 1 Bottles for 7A on day 2 Bottles for 7A on day 3 Bottles for 7B on day 1 Bottles for 7B on day 2 Must be 0 to 500. Enter it again Bottles for 7B on day 3 Bottles for 8A on day 1 Bottles for 8A on day 2 Bottles for 8A on day 3 Bottles for 8B on day 1 Bottles for 8B on day 2 Bottles for 8B on day 3 7A collected 127 - average 42.3 7B collected 139 - average 46.3 8A collected 139 - average 46.3 8B collected 125 - average 41.7 Highest total: 139 Winner: 7B Winner: 8A
names = ["Iman", "Jude", "Kofi", "Lena", "Musa"]
times = [48, 39, 52, 39, 41]
fastest = min(times)
print("Fastest time:", fastest)
for i in range(len(names)):
if times[i] == fastest:
print("Fastest:", names[i])Output
Fastest time: 39 Fastest: Jude Fastest: Lena
Timing and checking
Short code B8·0·19
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
How marks are lost
Short code B8·0·20
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
Diagnostic set and the scenario
Short code B8·0·21
Practice for this page of the book: the quiz, flashcards and past-paper questions for its section are listed above.
Workbook: How Paper 2 works
Short code W8·0 · Algorithms, Programming and Databases Workbook
The write-in workbook for this chapter has drills, exam-style practice, trace tables, fix-the-mistake and mark-it-yourself pages. Its full mark schemes and an interactive version arrive here with the chapter.


