Computer Science: Paper 1 - Computational Thinking and Programming Skills
Computer Science: Paper 1 - Computational Thinking and Programming Skills
Surname
Forename(s)
Candidate signature
GCSE
COMPUTER SCIENCE
Paper 1 - Computational thinking and programming skills
Instructions
• Use black ink or black ball-point pen. Use pencil only for drawing.
• Answer all questions.
• You must answer the questions in the spaces provided.
• Do all rough work in this book.
• Cross through any work you do not want to be marked.
• Questions that require a coded solution must be answered in C#
Information
• The total number of marks available for this paper is 90.
Advice
For the multiple-choice questions, completely fill in the lozenge alongside the appropriate answer.
CORRECT METHOD WRONG METHODS
If you want to change your answer you must cross out your original answer as shown.
If you wish to return to an answer previously crossed out, ring the answer you now wish to select as
shown.
8525A/1
2
Do not write
outside the
box
Answer all questions.
A assignment
B data type
C decomposition
D efficiency
E input
For each of the definitions in the table, write the label of the most suitable
computer science term. Use a label only once.
[3 marks]
Label
Figure 1
0 2 . 1 Shade one lozenge that shows the length of the contents of the variable level in
Figure 1.
[1 mark]
A 1
B 2
C 3
D 4
0 2 . 2 Shade one lozenge that shows the result of concatenating the variable title
with the variable level in Figure 1.
[1 mark]
C 'computersciencegcse'
D 'computer sciencegcse'
Turnover
Turn over►►
4
Do not write
outside the
box
0 3 The algorithm in Figure 2 has been developed to automate the quantity of dog
biscuits to put in a dog bowl at certain times of the day.
• Line numbers are included but are not part of the algorithm.
Figure 2
1 time USERINPUT
2 IF time = 'breakfast' THEN
3 q 1
4 ELSE IF time = 'lunch' THEN
5 q 4
6 ELSE IF time = 'dinner' THEN
7 q 2
8 ELSE
9 OUTPUT 'time not recognised'
10 ENDIF
11 FOR n 1 TO q
12 IF n < 3 THEN
13 DISPENSE_BISCUIT('chewies')
14 ELSE
15 DISPENSE_BISCUIT('crunchy')
16 ENDIF
17 ENDFOR
0 3 . 1 Shade one lozenge which shows the line number where selection is first used in
the algorithm shown in Figure 2.
[1 mark]
A Line number 2
B Line number 4
C Line number 9
D Line number 12
0 3 . 2 Shade one lozenge which shows the line number where iteration is first used in
the algorithm shown in Figure 2.
[1 mark]
A Line number 1
B Line number 8
C Line number 11
D Line number 13
5
Do not write
outside the
box
0 3 . 3 Shade one lozenge which shows how many times the subroutine
DISPENSE_BISCUIT would be called if the user input is 'breakfast' in
Figure 2.
[1 mark]
A 1 subroutine call
B 2 subroutine calls
C 3 subroutine calls
D 4 subroutine calls
0 3 . 4 Shade one lozenge which shows the data type of the variable time in the
algorithm shown in Figure 2.
[1 mark]
A Date/Time
B String
C Integer
D Real
Turnover
Turn over►►
6
Do not write
outside the
box
0 4 A programmer has written a C# program that asks the user to input two
integers and then output which of the two integers is the largest.
Complete the program by filling in the gaps using the information in Figure 3.
Each item in Figure 3 should only be used once.
[5 marks]
Figure 3
int num1;
num2;
num1 = int.Parse(Console.ReadLine());
num2 = int.Parse(Console.ReadLine());
Console.WriteLine(" is bigger.");
else
if (num1 num2)
Console.WriteLine(" is bigger.");
}
7
Do not write
outside the
box
0 5 Write a C# program that allows a taxi company to calculate how much a taxi
fare should be.
You should use meaningful variable name(s), correct syntax and indentation
in your answer.
The answer grid below contains vertical lines to help you indent your code
accurately.
[7 marks]
Turnover
Turn over►►
8
Do not write
outside the
box
9
Do not write
outside the
box
0 6 Write a C# program that inputs a password and checks if it is correct.
You should use meaningful variable name(s), correct syntax and indentation in your
answer.
The answer grid below contains vertical lines to help you indent your code
accurately.
[5 marks]
Turnover
Turn over►►
10
Do not write
outside the
box
11
Do not write
outside the
box
0 7 The algorithm in Figure 4 is a sorting algorithm.
Figure 4
1 arr [4, 1, 6]
2 swapsMade false
3 WHILE swapsMade = false
4 swapsMade true
5 i 0
6 WHILE i < 2
7 IF arr[i+1] < arr[i] THEN
8 t arr[i]
9 arr[i] arr[i+1]
10 arr[i+1] t
11 swapsMade false
12 ENDIF
13 i i + 1
14 ENDWHILE
15 ENDWHILE
0 7 . 1 State the data type of the variable swapsMade in the algorithm shown in
Figure 4.
[1 mark]
Turnover
Turn over►►
12
Do not write
outside the
box
0 7 . 3 Shade one lozenge to show which of the following contains the false statement
about the algorithm in Figure 4.
[1 mark]
0 7 . 4 Complete the trace table for the algorithm shown in Figure 4. Some values
have already been entered.
[6 marks]
arr
swapsMade i t
[0] [1] [2]
4 1 6 false
13
Do not write
outside the
0 8 Write a C# program that inputs a character and checks to see if it is lowercase box
or not.
You should use meaningful variable name(s), correct syntax and indentation in
your answer.
The answer grid below contains vertical lines to help you indent your code
accurately.
[7 marks]
Turnover
Turn over►►
14
Do not write
outside the
box
0 9 Four separate subroutines have been written to control a robot.
0 9 . 1 Draw the path of the robot through the grid below if the following program is
executed (the robot starts in the square marked by the ↑ facing in the direction of
the arrow).
Forward(2)
TurnLeft()
Forward(1)
TurnRight()
Forward(1)
[3 marks]
↑
15
Do not write
outside the
box
0 9 . 2 Draw the path of the robot through the grid below if the following program is
executed (the robot starts in the square marked by the ↑ facing in the direction of
the arrow). If a square is black then it contains an object.
Turnover
Turn over►►
16
Do not write
outside the
box
1 0 State two benefits of developing solutions using the structured approach.
[2 marks]
1 1 Fill in the blank arrays to show the steps involved in applying the bubble sort
algorithm to the array [3, 5, 1, 4, 2]. You only need to show the
missing steps where a change is applied to the array.
[5 marks]
3 5 1 4 2
1 2 3 4 5
17
Do not write
outside the
box
“Many of my friends ask me to walk their dogs for them. All of these friends
pay me to do this and the amount I get paid depends on how long I walk their
dogs for. If they have more than one dog then I don’t charge the owner any
extra. I like to walk the dogs in the afternoon when the weather is normally best
because I often get colds. I need you to help me keep track of how much I’m
owed – fortunately for me all of my friends have different first names so it is
really easy to tell them apart. I charge £10 for every 30 minutes of the walk
(and I always round this up so 47 minutes would be two half-hour charges or
£20).
1 2 . 1 The developer needs to remove all of the unnecessary detail from the client’s
request. Shade the lozenge next to the name for this process.
[1 mark]
A Abstraction
B Conversion
C Decomposition
D Validation
1 2 . 2 The developer has decided that the following two points are the only important
details from the client’s request.
• The charge is based on time and not how many dogs are walked.
• The charge is £10 every 30 minutes.
State two other relevant details that the developer has missed.
[2 marks]
Turnover
Turn over►►
18
Do not write
outside the
box
1 3 The following subroutines control the way that labelled blocks are placed in
different columns.
Draw the final arrangement of the blocks after the following algorithm has run.
MOVE(0, 1)
MOVE(0, 2)
MOVE(0, 2)
[3 marks]
19
Do not write
outside the
box
Draw the final arrangement of the blocks after the following algorithm has run.
[3 marks]
Turnover
Turn over►►
20
Do not write
outside the
box
1 3 . 3 Develop an algorithm using either pseudo-code or a flowchart that will move
every block from column 0 to column 1.
Your algorithm should work however many blocks start in column 0. You
may assume there will always be at least one block in column 0 at the start
and that the other columns are empty.
The MOVE subroutine must be used to move a block from one column to
another. You should also use the HEIGHT subroutine in your answer.
[4 marks]
21
Do not write
outside the
box
Turnover
Turn over►►
22
Do not write
outside the
1 4 A programmer has written the C# program in Figure 5 to add up the numbers box
between one and five.
Figure 5
int total = 0;
for (int number = 1; number < 6; number++)
{
total = total + number;
}
Console.WriteLine(total);
The program needs to be changed so that it also multiplies all of the numbers
between one and five.
Shade one lozenge next to the program that will do what the programmer
wants.
[1 mark]
int total = 0;
int product = 1;
for (int number = 1; number < 6; number++)
{
A total = total + number;
product = total * number;
}
Console.WriteLine(total);
Console.WriteLine(product);
int total = 0;
int product = 1;
for (int number = 1; number < 6; number++)
{
B total = total + number;
product = product * number;
}
Console.WriteLine(total);
Console.WriteLine(product);
int total = 0;
int product = 1;
for (int number = 1; number < 6; number++)
{
C total = total + number;
product = product * total;
}
Console.WriteLine(total);
Console.WriteLine(product);
int total = 0;
int product = 1;
for (int number = 1; number < 6; number++)
{
D total = total + number;
product = (total + product) * number;
}
Console.WriteLine(total);
Console.WriteLine(product);
23
Do not write
outside the
box
1 5 A program has been written in C# to display all the odd integers between 1 and the
largest odd number smaller than an integer entered by the user. The program is
shown in Figure 6.
Figure 6
int odd = 1;
int number;
Console.Write("Enter an integer: ");
number = Convert.ToInt32(Console.ReadLine());
while (odd != Number)
{
Console.WriteLine(odd);
odd = odd + 2;
}
Console.WriteLine("Finished!");
The program works correctly if the integer entered by the user is an odd, positive
integer. For example, if 7 is entered the program correctly displays the values 1, 3
and 5
The program does not work correctly if an odd integer less than 1 is entered by the
user. For example, when -7 is entered the program should display the values 1, -1,
-3 and -5 but it doesn’t do this.
Using C# only, change the program code inside the while loop so that it will work
correctly for any odd integer entered by the user.
[4 marks]
Turnover
Turn over►►
24
Do not write
outside the
box
25
Do not write
outside the
box
1 6 Figure 7 shows part of a program written in C#.
Figure 7
bool validChoice;
int choice;
validChoice = false;
while (validChoice == false)
{
Console.Write("Enter your choice [1 - 10] ");
choice = int.Parse(Console.ReadLine());
if (choice >= 1 & choice <= 10)
{
validChoice = true;
}
else
{
Console.WriteLine("Invalid choice");
}
}
Console.WriteLine("Valid choice");
Complete the following test plan for the code shown in Figure 7.
Test
Test data Expected result
type
Normal
5 Valid choice message displayed
data
Invalid
data
Boundary
data
[2 marks]
Turnover
Turn over►►
26
Do not write
outside the
box
1 7 Figure 8 shows a C# program that is being developed.
It is supposed to calculate and display the highest common factor of two numbers
entered by the user.
The highest common factor of two numbers is the largest number that both numbers
can be divided by without leaving a remainder.
Examples:
Line numbers are shown but are not part of the program code.
Figure 8
The highest common factor of two numbers is the largest number that both numbers
can be divided by without leaving a remainder.
Examples:
The program in Figure 8 works correctly sometimes but not always. When the user
enters the numbers 4 and 6 it correctly outputs 2, but when the user enters the numbers
4 and 4 it should output 4 but it does not.
27
Do not write
outside the
box
1 7 . 1 State the output from the program in Figure 8 when the user enters the numbers 4
and 4
[1 mark]
1 7 . 2 State the line number from the program in Figure 8 which contains the error that
stops the program from sometimes working correctly.
[1 mark]
1 7 . 3 Describe how the line of code identified in your answer to 17.2 should be changed so
that the program in Figure 8 will work correctly.
[1 mark]
Turnover
Turn over►►
28
Do not write
outside the
box
1 8 Write a C# program that calculates an estimate of the braking distance in metres for
a new model of go-kart that is travelling between 10 and 50 kilometres per hour
(kph).
• keep asking the user to enter a speed for the go-kart until they enter a speed
that is between 10 and 50 (inclusive)
• calculate the braking distance in metres by dividing the speed by 5
• ask the user if the ground is wet (expect the user to enter yes if it is)
• if the ground is wet, multiply the braking distance by 1.5
• output the final calculated braking distance.
You should use meaningful variable name(s), correct syntax and indentation in your
answer.
The answer grid below contains vertical lines to help you indent you code
accurately.
[8 marks]
29
Do not write
outside the
box
END OF QUESTIONS
Turnover
Turn over►►
30
Do not write
outside the
box
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.aqa.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
AQA will be happy to rectify any omissions of acknowledgements. If you have any queries please contact the Copyright Team.