Fig. 1 shows a flowchart from a recycling centre program. An employee enters the mass of each aluminium can in grams. The program checks each input and adds...

Assessment: Computer Science 4CP0 | Paper 2 Mock 01 | Written Paper 2 Subject: Computer Science - 4CP0

Question 1 Report

Fig. 1 shows a flowchart from a recycling centre program. An employee enters the mass of each aluminium can in grams. The program checks each input and adds acceptable cans to canCount. The variable mass is read again at the end of each loop. The sentinel value -1 indicates that there are no more cans. The employee says that a can of exactly 12 g must be counted, but a can of 11 g must not be counted.

INPUT massmass = -1?Yes / NoSTOPmass >= 12?© EAGLE BEACON GLOBAL

Fig. 1: part of the recycling-centre flowchart

(a) Identify the construct represented by the lower diamond in Fig. 1. [1]
(b) Write the value of canCount after masses 12, 9 and 15 have been entered, starting from 0. [2]
(c) Complete the missing true branch in pseudocode so that the flowchart performs the required count, then state the input statement that must be repeated. [4]

Answer Details

(a) The lower diamond is a selection or IF construct [1]. It chooses a branch according to whether the condition is true or false.

(b) Starting with canCount = 0, mass 12 is counted, mass 9 is not, and mass 15 is counted. The final value is 2. [2]

(c) Exactly 12 g must be included, so the comparison needs >=:

IF mass >= 12 THEN
    canCount = canCount + 1
END IF
INPUT mass

The condition gains [1], the increment [1], the closing syntax [1], and the repeated input statement [1]. [4]

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning