Agastya Sharma - J27702 Computational Thinking Algorithms and Programming June 2024
Agastya Sharma - J27702 Computational Thinking Algorithms and Programming June 2024
Programming construct
Keyword
Selection Iteration
if
for
while
[3]
The flowchart statements have been written for the algorithm, but the flowchart is incomplete.
[4]
Definition
Example
[2]
(b) A student writes an algorithm to input two numbers and add them together to create a total.
Identify the line number of the two logic errors in the algorithm and refine the code to correct each logic error.
Line number
Correction
Line number
Correction
[4]
i. Show how a binary search will be used to find the number 10 in the following data set:
1 2 5 6 7 10 20
[3]
[1]
iii. Tick (✓) one box to identify the name of the sorting algorithm that splits data into individual items before
recombining in order.
Bubble sort
Insertion sort
Merge sort
[1]
4(a) A program allows users to search for and watch videos. Users give a rating to the videos they watch.
Input
Output [2]
[2]
A B C P
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
[4]
[3]
message = "abcd1234"
Complete the table to show the output when each statement executes.
Statement Output
print(message.length) 8
print(message.upper)
print(message.left(4))
print(int(message.right(4))*2)
[3]
[3]
7(a) Give two reasons why some programs are written in a low-level language.
[2]
(b) Describe the benefits of using a compiler instead of an interpreter when writing a program.
[3]
p = random(1, 512)
a = ""
endwhile
[4]
The position of the character can only be between 1 and 512 inclusive.
9(a) Students take part in a sports day. The students are put into teams.
Students gain points depending on their result and the year group they are in. The points are added to the team
score.
The team with the most points at the end of the sports day wins.
Data about the teams and students is stored in a sports day program.
i. Identify the most appropriate data type for each variable used by the program.
teamName "Super-Team"
studentYearGroup 11
javelinThrow 18.2
[3]
ii. The student names for a team are stored in an array with the identifier theTeam
A linear search function is used to find whether a student is in the team. The function:
function linearSearch(studentName)
return …………….….....……………
endif
next count
return False
endfunction
[4]
04 score = 3
06 score = 2
07 else
08 score = 1
09 endif
10 if yearGroup != 11 then
11 score = score * 2
12 endif
Complete the trace table for the algorithm when a student in year 10 throws a distance of 14.3
You may not need to use all the rows in the table.
[4]
Complete the table to identify an example of test data for each type of test.
Boundary "VALID"
The database table TblResult stores the times of students in the 100 m race. Some of the data is shown:
Complete the SQL statement to show the Student ID and team name of all students who are in year group 11
FROM ..............................................................
...................................................................
[4]
(e) Abstraction and decomposition have been used in the design of the sports day program.
i. Identify one way that abstraction has been used in the design of this program.
[1]
ii. Identify one way that decomposition has been used in the design of this program.
[1]
[6]
Total 3
2 Correct shape for all three inputs AND 4 No need for arrows – lines are acceptable.
outputs (parallelogram) (AO2)
Correct shape for decision (diamond) BOD for correct answers that include a
True and False // Yes and No labelled loop back to the start
correctly (true/Yes linking to “Even”)
All lines joined up correctly and link to Examiner’s Comments
End.
The majority of candidates recognised the
correct flowchart shapes to be used for a
decision and many also were able to use
the parallelogram shape for inputs and
outputs. However, fewer correctly
connected up the boxes to make sure that
all paths started and ended at appropriate
points and even fewer candidates labelled
up the decision box appropriately with
True/False or Yes/No. These labels are
crucial to be able to follow the path of the
algorithm when a decision is made.
Total 4
3 a Max 1 mark for definition that is clearly 2 BOD code/program etc for BP1
different from a logic error. (AO1)
Do not allow answers linked to data types.
(an error that) breaks the
rules/grammar of the programming "incorrect grammar" by itself is NE
language
Stops the program from running // Do not allow “stop working”, "does not
does not allow program to run // work", etc – TV.
crashes the program // does not allow
program to translate Do not accept missing quotation marks
e.g. print(hello) (could be a variable
Suitable example for 1 mark, e.g. name)
misspelling key word (e.g. printt BOD given code that could cause a syntax
Misconception
Allow other logical equivalent code e.g. Ignore missing then from line 04.
total = int(num1) + int(num2) if
10 <= total <= 20 Ignore capitalisation.
Examiner’s Comments
Misconception
Exemplar 1
Total 11
b Only 1 method asked for. Could be name 2 Allow validation / input sanitisation /
and description/example or description (AO1) passwords as expansion of anticipating
and example misuse.
Total 4
Examiner’s Comments
Total 7
Examiner’s Comments
Total 6
Total 5
experience in school.
Exemplar 2
Total 10
Examiner’s Comments
Ignore capitalisation.
Examiner’s Comments
Examiner’s Comments
Answer may include lines where no Trace tables have appeared multiple times
changes or output happens (i.e. lines 3, 4, in J277 examination papers now and
5, 7, 8, 9, 10, 12). candidates are hopefully familiar with the
expectations, which are consistent across
Where variable doesn't change, current series.
value may be repeated on subsequent
lines. Most candidates correctly traced through
the given algorithm, which was more
accessible than usual due to not
containing any loops. Where mistakes
were made, this was typically to do with
either incorrect line numbers being given
for each change (this was penalised once
only and then subsequent mistakes with
line numbers followed through) or
additional incorrect output being given.
c i inputs a value from the user and 4 Answers using AND/OR for BP2 and BP3
stores/uses (AO3) must be logically correct e.g. if height
checks min value (>= 40.0 // < 40) >=40 and height <=180. Do not
checks max value (<=180.0 // > 180) accept if height >=40 and <=180
…outputs both valid / not valid
correctly based on checks Answers using OR will reverse output for
BP4 (see examples).
Example 1 (checking for valid input)
h = input("Enter height BP4 needs reasonable attempt at either
jumped") BP2 or BP3. Need to be sure what is
if h >= 40 and h <= 180 then being checked to be able to decide which
print("valid") way around valid/invalid should be.
else
Examiner’s Comments
ii Any normal value (between 40 and 3 No need to include decimals, e.g. accept
180 inclusive) (AO3) 50. Ignore cm if given.
40.0 // 180.0
Any value less then 40 // any value Answer must be actual data (e.g. 50) and
greater that 180 // any non-numeric not description of data (e.g. "a value
value between 40 and 180"). If descriptions
given, do not accept this as non-numeric
for BP3
Examiner’s Comments
ii any example of breaking down the 1 Must be applicable to this program, not a
program into sections/subroutines (AO3) generic description of what decomposition
any example of breaking down the is. Give BOD where this is unclear.
database into tables
Do not give answers discussing splitting
Examples : into fields (e.g. split into StudentID,
- “splits the program up into different YearGroup, etc).
events”
- “separates the validation routines into BOD if answer discusses one table but
subroutines” suggests other tables could be used.
Examiner’s Comments
f Input team name AND score and store 6 For BP3, allow "stop" to be entered for
/ use separately (AO3) either team name or score (or both). Allow
Attempt at using iteration… third input (e.g. "do you wish to stop?")
…to enter team/score until "stop"
entered Allow use of break (or equivalent) to exit
Calculates highest score loop for BP3.
Calculates winning team name…
…Outputs highest score and team Allow use of recursive function(s) for
name BP2/3.
Exemplar 3
Total 30