User interface language: English | Español

Date May 2022 Marks available 2 Reference code 22M.1.SL.TZ0.13
Level SL Paper 1 Time zone no time zone
Command term Identify Question number 13 Adapted from N/A

Question

A teacher would like a simple program to store the names, marks and grades of students in a set of three parallel one-dimensional arrays called NAME[], MARK[] and GRADE[] .

The grade boundaries for the individual grades are shown below:

The class has 30 students.

Identify two components in a conditional statement.

[2]
a.

Construct an algorithm using pseudocode to take the marks that have been stored in MARK[], convert them into the appropriate grade and store the calculated grades in GRADE[].

[5]
b.

Outline how the name, mark and grade in the three arrays correspond to the same student.

[2]
c.

Construct an algorithm using pseudocode to output the names and grades of all students who achieve a grade of Merit or Distinction.

[3]
d.

Explain how you would change your algorithm in part (d) to allow a user to choose a grade and output the names and marks of the students who have achieved this grade.

[3]
e.

Markscheme

Award [2 max].
if;
then;
else;

Note to examiners: allow an alternative descriptive version such as:
test/condition;
action/consequence;
(optional) alternative action/consequence;

a.

Award [5 max].
Award [1] for an appropriate loop with correct loop parameters to cover 30 array elements/all students
Award [1] for correct use of indexes in two arrays (MARK and GRADE)
Award [1] for each if statement with correct condition and grade assignment up to [4].

Note to examiners: Award [4] if candidate has correctly used an alternative conditional statement such as switch/ case.

Example answer 1:

loop COUNTER from 0 to 29
if MARK[COUNTER] >= 80
then GRADE[COUNTER] = "Distinction"
else
if MARK[COUNTER]>˝= 60
then GRADE[COUNTER] = "Merit"
else
if MARK[COUNTER} >= 40
then GRADE[COUNTER] = "Pass"
else
GRADE[COUNTER] = "Fail"
end if
end if
end if
end loop

Example answer 2:

COUNTER = 1
loop while COUNTER <= 30
if MARK[COUNTER-1] >= 80
then GRADE[COUNTER-1] = "Distinction"
end if
if MARK[COUNTER-1] >= 60 and MARK[COUNTER-1] < 80
then GRADE[COUNTER-1] = "Merit"
end if
if MARK[COUNTER-1} >= 40 and MARK[COUNTER-1] < 60
then GRADE[COUNTER-1] = "Pass"
end if
if MARK[COUNTER-1} < 40
GRADE[COUNTER-1] = "Fail"
end if
COUNTER = COUNTER + 1
end loop
b.

Award [2 max].
Three arrays are parallel/ they have the same number of elements/ the same length;
the same array index can be used to represent name, grade and mark of the same student/ the array index makes sure that data from the three arrays lines up;

c.

Award [3 max].
Award [1] for correct loop to check all students
Award [1] for correct conditional statement checking correct array
Award [1] for correct output

Example answer 1:

loop COUNTER from 0 to 29
if MARK[COUNTER] >= 60 then
output NAME[COUNTER], GRADE[COUNTER]
end if
end loop

Example answer 2:

loop C from 0 to 29
if GRADE[C].equals(“Merit”)OR GRADE[C].equals(“Distinction”)
then
output NAME[C], GRADE[C]
end if
end loop
d.

Award [3 max].
Award [1] for an input statement before the loop;
Award [1] for changing the conditional statement so that it checks the GRADE[] array for the GRADE input (using the same variable)
Award [1] for outputting the name and marks of the student who has achieved the inputted grade

Note to examiners: Accept a written explanation or an amended algorithm that corresponds to candidate’s answer to part(d).

Example 1:

G=input()
COUNTER = 0
loop while COUNTER < 30
if GRADE[COUNTER] = G
then
output(NAME[COUNTER], MARK[COUNTER])
end if
COUNTER = COUNTER + 1
end loop
e.

Examiners report

Candidates who gave an example of a conditional statement did enough to get both marks for this question. Other candidates who described the make-up of a conditional statement, were also successful.

a.

Candidates were able to demonstrate the construction of an algorithm to take marks that were stored, convert them into a grade and then store the calculated grades. However, fully correct pseudocode solutions were rare. Errors that were seen included incorrect loop constructs; loops not covering the whole data set; incorrect use of array indexing for both retrieval and storage; incorrect data types – the data to be stored was of the string data type, but this was not always shown; incorrect use of assignment.

b.

The vast majority of candidates recognised that a particular student’s data used the same index in each of the three arrays, therefore indicating that the data in each array corresponded to the same student. Relatively few candidates identified the fact that this was because they were parallel arrays.

c.

Another algorithm was required here with some of the same problems as seen in question 13b, however, most candidates did achieve marks here, mostly for the correct use of conditional statements.

d.

Candidates were asked to explain how they would change their algorithm in question 13d to achieve some additional functionality. Most candidates did achieve some marks here for adding an input, changing the conditional statement and/or changing the output.

e.

Syllabus sections

Topic 4: Computational thinking, problem-solving and programming » 4.1 General principles
Topic 4: Computational thinking, problem-solving and programming

View options