Professional Documents
Culture Documents
9210 1 QP InternationalComputerScience G 26may23 07 00 GMT
9210 1 QP InternationalComputerScience G 26may23 07 00 GMT
9210 1 QP InternationalComputerScience G 26may23 07 00 GMT
COMPUTER SCIENCE
Paper 1 Programming
Information
• The marks for questions are shown in brackets.
• The maximum mark for this paper is 80.
• No extra time is allowed for printing and collating.
• The question paper is divided into three sections.
• You may use a bilingual dictionary.
• You must not use an English dictionary.
• You are not allowed to use a calculator.
Instructions
• Type the information required on the front of your Electronic Answer Document.
• Answer all questions.
• Enter your answers into the Electronic Answer Document.
• Before the start of the examination make sure your centre number, candidate name and
candidate number are shown clearly in the footer of every page of your
Electronic Answer Document (not the front cover).
• Include the evidence required for your answers to Sections B and C in your
Electronic Answer Document.
• You must save your Electronic Answer Document at regular intervals.
• The questions in Sections B and C require you to make changes to the Skeleton Program.
• All of the programming questions in Sections B and C can be answered independently of each
other. If you cannot answer one of the questions you can still attempt to solve later questions.
• You are advised to keep a backup copy of the original Skeleton Program so that you can go back
to it if you accidentally make changes to the program which means it can no longer be
compiled/executed while answering the questions in Sections B and C.
Secure all your printed Electronic Answer Document pages together and hand them to the
invigilator.
IB/M/Jun23/E5 9210/1
2
The questions in this section are about programming and how the Skeleton Program works.
Do not make any changes to the Skeleton Program when answering these questions.
0 1 . 1 Name a user-defined subroutine in the Skeleton Program that returns a value which
has a data type of real.
[1 mark]
0 1 . 2 Name the two data structures that are used as records in the Skeleton Program.
[2 marks]
IB/M/Jun23/9210/1
3
Turn over ►
IB/M/Jun23/9210/1
4
0 3 . 1 Assuming that N = 11, how many times will the condition in the IF statement be
checked when the SortByDistance subroutine in the Skeleton Program is
called?
[1 mark]
The bubble sort algorithm currently used in the Skeleton Program is not as efficient
as it could be. A more efficient bubble sort algorithm is shown, using pseudocode, in
Figure 1.
Figure 1
N LEN(ActivityLog)
Swapped True
WHILE Swapped = True
Swapped False
FOR Index 0 TO N – 2
IF ActivityLog[Index].Distance < ActivityLog[Index + 1].Distance THEN
Temp ActivityLog[Index]
ActivityLog[Index] ActivityLog[Index + 1]
ActivityLog[Index + 1] Temp
Swapped True
ENDIF
ENDFOR
N N – 1
ENDWHILE
0 3 . 2 Explain why the pseudocode version of the bubble sort algorithm shown in Figure 1 is
more efficient than the bubble sort currently used in the SortByDistance
subroutine in the Skeleton Program.
[4 marks]
Figure 2 shows a version of the pseudocode in Figure 1 which does not use the
Temp variable and so it will not work correctly.
Figure 2
N LEN(ActivityLog)
Swapped True
WHILE Swapped = True
Swapped False
FOR Index 0 TO N – 2
IF ActivityLog[Index].Distance < ActivityLog[Index + 1].Distance THEN
ActivityLog[Index] ActivityLog[Index + 1]
ActivityLog[Index + 1] ActivityLog[Index]
Swapped True
ENDIF
ENDFOR
N N – 1
ENDWHILE
IB/M/Jun23/9210/1
5
0 3 . 3 Explain why the use of the variable Temp in the pseudocode in Figure 1 allows items
in the ActivityLog to be swapped, whilst the operation does not work without
Temp in the pseudocode in Figure 2.
[2 marks]
0 3 . 4 What is the minimum number of times the condition in the IF statement will be
checked when the bubble sort algorithm in Figure 1 is carried out and the
ActivityLog contains 11 items?
[1 mark]
0 3 . 5 Explain under what circumstances the minimum number of checks of the condition in
the IF statement will occur when the bubble sort algorithm in Figure 1 is carried out
and the ActivityLog contains 11 items.
[2 marks]
0 4 . 1 Give two values from the test data listed above which would be suitable as boundary
test data.
[2 marks]
0 4 . 2 Give one value from the test data listed above which would be suitable as normal
test data.
[1 mark]
Turn over ►
IB/M/Jun23/9210/1
6
Change the subroutine DisplayMenu so that this message followed by a blank line
is displayed before the current message MAIN MENU.
Test your change has worked by running the Skeleton Program and then:
• enter D
IB/M/Jun23/9210/1
7
The error message Invalid Menu Option should be displayed each time the
user enters an invalid menu option. This should be displayed before the user enters
their menu option again.
Change the Main subroutine so that the error message is displayed. This should
happen whenever an invalid menu option is entered.
Test your change has worked by running the Skeleton Program and then:
• enter D
• then enter A
• then enter -1
Turn over ►
IB/M/Jun23/9210/1
8
0 7 The Skeleton Program is to be improved by adding a new menu option that allows
the individual person details to be changed.
Change the Main subroutine so that when this new menu option 6 is selected
Individual is updated by calling the EnterUserData subroutine with the
parameter Individual.
• enter D
• enter 6
0 7 . 1 All the PROGRAM SOURCE CODE in the subroutines DisplayMenu and Main.
[6 marks]
IB/M/Jun23/9210/1
9
• the first two digits of the inputted Time string are not above 23
• the last two digits of the inputted Time string are not above 59
• enter D
• enter 3
• then enter a day of week number of 2
• then enter a week number of 3
• then enter a time of 26:34
• then enter a time of 20:60
• then enter a time of 20:34
Turn over ►
IB/M/Jun23/9210/1
10
0 9 The Skeleton Program is to be improved by changing the calculation to work out how
many calories are burned when cycling.
• if the type of activity is cycling then the method described in Figure 3 should be
used to calculate the number of calories burned
• for all other activities the current calculation should still be used
• the new way of calculating calories burned for cycling must be used no matter what
case (upper, lower or mixed) is used to store the activity type. For example, the
activity type could be stored as cycling or CYCLING or Cycling or cYcling.
Figure 3
For females the calories burned while cycling are calculated as follows:
(Age × 0.10 – Weight × 0.07 + AverageHeartRate × 0.43 - 21) × Time ÷ 4
For males the calories burned while cycling are calculated as follows:
(Age × 0.19 + Weight × 0.10 + AverageHeartRate × 0.62 - 56) × Time ÷ 4
• enter D
• enter 2
• enter 4
• enter cycling
IB/M/Jun23/9210/1
11
1 0 The Skeleton Program is to be improved by adding a new subroutine that allows the
ActivityLog to be searched so that activities above a given distance that occurred
in a specific week are displayed.
Task One
Create a new subroutine called SearchActivity that:
Task Two
Change the DisplayMenu subroutine so that it displays an appropriate menu option
for the new search facility.
Task Three
Change the Main subroutine so that when the new menu option is selected the new
subroutine SearchActivity is called.
Task Four
Test your changes by running the Skeleton Program and then:
• enter D
• enter 2
• enter menu option for the new search facility
• enter a distance of 10
• enter a week number of 3
1 0 . 1 All the PROGRAM SOURCE CODE for the new subroutine SearchActivity.
[13 marks]
IB/M/Jun23/9210/1
12
Copyright information
For confidentiality purposes, all acknowledgements of third-party copyright material are published in a separate booklet. This booklet is published after
each live examination series and is available for free download from www.oxfordaqaexams.org.uk
Permission to reproduce all copyright material has been applied for. In some cases, efforts to contact copyright-holders may have been unsuccessful and
Oxford International AQA Examinations will be happy to rectify any omissions of acknowledgements. If you have any queries please contact the Copyright
Team.
Copyright © 2023 Oxford International AQA Examinations and its licensors. All rights reserved.
*236Y9210/1*
IB/M/Jun23/9210/1