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

14 questions · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
9618/21/O/N/25 · Question 2Oct/Nov 2025Paper 215 marks
Loading question…
Question text

2
Data is a global 1D array containing 30 elements of type STRING
An algorithm will output:
•
all non-blank elements (elements that do not contain an empty string)
•
the final total of the number of elements output.
Complete the program flowchart to represent the algorithm:
START
END
[5]
ĬÕĊ®Ġ´íÈõÏĪÅĊÝû¸Ā×

2
9618/21/O/N/24 · Question 1Oct/Nov 2024Paper 219 marks
Loading question…
Question text

1
A program will calculate the tax payable based on the cost of an item.
Calculations will occur at many places in the program and these involve the use of one of three tax
rates.
Tax rate values represent a percentage. For example, a tax rate value of 5.23 represents 5.23%.
In this case, the tax payable on an item costing $100 would be $5.23.
Tax rate values are used at several places within the program. One example is given in pseudocode
as follows:
←
HighRate
FALSE
CASE OF ItemCost
← 3.75
<= 50 : TaxRate
// tax rate of 3.75%
← 5.23
<= 200 : TaxRate
// tax rate of 5.23%
← 6.25
> 200 : TaxRate
// tax rate of 6.25%
← TRUE
HighRate
ENDCASE
←
* TaxRate // tax payable
TaxPayable
ItemCost
(a) The pseudocode contains a logical error.
Identify the error and suggest a correction.
Error …
…
Correction …
…
[2]
(b) During the design of the program, tax rate values have been used wherever they are needed
as shown in the pseudocode example above. Tax rates do not change while the program runs.
(i)
Identify a more appropriate way of representing the tax rate values in the final program.
… [1]
(ii)
Describe the benefits of your answer to part (b)(i) with reference to this program.
…
…
…
…
…
… [3]
ĬÕĊ®Ġ´íÈõÏĪÅĊÞü·þ×
,
,
(c) Give the appropriate data type for the variables in the following table, as used in the
pseudocode:
Variable name
Data type
HighRate
TaxPayable
[2]
(d) The final CASE condition (> 200) in the pseudocode example could be replaced with a
keyword.
Give the keyword.
… [1]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÞú·þ×

3
9618/23/O/N/24 · Question 2Oct/Nov 2024Paper 237 marks
Loading question…
Question text

2
An algorithm will:
1.
prompt and input a sequence of 100 integer values, one at a time
2.
sum the positive integers
3.
output the result of the sum.
(a) Write pseudocode for the algorithm.
Assume the value zero is neither positive nor negative.
You must declare all variables used in the algorithm.
…
…
…
…
…
…
…
…
…
…
…
…
… [5]
(b) The algorithm requires the use of basic constructs. One of these is sequence.
Identify one other basic construct required by the algorithm and describe how it is used.
Construct …
Use …
…
[2]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊÝû·þ×

Advertisement
4
9618/21/O/N/23 · Question 2Oct/Nov 2023Paper 217 marks
Loading question…
Question text

2
(a) An algorithm is expressed as follows:
•
input 100 numbers, one at a time
•
keep a total of all numbers input that have a value between 30 and 70 inclusive and
output this total after the last number has been input.
Outline, using stepwise refinement, the five steps for this algorithm which could be used to
produce pseudocode.
Do not use pseudocode statements in your answer.
Step 1 …
…
Step 2 …
…
Step 3 …
…
Step 4 …
…
Step 5 …
…
[5]
(b) Sequence is one programming construct.
Identify two other programming constructs that will be required when the algorithm is
converted into pseudocode.
Construct 1 …
…
Construct 2 …
…
[2]

5
9618/22/O/N/23 · Question 1Oct/Nov 2023Paper 2211 marks
Loading question…
Question text

1
A shop sells car accessories. A customer order is created if an item cannot be supplied from
current stock. A program is being developed to create and manage the customer orders.
(a) The following identifier table shows some of the data that will be stored for each order.
Complete the identifier table by adding meaningful variable names and appropriate data
types.
Example
Explanation
Variable name
Data type
value
"Mr Khan"
The name of the customer
3
The number of items in the order
TRUE
To indicate whether this is a new customer
15.75
The deposit paid by the customer
[4]
(b) Other variables in the program have example values as shown:
Variable
Example value
Total
124.00
DepRate
2.00
Description
"AB12345:Cleaning Brush (small)"
Complete the table by evaluating each expression using the example values.
Expression
Evaluates to
(Total * DepRate) + 1.5
RIGHT(Description, 7)
(LENGTH(Description) - 8) > 16
NUM_TO_STR(INT(DepRate * 10)) & '%'
[4]
(c) The data that needs to be stored for each customer order in part (a) is not all of the same
type.
Describe an effective way of storing this data for many customer orders while the program is
running.
…
…
…
…
…
… [3]

