Past-paper question · 2024 October-November · Paper 23 · Q6

Question 6 2024 · October-November · Paper 23 · 10 marks

Original past-paper question for 6
Reveal official mark-scheme answer

The answer for this question is in the official mark scheme: open the mark scheme.

Mark scheme 0478_w24_ms_23.pdf →

Show text version of question

Question 6

An incomplete algorithm has been written in pseudocode to count the number of values stored in an array and to find their average. Values have been stored in the array starting at A[1] All the values to be counted are non-zero.

A
value of zero in the array indicates there are no more values stored.

01 DECLARE A : ARRAY[1:50] OF INTEGER

02 DECLARE C : INTEGER

03 DECLARE W : INTEGER

04 DECLARE X : INTEGER

05 W 0

06 C .................................................................................................

07 WHILE A[C] <> 0

08 W .................................................................................................

09 C C + 1

10 ENDWHILE

11 X .................................................................................................

Part (a)

Complete the given pseudocode algorithm.

[3]

Part (b)

Write pseudocode to display, with suitable messages:

  • the number of values stored in the array
  • the average of those values stored.

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

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

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

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

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

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

[3]

Question 5

, ,

Part (c)

Meaningful identifiers have not been used in this algorithm.

Suggest suitable meaningful identifiers for:

The array

A
................................................................................................................................................

The variables

C
................................................................................................................................................

X ................................................................................................................................................

W ................................................................................................................................................

[3]
Topic relevance

Why this question appears here

98% assigned-topic match · Programming › Programming concepts

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 0478_w24_qp_23.pdf

Keep practising this topic