0% found this document useful (0 votes)
14 views4 pages

2210 - 02 - Status - 01 - September 2022

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

2210 - 02 - Status - 01 - September 2022

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

2

For
Examiner
1. Describe, giving an example for each, the following data types used in programming. ’s
Integer: Description ………………...…………………………………………………….……... Use

…………………………….……………………………………………………………….……...
Example ……………………………...…………………………………………………….……...
Integer: Description ………………...…………………………………………………….……...
…………………………….……………………………………………………………….……...
Example ……………………………...……………………………………………………..….[4]
2. Give an example of a pseudocode statement or statements to perform each of the following
functions.
A condition controlled loop ………………………...……………………………………….……...
A conditional statement ....................................................................................................................
Totalling ......................................................................................................................................[3]
3. Read the following algorithm.
This pseudocode algorithm inputs two non-zero numbers and a sign, and then performs the
calculation shown by the sign. An input of zero for the first number terminates the process.

INPUT Number1, Number2, Sign


WHILE Number1 <> 0
IF Sign = '+' THEN Answer Number1 + Number2 ENDIF
IF Sign = '-' THEN Answer Number1 - Number2 ENDIF
IF Sign = '*' THEN Answer Number1 * Number2 ENDIF
IF Sign = '/' THEN Answer Number1 / Number2 ENDIF
IF Sign <> '/' AND Sign <> '*' AND Sign <> '-' AND Sign <> '+'
THEN Answer 0
ENDIF
IF Answer <> 0 THEN OUTPUT Answer ENDIF
INPUT Number1, Number2, Sign
ENDWHILE
(a) Complete the trace table for the input data:
5, 7, +, 6, 2, –, 4, 3, *, 7, 8, ?, 0, 0, /

Number1 Number2 Sign Answer OUTPUT

[6]
(b) Show how you could improve the algorithm written in pseudocode by writing an alternative
type of conditional statement in pseudocode.
……………………………………...……………………………………….……….……...
……………………………………...……………………………………….……….……...
16
…………………………………………...……………………………………………....[3]

© HEGICT 2021 2210 / P2 / Mock 01 / June 2021


3
4. Correct the pseudocode that inputs 10 Ages and outputs sum and average age.
1 FOR count = 1 to 3
2 INPUT Age
3 average = sum / count
4 NEXT
5 sum = sum + age
6 PRINT sum
[6]
5. A hotel uses a computer database to keep details of room bookings.
Part of this database is shown below.
Booking Guest Guest Type of Vegetarian Room
Number First name Surname Room Number
BR45678 Steven Smith Single Yes 2
BR12856 Karl Evans Double No 7
BR71234 Jay Singh Twin Yes 14
BR89765 Anna Jones Single No 1
BR34567 David McPherson Double No 5
(a) (i) State how many fields have string data type?.
…………………………………………………………………...……………..………....[1]

(ii) State the data type of Vegetarian.


……………………………………………...…………………………………..…….…...[1]
(b) Complete the boxes below for the fields, which could be in the room booking tables.
Field name Data type Field length
Numeric

Vegetarian
[4]
(c) The query-by-example grid below selects the entire double room with Vegetarian.
Field Booking Number Type of Room Vegetarian Room Number
Table Room_Booking Room_Booking Room_Booking Room_Booking
Sort Decending
Show √ √

Criteria =’Double’
or = TRUE

Show the output from the query-by-example…………………………………...………...[2]


(b) Use the query-by-example grid below to provide a list of Booking Number and Room
Number where all are Vegetarian in alphabetical order of Guest First Name.
Field
Table
Sort
Show
Criteria
or
[3]
17

© HEGICT 2021 2210 / P2 / Mock 01 / June 2021


4
6. Read this algorithm
Input Amount, Absent
IF (Amount > 5000) AND Absent <5
THEN
Bonus = Amount * .2
ELSE Output “No Bonus”
ENDIF
Output Bonus
(a) Write down the output if the following two numbers are input. 5000, 4
……………………………………………………………………….………………...[3]
(b) Rewrite the logic which will not accept negative number as Amount and Absent

…………………………………………………………………...………………..…...[3]

(c) State two types of operator used in the above program.

…………………………………………………………………...………………..…...[2]

7. The following section of pseudo code inputs mark for 20 subjects, calculates total and
average of the mark and outputs total and average mark.
SET total, average = 1
SET counter = 1
FOR counter = 0 To 10
Input Mark
Total = Total + Marks
NEXT counter
SET Average = Total / 1
Output Total, Average
(a) Locate the three errors in the above program.
…………………………………………………………………………………………….
.…..………………………………………………...……………………………………...
…………………………………………………...……………………………..……...[3]

(b) Suggest a corrected piece of code.


…………………………………………………………………………………………….
.…..………………………………………………...……………………………………...
…………………………………………………...……………………………..……...[3]
8. Look at the truth table below.
A B Output
0 1 1
1 1 0
0 0 0
0 1 1

(a) What logic gate does the table represent?


……………………………………………………………...………………............…....[2]

(b) Draw the logic circuit for the table.


………………………................................………………….……………..….........………..

……………………………………………………………...………………............…....[2] 18

© HEGICT 2021 2210 / P2 / Mock 01 / June 2021


5
9. Write the correct order for following algorithm, which will calculate the number of
students fail (<50) from 20 students. Steps 1, 6 and 8 have been done for you.
1 Set Fail to Zero
Fail = Fail + 1
For Counter = 1 To 20
IF mark < 50 THEN
8 output Fail
Next Counter
6 END IF
input mark
[6]
10. Read the following algorithm
Counter ← zero
WHILE Counter < 10 DO
IF the Counter is divisible by 2 THEN
Output Counter
ENDIF
Counter ← Counter + 1
ENDWHILE
(a) What will be the output of this algorithm?
……………………………………………………………….……...………………..…...[3]
(b) (i) Re-write the algorithm with FOR….NEXT.
.…..………………………………………………...………….……………………………...
…………………………………………………...…………….…………………..……...[5]

(ii) Why Counter ← Counter + 1 is not needed for FOR..NEXT Loop.


…………………………………………………………….……….………………………....
…………………………………………………………….………...………………..…...[2]

(c) Describe the other type of loop can be used above program
……………………………………….……………………………...………………..…...[2]

11. Draw a logic network for the following logic problem:


“A alarm light (AL) is ON if
either alarm (A) is ON and light (L) is ON
or sensor (S) is OFF and light (L)) is ON”
(a) Working…………………………………..................……………….……………..…........[3]
(b) Logic Network:

L AL

S
[5]
(c) Draw the logic circuit for the table.
……………………………………………………………...………………..............…....[2]
24
© HEGICT 2021 2210 / P2 / Mock 01 / June 2021

You might also like