Past-paper question · 2024 February-March · Paper 22 · Q5(b)(i)

Question 5(b)(i) 2024 · February-March · Paper 22 · 3 marks

Original past-paper question for 5(B)(I)
Original past-paper question for 5(B)(I)
Original past-paper question for 5(B)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 5(B)(I)

Official answer for Question 5

Part (b)

(i)

✓
One mark for checking for < 0 or >= 0

Question 3

✓
One mark for checking of both inputs
✓
One mark for correct repetition of both inputs e.g. use of REPEAT WHILE or using existing loop, in separate loops or both
✓
in a single loop
✓
Example:
✓
REPEAT
✓
OUTPUT "Enter cost price "
✓
INPUT Cost
✓
UNTIL Cost >= 0
✓
REPEAT
✓
OUTPUT "Enter selling price "
✓
INPUT Sell
✓
UNTIL Sell >= 0
✓
or
✓
OUTPUT "Enter cost price "
✓
INPUT Cost
✓
WHILE Cost < 0
✓
OUTPUT "Enter cost price "
✓
INPUT Cost
✓
ENDWHILE
✓
OUTPUT "Enter selling price "
✓
INPUT Sell
✓
WHILE Sell < 0
✓
OUTPUT "Enter selling price "
✓
INPUT Sell
✓
ENDWHILE
✓
Cambridge IGCSE – Mark Scheme
✓
0478/22
✓
February/March 2024
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_m24_ms_22.pdf →

Show text version of question

Question 5

Part (b)

(i)

Question 5

An algorithm has been written in pseudocode to calculate the profit when an item is sold. Values

for cost price and selling price are input, the profit is calculated (selling price – cost price) and output. The input of zero for either value stops the algorithm.

01 REPEAT 02 OUTPUT "Enter cost price " 03 INPUT Cost 04 OUTPUT "Enter selling price " 05 OUTPUT Sell 06 IF Cost <> 0 OR Sell <> 0 07 THEN 08 Profit Sell - Cost ← 09 OUTPUT "Profit is ", Profit 10 NEXT 11 UNTIL Cost = 0 OR Sell = 0 This algorithm needs to be improved with a range check.

(i)

Write pseudocode to reject the input of values less than zero for variables Cost and

Sell

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[3]
Topic relevance

Why this question appears here

78% 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_m24_qp_22.pdf

Keep practising this topic