UA01 - Programming Concepts
UA01 - Programming Concepts
Paper | 2
(a) Draw a line to connect each type of statement to the examples(s) it applies to.
FOR X 1 TO 10 Assignment
READ X Iteration
PRINT X Input
[4]
(b) (i) Identify the correct two different types of condition statement :
a condition that can be true or false: ---------------------------------------------------.
a choice between several different values: ------------------------------------------ [2]
……………………………..……………..…………………………………………...……...
Example ....................................................................................................................................
……………………………..……………..……………………..…………………………....
Example ............................................................................................................................... [4]
(b) Draw a line to connect each data structure to the correct description
Data Structure Description
Constant a value that can change whilst a program is running
2 ...............................................................................................................................................
3 ...........................................................................................................................................[3]
……………………………..……………..…………………………………………...……...
Paper | 2
FailCount ...................................................................................................................................
……………………………..……………..……………...………..………………………[4]
(b) Read the section of program code for attempting the following question.
01 Total = 0
02 FOR Index = 1 TO 25
03 INPUT Number
04 IF Number > 0 THEN
05 Total=Total + Number
06 ENDIF
07 NEXT Index
08 OUTPUT (Total/Index)
Give the line number for the statements showing:
Assignment ------- Calculating the average -------
Totalling ------- Selection -------
Counter Variable ------- Iteration -------
[4]
7. Study the pseudocode
1. SET Total to Zero
2. INPUT Number
3. FOR COUNTER = 1 TO Number
4. INPUT Mark
5. Total = Total + Mark
6. NEXT COUNTER
7. OUTPUT Total / Number
(a) Dry run the algorithm using the following data. 3, 5, 6, 7, 8, 10 ,12
(i) Write down the final value of Total.….......................................................................……...…...[1]
(ii) Write down the value output .…............…….....................................................................…...[1]
(ii) What will happen if the line 5 is missing?……….…………...………………….....……...…...[1]
Paper | 2
7 PRINT "Accepted: ", Value
(b) Complete the trace table for this program code using the test data: 200,300,–1,50,60
Value OUTPUT
[5]
(c) Draw a flowchart to represent this section of the above program code.
……………………...……………………………….…………………….……….…….…
…………………..……………...……………………………….…………….……….…….
…………………..……………...……………………………………………..……….…….
……………………..…..……………...…………………………………………….………
…………………..……………...…………………………………………….……….…….
…………………..……………...…………………………………………….……….…….
…………………..……………...…………………………………………….……….…….
………………………..……………...…………………………………………….……….
……………………………..……………..………………………………………………[5]
9. (a) Tick (✓) one box to show the named a quantity that does not change its value over a period of time.
A. Logical operator [ ] B. Array [ ] C. Constant [ ] D. iteration [ ] [1]
(b) The following incomplete algorithm is intended to perform a calculation of total temperature in a
month and output the average temperature.
The asterisks below indicate four lines which are incomplete.
01. Total, Average = 0
* FOR Counter
03. Input temp
* Total
05. ENDFOR
* Average
*. Output “Average is:”
………………………………………………………...…………………………….……….
………………………………………………………...…………………………….……….
………………………………………………...……………………………..…………....[4]