Computer Science 0478 - Paper - 2
Computer Science 0478 - Paper - 2
NAME……………………………………………………………………….CLASS……………….
COMPUTER SCIENCE
FORM 4 Mid-Year Examination 2022
SYLLABUS CODE 0478/22 Paper 2 Problem-solving and Programming
TIME 1 hour 30 Minutes
DATE 26 JULY 2022 AM
Candidates answer on the question paper
INSTRUCTIONS TO CANDIDATES
1. Write your name and class in the space at the top of this page.
2. Answer all the questions in the spaces provided.
3. The use of an electronic calculator is not allowed.
4. You are reminded of the need for clear presentation in your answers.
5. The number of marks is given in brackets [] at the end of each question or part question.
1|P a g e
You are advised to spend no longer than 40 minutes answering this section.
Here is a copy of the pre-release material.
DO NOT attempt Tasks 1, 2 and 3 now.
Use the pre-release material and your experience from attempting the following tasks
before the examination to Question 1.
Pre release material
2|P a g e
1 (a) All variables and other identifiers should have meaningful names.
(i) When you completed your Task1.You might have declared some variables. State two
variables that you might have declared and state their data types.
Variable 1:
………………………………………………………………………………………………………………………………………………
…………………………………………………………………….........................................................................[1]
Data type:
………………………………………………………………………………………………………………………………………………
…………………………………………………………………….........................................................................[1]
Variable 2:
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………….[1]
Data type:
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………….[1]
(ii) When you completed your Task1.You might have declared some constants. State two
constants that you might have declared and state their data types
Constant 1:
………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………..[1]
Constant 1:
………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………..[1]
(iii) Declare the array used to store 20 names of visitors who intend to book parking spaces
for day 1.
3|P a g e
(b)Write an algorithm, using pseudocode to validate the day number input by the
user(visitor). Hint: Include appropriate prompts for the entry of data
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………. [5]
(c) Write an algorithm to input and store the names of 20 visitors into an array you declared
above.
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………….[4]
(d) Identify three types of test data and an example data value you would use to test the
day number entered in 1(b)
Test data 1:…………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………….[1]
Test data 2:…………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………….[1]
Test data 3:…………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………….[1]
4|P a g e
5|P a g e
6|P a g e
7|P a g e
8|P a g e
9|P a g e
10 | P a g e