Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

OPF BOYS COLLEGE, H-8/4, ISLAMABAD

Cambridge Ordinary Level


First Term Online Assessment

CANDIDATE
NAME

CANDIDATE CLASS/
NUMBER SECTION O, LEVEL – II

COMPUTER SCIENCE 2210/1


AUGUST 2020
1 hour 20 minutes
Candidates answer on Separate sheets.
Number your sheets carefully.
Send your scanned/captured answer sheets at my WhatsApp number: 0322 5348328
No calculators allowed. (PDF format is recommended)

READ THESE INSTRUCTIONS FIRST

Write your candidate name, candidate roll number at top of each answer sheet.
Write in dark black pen.
You may use a black marker for any diagrams, graphs or rough working.
Do not use staples, paper clips, and glue or correction fluid.

Answers all questions.

No marks will be awarded for using brand names of software packages or hardware.

The number of marks is given in brackets [ ] at the end of question or part question.

The maximum number of the marks is 50.

This document consists of 05 printed pages.


OPF BOYS COLLEGE
Examination System [Turn over
Q1. Draw a structure diagram for finding your required book from the College Library. [4]

Q2. Name any four types of validation checks with one example each. [4]

Q3. This flowchart inputs the weight of items in kilograms to be loaded on a trailer. Any item over 25
kilograms is rejected. The trailer can take up to 100 kilograms.

Complete the trace table for the input data: [8]


13, 17, 26, 25, 5, 10, 15, 35, 20, 15
2
Q4. An algorithm has been written in pseudocode to input 100 numbers and print out the sum.
A REPEAT … UNTIL loop has been used.
Count ← 0
Sum ← 0
REPEAT
INPUT Number
Sum ← Sum + Number
Count ← Count + 1
UNTIL Count > 100
PRINT Sum
(a) Find the error in the pseudocode and suggest the correction.

Error ........................................................................................................................................... [2]

Correction ................................................................................................................................. [2]

...................................................................................................................................................
(b) Rewrite the correct algorithm using a more suitable loop structure. [4]

3
Q5. 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: [6]
5, 7, +, 6, 2, –, 4, 3, *, 7, 8, ?, 0, 0, /

(b) Show how you could improve the algorithm written in pseudocode by writing an alternative type
of conditional statement in pseudocode. [4]
Q6. A programmer has written a routine to store the name, email address and password of a contributor
to a website’s discussion group.
(a) The programmer has chosen to verify the name, email address and password.
Explain why verification was chosen and describe how the programmer would verify this data. [4]
(b) The programmer has also decided to validate the email address and the password.
Describe validation checks that could be used.
Email address ............................................................................................................................
...................................................................................................................................................
...................................................................................................................................................

4
Password ..................................................................................................................................
...................................................................................................................................................
................................................................................................................................................... [4]

Q7. Four statement types and four examples are shown below. Draw a line to connect each statement
type to the correct example. [4]

Q8. Identify two different selection statements that you can use when writing pseudocode.
1 ........................................................................................................................................................

..........................................................................................................................................................

2 ........................................................................................................................................................

......................................................................................................................................................... [4]

You might also like