Algorithm design and problem-solving – O Level Computer Science (2210)

137 questions · page 3 of 10 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
31
2210/23/O/N/24 · Question 2Oct/Nov 2024Paper 231 marks
Loading question…
Question text

2
Tick (✓) one box to show a method used to construct a solution to a problem.
A
abstraction
B
structure diagram
C
test data
D
variable
[1]

32
2210/23/O/N/24 · Question 5Oct/Nov 2024Paper 236 marks
Loading question…
Question text

5
One stage of the program development life cycle is the analysis stage.
Identify and describe two other stages of the program development life cycle.
Stage …
Description …
…
…
…
…
Stage …
Description …
…
…
…
…
[6]
ĬÏĊ®Ġ´íÈõÏĪÅĊÝü·þ×

33
2210/23/O/N/24 · Question 7Oct/Nov 2024Paper 239 marks
Loading question…
Question text

7
A programmer is testing a program that requires a positive value between 1 and 100 inclusive to
be entered. The range check in the program is to be tested.
Identify three different types of test data to be used.
For each type of test data, give an example of the value(s) to be used and the expected outcome.
Type 1 …
Example …
Outcome …
…
Type 2 …
Example …
Outcome …
…
Type 3 …
Example …
Outcome …
…
[9]
ĬÏĊ®Ġ´íÈõÏĪÅĊßü·Ā×

Advertisement
34
2210/23/O/N/24 · Question 9Oct/Nov 2024Paper 234 marks
Loading question…
Question text

9
A flowchart checks that values stored in three variables are identical.
If they are different, the highest value is stored in all three variables.
START
No
Is A = B AND
STOP
B = C ?
Yes
Yes
Is A >= B OR
B
A
A >= C ?
C
A
No
Yes
Is B >= A AND
A
B
B >= C ?
C
B
No
A
C
B
C
Identify four errors in the flowchart and suggest a correction for each error. You may label each
error on the diagram with the corresponding error number.
Error 1 …
Correction …
…
Error 2 …
Correction …
…
Error 3 …
Correction …
…
Error 4 …
Correction …
…
[4]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞú¶þ×

35
2210/21/M/J/24 · Question 1May/June 2024Paper 211 marks
Loading question…
Question text

1
Tick ( ü ) one box to complete this sentence.
A validation check to make sure that an email address contains an ‘@’ sign is a
A
range check.
B
visual check.
C
presence check.
D
format check.
[1]

36
2210/21/M/J/24 · Question 5May/June 2024Paper 215 marks
Loading question…
Question text

5
Write the pseudocode statements to perform this task:
•
accept the input of a whole number from 1 to 4 inclusive
•
use a CASE statement to:
○ output the number (1 to 4 inclusive) that was entered
○ output the word “ERROR” if a 1 to 4 inclusive number was not entered.
…
…
…
…
…
…
…
…
…
… [5]

37
2210/21/M/J/24 · Question 6May/June 2024Paper 2138 marks
Loading question…
Question text

6
The flowchart represents an algorithm.
START
Result
Limit DIV 2 + 1
INPUT
Limit
OUTPUT
Numbers[Result]
Count
1
INPUT
Numbers[Count]
STOP
Count
Count + 1
No
IS Count >
Limit?
No
IS Numbers[Count] >
Yes
Numbers[Count + 1]?
Flag
TRUE
Yes
Swap
Numbers[Count]
IS Flag =
No
TRUE?
Numbers[Count]
Numbers[Count + 1]
Yes
Flag
False
Numbers[Count + 1]
Swap
Count
1
Flag
True
IS Count >
Yes
No
Limit – 1?
Count
Count + 1
(a) Complete the trace table for the input data:
7, 47, 50, 52, 60, 80, 63, 70
Numbers
Limit
Count
[1]
[2]
[3]
[4]
[5]
[6]
[7]
Flag
Swap
Result
OUTPUT
[7]
(b) Outline the processes involved in the algorithm shown in the flowchart on page 6.
…
…
…
…
…
… [3]

38
2210/22/M/J/24 · Question 1May/June 2024Paper 221 marks
Loading question…
Question text

1
Tick (✓) one box to identify a method used to design and construct a solution to a computing
problem.
A
analysis
B
coding
C
flowchart
D
testing
[1]

Advertisement
39
2210/22/M/J/24 · Question 3May/June 2024Paper 223 marks
Loading question…
Question text

3
Identify three different tasks in the analysis stage of the program development life cycle.
1 …
…
2 …
…
3 …
…
[3]

40
2210/22/M/J/24 · Question 4May/June 2024Paper 2210 marks
Loading question…
Question text

