2210 - 02 - Status - 02november - 2023
2210 - 02 - Status - 02november - 2023
1. Describe, giving an example for each, the following data types used in programming.
Draw a line to link each pseudocode description to the most appropriate pseudocode statement.
Pseudocode description Pseudocode statement
FOR…TO…NEXT
a loop that will always iterate at least once
IF…THEN…ELSE…ENDIF
a conditional statement to deal with many possible outcomes
WHILE…DO…ENDWHILE
a loop that will always iterate a set number of times
CASE…OF……ENDCASE
a conditional statement with different outcomes for true and false
REPEAT…UNTIL
[4]
2. Pi = 3.14
OUTPUT “Enter Radius Circle “
INPUT r
Area= Pi * r * r
OUPUT “The Area is“ & Area
(a) (i) Name the constant in the above code. ……………...…………...……………..………....[1]
(ii) Name the variable in the above code. ………………...………...……………..………....[1]
(b) State what is meant by a:
Constant ...................................................................................................................................
Variable................................................................................................................................[2]
(c) What is the code for user prompts in above program?
…………………………………………………………………...……………..………....[1]
3. (a) Tick (✓) one box to show the named section of a program that performs a specific task.
A. parameter [ ] B. process [ ] C. file [ ] D. function [ ] [1]
(b) State the output of the build in functions used for
ROUND( 12.9721 , 2 ) ...................................................................................................[1]
(c) Tick (√) whether each of the following is a method of validation.
[1]
Validation
A computer comparing two versions of the data
Applying a length check
Performing a range check
Visually comparing data on screen data source
4. Read the pseudocode statement to count the number which are less than 50.
1 Total = ‘0’
2 FOR Index = 1 TO
3 INPUT Number
4 IF Number > 50 THEN Total = Total + 1
5 NEXT Index
6 OUTPUT Number
(a) Identify which line of code would causes the following errors
run-time .................................................................................................................................
syntax ......................................................................................................................................
logical .................................................................................................................................[3]
[2]
(b) Part of a sports management system:
A module to enter details for player scores goals for match
A module to calculate the total or average goals
A module to display the average goals
Draw a structure diagram for this part of the sports management system. [3]
Sports
Managment
Calculate
Goal
6. The following algorithm inputs 20 numbers and outputs how many numbers were positive (> 0) and
how many numbers were negative (< 0). There are many different errors in this algorithm.
1 negative = 1
2 positive = 1
3 FOR count = 1 to 20 Do
4 INPUT Number
5 IF Number < 0 THEN negative = negative + 1
6 IF Number > 0 THEN positive = positive + 1
7 count = count + 1
8 OUTPUT negative, positive
9 NEXT count
(a) State the line numbers that contain the errors and describe how to correct each error.
Error 1 ....................................................................................................................................
................................................................................................................................................
Error 1 ....................................................................................................................................
................................................................................................................................................
Error 1 ....................................................................................................................................
............................................................................................................................................[3]
(b) State the purpose of this program.
………………………………………………………………......……………..………....[1]
7. (a) State the correct uses for each of the following flowchart symbols. [3]
1 2 3
Symbols use
1
2
3
(b) Complete the following program flowchart by placing the instructions in their correct position.
Diagram that will input 100 positive marks in an array and print out the Total Mark. [4]
Start
I= 0, …….
INPUT ……
Yes
M (I) > …...? T = T + …….
No
I = I+1
……..
I = …..?
(c) Complete the trace table for program assuming the array contains 3 elements 30,-80, 40 have been
input.
Input M M(I)>O T=T+M(I) Output T
30 TRUE 0+30
-80
40
[3]
(d) Describe what the algorithm represented by the flowchart is doing.
………………….……………………………………………......……………..………....[1]
8. FUNCTION Add(Number)
Result = INT(Number * 1.5)
RETURN Result
ENDFUNCTION
X=25
CALL Add(X)
(a) State the keyword, other than the FUNCTION,that suggest the code is a function.
…………………………………………………………………...……………..………....[1]
(b) State the name of the identifiers used for the functions
Argument ...............................................Parameter.............................................................[2]
(c) What is the output of the function? .........................................................................................[1]
(d) What is the build in function used in the above program? ..........................................................[1]