Algorithm design and problem-solving – A Level Computer Science (9618)

35 questions · page 3 of 3

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
31
9618/22/M/J/22 · Question 2May/June 2022Paper 224 marks
Loading question…
Question text

2
An algorithm is described as follows:
1.
Input an integer value.
2.
Jump to step 6 if the value is less than zero.
3.
Call the function IsPrime() using the integer value as a parameter.
4.
Keep a count of the number of times function IsPrime() returns TRUE.
5.
Repeat from step 1.
6.
Output the value of the count with a suitable message.
Draw a program flowchart to represent the algorithm.
START
END
[4]

32
9618/21/O/N/21 · Question 2Oct/Nov 2021Paper 2112 marks
Loading question…
Question text

2
(a) An algorithm to sort a 1D array into ascending order is described as follows:
•
move the largest value to the end
•
keep repeating until the array is sorted.
Apply the process of stepwise refinement to this algorithm in order to produce a more detailed
description.
Write the more detailed description using structured English. Your explanation of the
algorithm should not include pseudocode statements.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
(b) The program flowchart shown describes a simple algorithm.
START
Set Count to 1
Set Flag to FALSE
Is Flag =
YES
FALSE AND
Count <= 5 ?
NO
ReBoot()
Set Count to Count + 1
Set Flag to Check()
YES
Is Flag =
FALSE ?
NO
Alert(27)
END
Write pseudocode for the simple algorithm shown on page 6.
…
…
…
…

33
9618/22/O/N/21 · Question 1Oct/Nov 2021Paper 2211 marks
Loading question…
Question text

1
(a) A programmer applies decomposition to a problem that she has been asked to solve.
Describe decomposition.
…
…
…
…
…
… [2]
(b) The following pseudocode assigns a value to an element of an array:
← 42
ThisArray[n]
Complete the following table by writing the answer for each row.
Answer
The number of dimensions of ThisArray
The technical terms for minimum and
maximum values that the variable n may take
The technical term for the variable n in the
pseudocode statement
[3]
(c) Complete the pseudocode expressions so that they evaluate to the values shown.
Any functions and operators used must be defined in the insert.
Expression
Evaluates to
67
… ('C')
54
2 * … ("27")
13
… (27 / … )
"Subtract"
"Sub" & … ("Abstraction" , … , … )
[4]
(d) Evaluate the expressions given in the following table. The variables have been assigned
values as follows:
←
TRUE
PumpOn
←
TRUE
PressureOK
←
FALSE
HiFlow
Expression
Evaluates to
PressureOK AND HiFlow
PumpOn OR PressureOK
NOT PumpOn OR (PressureOK AND NOT HiFlow)
NOT (PumpOn OR PressureOK) AND NOT HiFlow
[2]

Advertisement
34
9618/22/O/N/21 · Question 2Oct/Nov 2021Paper 2210 marks
Loading question…
Question text

2
(a) An algorithm will:
1.
input an integer value
2.
jump to step 6 if the value is zero
3.
sum and count the positive values
4.
sum and count the negative values
5.
repeat from step 1
6.
output the two sum values and the two count values.
Draw a program flowchart on the following page to represent the algorithm.
Note that variable declarations are not required in program flowcharts.
[5]
(b) A software company is working on a project to develop a website for a school.
The school principal has some ideas about the appearance of the website but is unclear
about all the details of the solution. The principal would like to see an initial version of the
website.
(i)
Identify a life cycle method that would be appropriate in this case.
Give a reason for your choice.
Life cycle method …
Reason …
…
…
…
[2]
(ii)
The website project has progressed to the design stage.
State three activities that will take place during the design stage of the program
development life cycle.
1 …
2 …
3 …
[3]

35
9618/22/M/J/21 · Question 4May/June 2021Paper 226 marks
Loading question…
Question text

4
A teacher uses a paper-based system to store marks for a class test. The teacher requires a
program to assign grades based on these results.
The program will output the grades together with the average mark.
Write a detailed description of the algorithm that will be needed.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
9618/

Advertisement