INTERNATIONAL GCSE
COMPUTER SCIENCE
Paper 1 Programming
Friday 31 May 2019 07:00 GMT Time allowed: 2 hours
Materials
For this paper you must have access to:
• a computer
• a printer
• appropriate software
• an electronic version of the Skeleton Program
• a hard copy of the Skeleton Program.
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/Jun19/E6 9210/1
2
Section A (Non-programming questions)
You are advised to spend no more than 30 minutes on this section.
Type your answers to Section A in your Electronic Answer Document.
You must save your Electronic Answer Document at regular intervals.
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 State the names of two variables in the Skeleton Program that are used to store
Boolean values.
[2 marks]
0 1 . 2 State the name of a subroutine in the Skeleton Program that returns a value which
has a data type of string.
[1 mark]
0 1 . 3 Explain why subroutines often use parameters.
[2 marks]
0 1 . 4 Describe the data structure that has been used for the variable Deck.
[2 marks]
0 1 . 5 The DecideWinnerOfRound subroutine uses a selection structure to work out
which player has won the current round.
Figure 1 shows a pseudocode version of the third selection statement in
DecideWinnerOfRound.
Figure 1
ELSE IF PlayerOneSuit = Tops THEN
RETURN True
Explain what must have happened in the round if the condition in the third selection
statement in DecideWinnerOfRound is executed and evaluates to True.
[2 marks]
IB/M/Jun19/9210/1
3
0 1 . 6 Figure 2 shows a pseudocode version of the ShuffleDeck subroutine which does
not use the Temp variable and so will not work correctly.
Figure 2
SUBROUTINE ShuffleDeck(Deck)
FOR Count 0 TO 99
Pos1 RANDOM_INT(0, LEN(Deck) - 1)
Pos2 RANDOM_INT(0, LEN(Deck) – 1)
Deck[Pos2] Deck[Pos1]
Deck[Pos1] Deck[Pos2]
ENDFOR
RETURN Deck
ENDSUBROUTINE
Explain why the use of the variable Temp in the subroutine ShuffleDeck in the
Skeleton Program makes the shuffle operation work, whilst the operation does not
work without Temp in the pseudocode version in Figure 2.
[2 marks]
0 1 . 7 The iterative structure (WHILE loop) in the GetNumberOfCardsInHand
subroutine makes sure that the value of CardsInHand is less than 14. The
maximum value allowed for CardsInHand can be altered by changing the condition
of this iterative structure.
Explain why the maximum value can be changed to 26 but should not be changed to
27
[2 marks]
Turn over for the next question
Turn over ►
IB/M/Jun19/9210/1
4
0 2 Figure 3 is an incomplete flowchart that shows how part of the PlayGame subroutine
works. Some of the symbols have been labelled with the letters A-E.
Figure 3
0 2 . 1 What should be written in the symbol that has been labelled with the letter A in
Figure 3?
[1 mark]
0 2 . 2 What should be written in the symbol that has been labelled with the letter B in
Figure 3?
[1 mark]
0 2 . 3 What should be written in the symbol that has been labelled with the letter D in
Figure 3?
[1 mark]
0 2 . 4 What should be written in the symbol that has been labelled with the letter E in
Figure 3?
[1 mark]
IB/M/Jun19/9210/1
5
0 3 The Main and PlayGame subroutines each use one iteration structure.
0 3 . 1 A WHILE loop has been used to achieve indefinite iteration in the Main subroutine.
Explain why a WHILE loop has been used instead of a FOR loop.
[2 marks]
0 3 . 2 The WHILE loop in the PlayGame subroutine has a condition that controls whether
the loop will repeat or not. Some of the conditions described in Table 1 could have
been used instead of the one used in the Skeleton Program and would have kept the
same functionality.
Write Yes or No in each row of Table 1 to indicate if the stated condition would keep
the same functionality as the condition in the Skeleton Program or not.
The first row has been completed for you.
Copy the contents of all the blank cells in Table 1 into your Electronic Answer
Document.
[3 marks]
Table 1
Condition Same functionality
(Yes/No)?
CardsInHand is less than 0 No
PlayerOneWins is False
CardsInHand does not equal 0
Size of PlayerOneHand is greater than 0
Sum of PlayerOneRoundsWon and
PlayerTwoRoundsWon is equal to value of
CardsInHand
Turn over for the next question
Turn over ►
IB/M/Jun19/9210/1
6
Section B (Short programming questions)
You are advised to spend no more than 45 minutes on this section.
0 4 The Skeleton Program is to be improved so that it displays an error message each
time the user enters an invalid number of cards when asked how many cards there
will be in each player’s hand.
The error message Invalid - please try again should be displayed with a
blank line between it and the previous message each time the user enters an invalid
number. This should be displayed before the user re-enters a number.
Change the GetNumberOfCardsInHand subroutine so that the error message is
displayed, with a blank line between this message and the previous message,
whenever an invalid number of cards is entered.
Test your change has worked by running the Skeleton Program and then:
• enter the number 15
• then enter the number 1
• then enter the number 3
Evidence that you need to provide
Include the following in your Electronic Answer Document.
0 4 . 1 Your PROGRAM SOURCE CODE for the subroutine
GetNumberOfCardsInHand.
[3 marks]
0 4 . 2 SCREEN CAPTURE(S) to show the result of carrying out the test.
[1 mark]
IB/M/Jun19/9210/1
7
0 5 The Skeleton Program is to be improved so that when displaying the cards in a
player’s hand it displays a more detailed name for some of the cards.
If the card has a suit of T then the word triangles should be displayed
instead of T.
Example
If Player One’s hand contains the cards 3T, 3S and NT this hand is currently
displayed as:
3 of T
3 of S
N of T
In the improved version of the Skeleton Program the same hand would be
displayed as:
3 of triangles
3 of S
N of triangles
Change the DisplayHand subroutine so that the word triangles is displayed for
cards that have a value of T for the suit.
Test your changes have worked by running the Skeleton Program and:
• type the number 13 and then press the Enter key
• then press the Enter key again.
If there are no cards with a suit of T then you should repeat the test until there are.
Evidence that you need to provide
Include the following in your Electronic Answer Document.
0 5 . 1 Your PROGRAM SOURCE CODE for the subroutine DisplayHand.
[5 marks]
0 5 . 2 SCREEN CAPTURE(S) to show the result of carrying out the test.
[1 mark]
Turn over for the next question
Turn over ►
IB/M/Jun19/9210/1
8
0 6 The Skeleton Program is to be improved so that the suit used for tops can be
changed.
Change the Main subroutine so that the tops suit is entered by the user rather than
always being P. The line Tops = "P" needs to be replaced by code that requests
the value for the tops suit to be entered.
The user should be able to choose either suit P or C as tops. The entered value
should be checked to ensure it is either P or C; if it is not then an appropriate error
message should be displayed and the tops suit value should be requested and
entered again. This validation check should be repeated until P or C has been
entered.
Test your changes have worked by running the Skeleton Program and:
• start a game with 8 cards in the players’ hands
• then enter T
• then enter C.
Evidence that you need to provide
Include the following in your Electronic Answer Document.
0 6 . 1 Your PROGRAM SOURCE CODE for the amended subroutine Main.
[7 marks]
0 6 . 2 SCREEN CAPTURE(S) to show the result of carrying out the test.
[2 marks]
IB/M/Jun19/9210/1
9
0 7 The Skeleton Program is to be changed so that the points awarded for winning a
round depend on which cards are played.
Change the PlayGame subroutine so that three points are awarded when a round is
won if Player One wins with a card from the tops suit which has a rank of six or lower.
In all other situations a half point is still awarded for winning a round.
You do not need to make any changes to the way points are awarded if Player Two
wins the round.
Examples
If the P suit is tops and Player One wins the round using the P5 card then Player
One is awarded three points.
If the P suit is tops and Player One wins the round using the P7 card then Player
One is awarded a half point.
If the P suit is tops and Player One wins the round using the S5 card then Player
One is awarded a half point.
A message should be displayed after the points have been awarded stating how many
points have been scored in the round. The message displayed should be "3
points scored this round" or "A half point scored this
round" as appropriate.
Test your changes have worked by running the Skeleton Program and then:
• playing a game with 13 cards in the players’ hands
• if the Skeleton Program includes your answer to Question 06 then enter P when
asked to choose which suit is tops
• play cards for the two players so that Player One wins the round using a card with a
suit of P and a rank of 6 or lower.
If Player One has no cards with a suit of P with a rank of 6 or lower then you should
repeat the test until they do.
Evidence that you need to provide
Include the following in your Electronic Answer Document.
0 7 . 1 Your PROGRAM SOURCE CODE for the subroutine PlayGame.
[7 marks]
0 7 . 2 SCREEN CAPTURE(S) to show the result of carrying out the test.
[2 marks]
Turn over ►
IB/M/Jun19/9210/1
10
Section C (Longer programming questions)
You are advised to spend no more than 45 minutes on this section.
0 8 The points system used to decide the winner of the game is to be changed.
After being shown their hands and before the game starts, one of the players is
randomly chosen to predict how many rounds of the game they will win.
At the end of the game and before the result of the game is displayed the rounds
actually won by that player are compared to the prediction. If the prediction was
correct then one is added to their points total. If the prediction was not correct then
one is subtracted from their points total.
Task 1
Create a new subroutine called GetBonusPointRounds that:
• Randomly selects one of the two players. The probability of Player One being
selected should be the same as the probability of Player Two being selected.
• Asks the randomly-selected player to predict how many rounds they will win.
• Returns the prediction and information about which player made the prediction.
Task 2
Change the Main subroutine so that:
• After the hands have been displayed and before the game starts the
GetBonusPointRounds subroutine is called.
• After the game has finished but before the result is displayed it compares the
prediction with the actual number of rounds won by the player that made the
prediction and either adds or subtracts one from their points total as appropriate.
Task 3
Test your changes have worked by running the Skeleton Program and playing a
game where each player has three cards in their hand and the randomly-selected
player predicted they would win one round. It does not matter how many rounds the
player actually wins. The points totals for each player should be shown.
Evidence that you need to provide
Include the following in your Electronic Answer Document.
0 8 . 1 Your PROGRAM SOURCE CODE for the new subroutine
GetBonusPointRounds.
[8 marks]
0 8 . 2 Your PROGRAM SOURCE CODE for the subroutine Main.
[5 marks]
0 8 . 3 SCREEN CAPTURE(S) for the test described.
[2 marks]
IB/M/Jun19/9210/1
11
There are no questions printed on this page
Turn over for the next question
Turn over ►
IB/M/Jun19/9210/1
12
0 9 This question extends the game by allowing Player Two to replace a card in their
hand with a new card from the deck. Player Two can choose to replace the card at
either the front or the back of their hand. Figure 4 shows an example of Player Two’s
hand containing 8 cards.
Figure 4
Index 0 1 2 3 4 5 6 7
Card T8 PK T10 S5 S9 C6 P3 P7
Front Back
What you need to do
Task 1
Create a new subroutine called ReplaceCard that:
• has the parameters Deck and PlayerTwoHand
• displays a message to enter F to replace the card at the front or B to replace the
card at the back of Player Two’s hand and allows this value to be input and
stored (there is no need to validate this input)
• replaces the card from the chosen position in Player Two’s hand with the card
from the front of the deck
• calls the subroutine DisplayHand to display Player Two’s new hand
• returns Player Two’s changed hand
Task 2
Add code that calls the subroutine ReplaceCard to the end of
DisplayHandsAtStartOfGame subroutine so that Player Two is given the
option of replacing a card at either the front or the back of their hand.
Task 3
Test your changes have worked by running the Skeleton Program and then:
`
• start a game with 8 cards in the players’ hands
• if the Skeleton Program includes your answer to Question 06 then enter P when
asked to choose which suit is tops
• press the Enter key
• press the Enter key
• press the Enter key
• press the Enter key
• enter B to replace a card at the back of Player Two’s hand.
Evidence that you need to provide
Include the following in your Electronic Answer Document.
IB/M/Jun19/9210/1
13
0 9 . 1 Your PROGRAM SOURCE CODE for the new subroutine ReplaceCard.
[11 marks]
0 9 . 2 Your PROGRAM SOURCE CODE for the subroutine
DisplayHandsAtStartOfGame.
[2 marks]
0 9 . 3 SCREEN CAPTURE(S) for the test described. The SCREEN CAPTURE(S) should
include the hand for Player Two before and after the card has been replaced.
[2 marks]
END OF QUESTIONS
IB/M/Jun19/9210/1
14
There are no questions printed on this page
IB/M/Jun19/9210/1
15
There are no questions printed on this page
IB/M/Jun19/9210/1
16
There are no questions printed on this page
Copyright information
For confidentiality purposes, acknowledgements of third party copyright material will be published in a separate booklet rather than including them on the
examination paper or support materials. This booklet is published after each examination series and is available for free download from
[Link] after the live examination series.
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, AQA, Stag Hill House, Guildford, GU2 7XJ.
Copyright © 2019 Oxford International AQA Examinations and its licensors. All rights reserved.
*196y9210/1*
IB/M/Jun19/9210/1