Past-paper question · 2024 May-June · Paper 23 · Q4(a)

Question 4(a) 2024 · May-June · Paper 23 · 6 marks

Original past-paper question for 4(A)
Original past-paper question for 4(A)
Reveal official mark-scheme answer Official mark-scheme answer for 4(A)

Official answer for Question 4

Part (a)

✓
Example solution:

Question 6

✓
PROCEDURE TwoParts()
✓
DECLARE NextNum, Average : REAL
✓
TotalA 0.0 // 0
✓
TotalB 0.0 // 0
✓
REPEAT
✓
INPUT NextNum
✓
TotalA TotalA + NextNum
✓
UNTIL NextNum = 0
✓
REPEAT
✓
INPUT NextNum
✓
TotalB TotalB + NextNum
✓
UNTIL NextNum = 0
✓
Average (TotalA + TotalB) / 2
✓
OUTPUT "The average is ", Average
✓
ENDPROCEDURE
✓
Mark as follows:
✓
1. Procedure heading and ending
✓
2. Declare all local variables
✓
3. Initialise TotalA and TotalB
✓
4. First conditional loop until zero entered, summing TotalA // Loop until
✓
both parts (sequences) have been entered
✓
5. Second conditional loop until zero entered, summing TotalB // Loop
✓
summing appropriate Totals
✓
6. Calculation of average and output with a message // Calculation of the
✓
average for the values making up the two totals and both output with a
✓
suitable message

Mark scheme 9618_s24_ms_23.pdf →

Show text version of question

Question 4

Part (a)

Question 4

A procedure TwoParts() will input a sequence of real values, one at a time.

The procedure will:

  • process the sequence in two parts
  • form a first total by adding the values until the first zero
  • form a second total by adding the values after the first zero until the second zero
  • output the average of the two totals, together with a suitable message.

Values input in the first part are totalled using global variable TotalA and those input in the second part are totalled using global variable TotalB.

Part (a)

Write pseudocode for the procedure TwoParts().

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................

[6]

Question 9

, ,

Topic relevance

Why this question appears here

72% assigned-topic match · Programming › Programming basics

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9618_s24_qp_23.pdf

Keep practising this topic