4
A program needs to make sure the characters input for a product code meet these rules:
•
The product code is six characters in length.
•
The first two characters must be “PD”.
•
The last four characters must be a number in the range 1000 to 9999 inclusive.
(a) Identify three validation checks and state how each check would make sure the product code
met one of these rules.
Check 1 …
…
…
Check 2 …
…
…
Check 3 …
…
…
[6]
(b) The program design will include a pseudocode algorithm. Assume that the product code is
stored in the variable Product
(i)
Write the pseudocode to make sure that the product code is six characters in length.
…
…
…
…
… [2]
(ii)
Write the pseudocode to make sure that the first two characters of the product code are
“PD”.
…
…
…
…
… [2]

41
2210/22/M/J/24 · Question 6May/June 2024Paper 228 marks
Loading question…
Question text

6
Totalling and counting are standard methods of solution.
Numbers are input. The number 9999.9 is the last number to be input and is ignored.
(a) Write an algorithm in pseudocode to total the numbers input and to output the total.
You do not need to validate the input.
…
…
…
…
…
…
…
…
… [4]
(b) Write an algorithm in pseudocode to count and output the number of input values that are
greater than 100. You do not need to validate the input.
…
…
…
…
…
…
…
…
…
… [4]

42
2210/22/M/J/24 · Question 7May/June 2024Paper 228 marks
Loading question…
Question text

7
An algorithm has been written in pseudocode to find and display the maximum and minimum
values in an array of 1000 positive numbers. The array List[] starts at index 1
List[1]
01
Max
List[1]
02
Min
2 TO 1000
03
FOR Counter
04
IF List[Counter] < Max
05
THEN
List[Counter]
06
Max
07
ENDIF
08
IF List[Count] ˂ Min
09
THEN
List[Counter]
10
Min
11
ENDWHILE
12
NEXT Counter
13
OUTPUT "Maximum value is ", Max
14
OUTPUT "Minimum value is ", Min
(a) Give a line number for each of these types of statement:
Assignment statement …
Selection statement …
Iteration statement …
[3]
(b) Identify the line numbers of the three errors in the pseudocode and suggest a correction for
each error.
Error 1 line number …
Correction …
…
Error 2 line number …
Correction …
…
Error 3 line number …
Correction …
…
[3]

43
2210/22/M/J/24 · Question 9May/June 2024Paper 2237 marks
Loading question…
Question text

9
This flowchart represents an algorithm.
START
A
FALSE
B
1
No
IS List[B] >
T
List[B]
List[B + 1]?
Yes
List[B]
List[B + 1]
List[B + 1]
T
A
TRUE
B
B + 1
No
IS B =
5?
Yes
Yes
IS A =
TRUE?
No
STOP
(a) The array List[1:5] used in the flowchart contains this data:
List[1]
List[2]
List[3]
List[4]
List[5]
15
17
20
5
9
Complete the trace table using the data given in the array.
A
B
List[1] List[2] List[3] List[4] List[5]
T
15
17
20
5
9
[5]
(b) Describe what the algorithm represented by the flowchart is doing.
…
…
…
… [2]

Advertisement
44
2210/22/O/N/23 · Question 2Oct/Nov 2023Paper 227 marks
Loading question…
Question text

2
A type of validation check is a length check. Another type of validation check is used to make sure
that any date entered is in the dd/mm/yyyy style:
dd means day, mm means month and yyyy means year.
(a) State the type of validation check used.
… [1]
(b) Give one example of normal test data and one example of abnormal test data you should
use to make sure the check in part (a) is working properly.
State a reason for each of your choices of test data.
Normal …
Reason …
…
Abnormal …
Reason …
…
[4]
(c) Describe how a length check could be used with the date entered.
…
…
…
… [2]

45
2210/22/O/N/23 · Question 3Oct/Nov 2023Paper 228 marks
Loading question…
Question text

3
Four pseudocode statements and five pseudocode uses are shown.
(a) Draw one line to link each pseudocode statement to the most appropriate pseudocode use.
Not all pseudocode uses will be required.
Pseudocode use
Pseudocode statement
CALL Colour(NewColour)
counting
finding an average
Value
(A1 + A2 + A3) / 3
totalling
Loop1
Loop1 + 1
using a conditional statement
IF Count > 7 THEN X1
0
using a procedure
[4]
(b) A one‑dimensional (1D) array called Temperatures[] has 25 elements beginning at
index 1. It holds values that range between –20 and 100 inclusive.
Write a pseudocode algorithm using a single loop to find the lowest value in this array and
output the result only once.
You do not need to declare or populate this array.
…
…
…
…
…
…
…
…
…
…
…
… [4]

Advertisement