Cambridge O Level Computer Science 2210 · 8.1 Programming concepts

Q15 · 2210/23/O/N/22 Q1

Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3.

Q152210/23/O/N/22original Q1Structured · 20 marks
Question 1 from 2210/23/O/N/22

Worked solution

(a)(i)

Many answers are accepted if they are meaningful. Example answers:

Constant name: BasicClean [1]

Value: 10.00 [1]

Reason: this number will not change while the program is running [1]

(a)(ii)

Many answers are accepted if they are meaningful. Example answers:

Name: NameAddress [1]

Data type: string [1]

Sample data: for example Mrs Singh, Park View [1]

(b)

Any three of these:

Use a conditional statement (or an input with validation) [1]

Any working method, for example only store True in the three-floors array if the two-floors array has not been set to True [1]

Output an appropriate error message when an error condition happens, or choose the right route through the program for the choice of floors [1]

(c)

Start with 10.00 and work through each extra in order.

Total ← 10.00
ExtraWindowsCost ← INT((NumberExtraWindows[Bill] - 1) / 5) * 5.00
Total ← Total + ExtraWindowsCost
CASE OF NumberOfFloors[Bill]
  2 : Total ← Total * 1.1
  3 : Total ← Total * 1.15
ENDCASE
IF Inside[Bill] = TRUE
  THEN
    Total ← Total * 1.25
ENDIF
IF Polish[Bill] = TRUE
  THEN
    Total ← Total * 1.05
ENDIF
IF Solar[Bill] = TRUE
  THEN
    Total ← Total + 20.00
ENDIF

Any six of these points score one each:

Bill total set to 10.00, and a check for additional windows [1]

… and the amount for them added to the total if required [1]

Check for 2 floors or 3 floors [1]

… and multiply by 1.1 or 1.15 as required [1]

Check for inside cleaning and multiply by 1.25 if required [1]

Check for polish and multiply by 1.05 if required [1]

Also credited: these steps done in the correct order, and a check for solar panels with 20.00 added if required.

(d)

Explain each step. Any five of these:

How the program counted the number of customers using a service [1]

… and did this for all services, excluding basic windows and additional windows [1]

How it identified the service with the largest number of customers [1]

How it identified the service with the smallest number of customers [1]

How it calculated a percentage of the total number of bills stored [1]

Also credited: doing the percentage for both the largest and smallest, and displaying the percentages with suitable messages. Any programming statements used must be explained.

KEY IDEAUse counters for each service, compare them to find largest and smallest, and turn them into percentages of the total.
TOTAL 20 marks

Official mark scheme

Mark scheme for 2210/23/O/N/22 question 1
VIDEO
▶ Topic lesson

A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.

Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.