User interface language: English | Español

Date November 2018 Marks available 6 Reference code 18N.1.SL.TZ0.9
Level SL Paper 1 Time zone no time zone
Command term Construct Question number 9 Adapted from N/A

Question

Outline the need for higher level languages.

[2]
a.

Explain two benefits of using sub-procedures within a computer program.

[4]
b.

Identify three characteristics of a collection.

[3]
c.

Collection NUMBERS already exists and stores real numbers.

Construct in pseudocode an algorithm, using the access methods of a collection, which will iterate through the collection NUMBERS and count how many elements stored in the collection are in the interval [−1,1].

The final answer should be output.

[6]
d.

Markscheme

Award [1] for the answer identifying improved programmer productivity and [1] for making reference to machine independence up to [2 max].

High-level language(HLL) provides statements (for example, high level if(…), while(…) , etc.) which are not dependent on the specific machine / and ability to create various data structures;
Which saves the programmer’s time;

Higher level languages are closer to human language;
So programmers find them easier to understand/work with than lower level languages;

HLL saves programmer from knowing details of computer architecture (and using all the specific (machine) instructions);
So giving more time to creating/developing the best way of coding a problem/process of coding is simpler and more understandable;

a.

Award [4 max].
Mark as [2] and [2].

Award [1] for an answer stressing the usefulness of sub-procedures in any of the following:
Program organization;
Program coding;
Program testing;
Maintenance;
etc.

Award [1] for the expansion up to [2 max].

Problem could be divided into smaller/easier parts;
Which means solving easier/smaller parts of the problem for one programmer;
Or for a team of programmers, each programmer could work on different smaller parts;

Simpler testing;
Each part of the program could be separately tested;
By the programmer who created the code or someone else in the team of programmers;

Reusable code;
Sub-procedures already written/tested could be used in various programs;

Simpler maintenance and changes;
Could be done only on required sub-programs;

b.

Award [3 max].

Award [1] for data structure implementation/objects/elements of collections.
Award [1] for algorithms/methods/callback functions.
Award [1] for showing that collection reduces programming effort / increases performance (by providing efficient implementations of data structures and algorithms).

Award marks for description of a specific example collections (in Java or any other programming language) such as arrays, dictionaries, sets, lists, trees (they have some characteristics in common, but also each of them has different way of organizing the data elements/objects they contain).

Collection is a container of discrete values;
Usually of the same type (primitive data values and also some other data structures);
(But) collection objects can be of different types (pointers afford a flexibility and thus collection objects permit references to any data structure as well as to primitive values);
Collections have a set of methods that define operations performed on the elements/objects of that collection;
Such as adding/removing elements to/from collection, comparing elements of collection, searching, etc.;
Which reduces programming effort (because implementations of data structures and algorithms are provided);
Which increases performance of the program (because efficient implementations are provided);

c.

Award [6 max].

Award [1] for initialization and for outputting correct result (COUNTER).
Award [1] for using collection methods.
Award [1] for correct loop.
Award [1] for retrieving a number (ELEMENT) from the collection.
Award [1] for if statement within the loop.
Award [1] for correct condition in if statement.
Award [1] for increasing COUNTER if needed.

Example answer:

COUNTER = 0
NUMBERS.resetNext()
loop while NUMBERS.hasNext()
ELEMENT = NUMBERS.getNext()
if ELEMENT >= −1 and ELEMENT <= 1 then // abs(ELEMENT) <= 1
COUNTER = COUNTER + 1
end if
end loop
output COUNTER

Note: be flexible over the method names. For example, NUMBERS.getData() is acceptable instead of NUMBERS.getNext().

d.

Examiners report

[N/A]
a.
[N/A]
b.
[N/A]
c.
[N/A]
d.

Syllabus sections

Topic 4: Computational thinking, problem-solving and programming » 4.3 Introduction to programming
Show 34 related questions
Topic 4: Computational thinking, problem-solving and programming

View options