Algorithms Y4g4QDPT6qFpnG7K Medium

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

IGCSE Cambridge (CIE) Computer Science 23 mins 8 questions

Exam Questions

Algorithms
Designing Algorithms / Explaining Algorithms

Scan here for your answers


or visit savemyexams.com

Total Marks /23

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 1
1 Describe what the algorithm represented by the flowchart is doing.

the algorithm sorts the names stored in an array in asending order

(2 marks)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 2
2 The pseudocode algorithm shown has been written by a teacher to enter marks for the
students in her class and then to apply some simple processing.

Count ← 0
REPEAT
INPUT Score[Count]
IF Score[Count] >= 70
THEN
Grade[Count] ← "A"
ELSE
IF Score[Count] >= 60
THEN
Grade[Count] ← "B"
ELSE
IF Score[Count] >= 50
THEN
Grade[Count] ← "C"
ELSE
IF Score[Count] >= 40
THEN
Grade[Count] ← "D"
ELSE
IF Score[Count] >= 30
THEN
Grade[Count] ← "E"
ELSE
Grade[Count] ← "F"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Count ← Count + 1
UNTIL Count = 30

Describe what happens in this algorithm.

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 3
(3 marks)

3 B ← FALSE

INPUT Num

FOR Counter ← 1 TO 12

IF A[Counter] = Num

THEN

B ← TRUE

ENDIF

NEXT Counter

Identify the purpose of the algorithm.

(1 mark)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 4
4 (a) The flowchart shows an algorithm that should allow 60 test results to be entered into the
variable Score.

Each test result is checked to see if it is 50 or more. If it is, the test result is assigned to
the Pass array. Otherwise, it is assigned to the Fail array.

Complete this flowchart

input Score

is Score>
50

Pass[count]=Score Fail[Count]=Score

PassCount=PassCount+1 FailCount=FailCount+1

is Count>60

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 5
(6 marks)

(b) Write a pseudocode routine that will check that each test result entered into the
algorithm is between 0 and 100 inclusive.

(4 marks)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 6
5 The pseudocode represents an algorithm.

The pre-defined function DIV gives the value of the result of integer division. For example,
Y = 9 DIV 4 gives the value Y = 2

The pre-defined function MOD gives the value of the remainder of integer division. For
example, R = 9 MOD 4 gives the value R = 1

First ← 0
Last ← 0
INPUT Limit
FOR Counter ← 1 TO Limit
INPUT Value
IF Value >= 100
THEN
IF Value < 1000
THEN
First ← Value DIV 100
Last ← Value MOD 10
IF First = Last
THEN
OUTPUT Value
ENDIF
ENDIF
ENDIF
NEXT Counter

Describe the purpose of the algorithm.

(2 marks)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 7
6 (a) This algorithm checks the temperature of hot food being served to customers.

State how the final output from the algorithm could be improved.

(1 mark)

(b) Identify the process in the algorithm that is not required.

(1 mark)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 8
7 This flowchart represents an algorithm.

Describe what the algorithm represented by the flowchart is doing.

(2 marks)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 9
8 The variables P and Q are used to store data in a program. P stores a string. Q stores a
character.

Give the value of Position after the algorithm has been executed with the data in the
below question.

Write pseudocode statements to declare the variables P and Q, store "The world" in P
and store 'W' in Q

(1 mark)

© 2024 Save My Exams, Ltd. Get more and ace your exams at savemyexams.com 10

You might also like