6
9618/22/O/N/23 · Question 2Oct/Nov 2023Paper 227 marks
Loading question…
Question text

2
An algorithm will:
1.
input a sequence of integer values, one at a time
2.
ignore all values until the value 27 is input, then sum the remaining values in the sequence
3.
stop summing values when the value 0 is input and then output the sum of the values.
(a) Draw a program flowchart to represent the algorithm.
START
END
[5]
(b) The solution to the algorithm includes iteration.
Give the name of a suitable loop structure that could be used.
Justify your answer.
Name …
Justification …
…
[2]

7
9618/22/O/N/23 · Question 5Oct/Nov 2023Paper 2230 marks
Loading question…
Question text

5
A global 1D array of integers contains four elements, which are assigned values as shown:
← 1
Mix[1]
← 3
Mix[2]
← 4
Mix[3]
← 2
Mix[4]
A procedure Process() manipulates the values in the array.
The procedure is written in pseudocode:
PROCEDURE Process(Start : INTEGER)
DECLARE Value, Index, Count : INTEGER
← Start
Index
← 0
Count
REPEAT
←
Mix[Index]
Value
←
Mix[Index] - 1
Mix[Index]
←
Value
Index
←
Count + 1
Count
UNTIL Count = 5
← Count * Index
Mix[4]
ENDPROCEDURE
Complete the trace table on the opposite page by dry running the procedure when it is called as
follows:
CALL Process(3)
Index
Value
Count
Mix[1]
Mix[2]
Mix[3]
Mix[4]
[6]

8
9618/23/O/N/23 · Question 5Oct/Nov 2023Paper 2328 marks
Loading question…
Question text

5
A global 1D array of integers contains four elements, which are assigned values as shown:
← 4
Mix[1]
← 2
Mix[2]
← 3
Mix[3]
← 5
Mix[4]
A procedure Process() manipulates the values in the array.
The procedure is written in pseudocode as follows:
PROCEDURE Process(Start : INTEGER)
DECLARE Value, Index, Total : INTEGER
← Start
Index
← 0
Total
WHILE Total < 20
←
Mix[Index]
Value
←
Total + Value
Total
IF Index < 4 THEN
←
Mix[Index] + Mix[Index+1]
Mix[Index]
ELSE
←
Mix[Index] + Mix[1]
Mix[Index]
ENDIF
←
(Value MOD 4) + 1
Index
ENDWHILE
← Total * Index
Mix[1]
ENDPROCEDURE
Complete the trace table on the opposite page by dry running the procedure when it is called as
follows:
CALL Process(2)
Index
Value
Total
Mix[1]
Mix[2]
Mix[3]
Mix[4]
[6]

Advertisement
9
9618/21/O/N/22 · Question 2Oct/Nov 2022Paper 215 marks
Loading question…
Question text

2
A system is being developed to help manage a car hire business. A customer may hire a car for a
number of days.
An abstract model needs to be produced.
(a) Explain the process of abstraction and state four items of data that should be stored each
time a car is hired.
Explanation …
…
Item 1 …
Item 2 …
Item 3 …
Item 4 …
[3]
(b) Identify two operations that would be required to process the car hire data.
Operation 1 …
…
Operation 2 …
…
[2]

10
9618/22/O/N/22 · Question 4Oct/Nov 2022Paper 227 marks
Loading question…
Question text

4
The program flowchart represents a simple algorithm.
START
INPUT UserID
Set Average to
GetAverage(UserID)
Set Total to 0
Set Index to 4
Add 1 to Index
YES
Is Index < 7 ?
NO
Set Last to
SameMonth[Index]
NO
Is Average
Add Last to Total
> Last ?
YES
Add Average to Total
Update(UserID, Total)
END
(a) Write the equivalent pseudocode for the algorithm represented by the flowchart.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
(b) Give the name of the iterative construct in the flowchart.
… [1]

11
9618/23/O/N/22 · Question 3Oct/Nov 2022Paper 235 marks
Loading question…
Question text

3
An algorithm is needed to process a sequence of numbers. Numbers may be positive or negative
and may be integer or decimal.
The algorithm will:
•
prompt and input one number at a time until the value zero is input
•
sum the negative numbers
•
sum the positive numbers
•
when zero is input, output the two sum values and then end.
Describe the algorithm needed. Do not include pseudocode statements in your answer.
…
…
…
…
…
…
…
…
…
…
…
… [5]

12
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.
…
…
…
…

13
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
14
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]

Advertisement