Paper Ii - Test
Paper Ii - Test
• use this value to set up how many other numbers are to be input
• calculate and output the total and the average of these numbers.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
2.
3
4. A routine checks the weight of melons to be sold in a supermarket. Melons weighing under 0.5 kilograms
are rejected and melons weighing over 2 kilograms are also rejected. Give an example of each type of test
data for this routine.
Normal .............................................................................................................................................
Extreme ............................................................................................................................................
Abnormal ......................................................................................................................................[3]
Identify two different conditional statements that you can use when writing pseudocode.
.......................................................................................................................................................
...................................................................................................................................................[2]
5
Section B
1 Read this section of program code that should input 30 positive numbers and then output the
largest number input.
1 Large = 9999
2 Counter = 0
4 DO
5 INPUT Num
7 Counter = Counter - 1
8 ENDWHILE
9 PRINT Large
Locate these errors and suggest a corrected piece of code for each error.
1 .......................................................................................................................................................
..........................................................................................................................................................
2 .......................................................................................................................................................
..........................................................................................................................................................
3 .......................................................................................................................................................
..........................................................................................................................................................
4 .......................................................................................................................................................
......................................................................................................................................................[4]
3 (a) The flowchart below inputs six single digit numbers. The predefined function MOD gives the
value of the remainder, for example, Y 10 MOD 3 gives the value Y = 1
START
INPUT
A, B, C, D, E, F
No
OUTPUT
'Reject'
END
7
Complete a trace table for each of the two sets of input data.
Set 1 5, 2, 4, 3, 1, 5
Set 2 3, 2, 1, 0, 7, 3
[4]
...................................................................................................................................................
...............................................................................................................................................[1]
(c) Identify a problem with this flowchart and explain how to correct it.
Problem ....................................................................................................................................
...................................................................................................................................................
Solution .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
4 Four programming concepts and four examples of programming code are shown below.
Draw a line to link each programming concept to the correct example of programming code.
Programming
Example of programming code
concept
5 (a) Write an algorithm, using pseudocode and a FOR … TO … NEXT loop structure, to input
1000 numbers into an array.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[4]
12
13