User interface language: English | Español

Date May 2021 Marks available 4 Reference code 21M.1.SL.TZ0.14
Level SL Paper 1 Time zone no time zone
Command term Copy and Complete Question number 14 Adapted from N/A

Question

The following flowchart represents a standard algorithm:

Copy and complete the table that traces the algorithm in the flowchart using an input value of 19.

[4]
a.

State the purpose of the algorithm.

[1]
b.

Construct the algorithm from the flowchart using pseudocode. Add additional pseudocode to ensure that input is validated to only allow positive integers to be entered.

[6]
c.

Efficiency is an important consideration when designing algorithms to ensure they don’t waste computer resources such as memory or processing time.

Suggest two design considerations that could be made to an algorithm that would make it more efficient.

[4]
d.

Markscheme

Award [4 max] 

Award up to [4 max]:
Correct table with correct first row;
Rest of NUMBER column correct;
Rest of DIGIT column correct;
Rest of OUTPUT column correct;

 

a.

Award [1 max] 
Converts denary number to (reverse) binary.

b.

Award [6 max] 
Validation to check for positive numbers;
Validation to check for integers;
Loop for validation rules;
Loop structure to continue while NUMBER > 1;
Correct calculations/outputs inside loop;
Correct output of last digit outside loop;

Example answer:

input NUMBER 
loop while NUMBER <= 0 OR NUMBER ≠ NUMBER div 1
output "Please input another number, your entry is invalid "
input number
end loop
loop while NUMBER > 1
DIGIT = NUMBER mod 2
output DIGIT
NUMBER = NUMBER div 2
end loop
output NUMBER
c.

Award [4 max] 
The algorithm could use loops;
To remove the necessity to process extra lines of code;

Use of arrays/data structures;
So data can be stored/re-used/re-entered;

Use of flags;
To stop a search routine when an item has been found so that all elements don’t have to be searched;

Mark as 2 and 2 

d.

Examiners report

A mixed set of responses was seen for this question, which was a trace table for a given algorithm presented as a flowchart. Most candidates achieved at least one mark, but many marks were lost through incomplete trace tables, or candidates not writing the complete output that the algorithm would produce.

a.

A significant minority of candidates recognised that the algorithm was converting a denary number to binary. Other candidates described the process, almost line by line, that the algorithm followed, which is not the purpose of the algorithm.

b.

A mixed set of results was seen for this question with most candidates achieving some of the marks. Many of these candidates provided a working loop with the correct calculations and outputs inside and outside of the loop. Some of these candidates also demonstrated some of the validation that was required, either to only allow positive numbers into the algorithm or making sure the number was an integer. Very few candidates checked for both of these things, and even fewer allowed for the number to be re-input if it wasn’t a positive integer, but simply stopped the algorithm.

c.

Candidates performed less well on this question which required candidates to describe aspects of program design that would make an algorithm more efficient, such as use of loops to avoid repeated lines of code, or use of flags to stop a loop, to prevent unnecessary iterations.

d.

Syllabus sections

Topic 4: Computational thinking, problem-solving and programming » 4.2 Connecting computational thinking and program design
Show 59 related questions
Topic 4: Computational thinking, problem-solving and programming

View options