Marking Scheme Cs GR 10 11 Mockexam Paper2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

ST.

MARY’S CATHOLIC HIGH SCHOOL FUJAIRAH


MOCK EXAMINATION –MARCH/APRIL 2023

Page 1 of 21
1. a) Which of the following is an example of a Python string? (1)

☐ A. "Hello"
☐ B. 3.14

☐ C. True
☐ D. 42
Answer :A

b) Computer programs make use of many programming constructs.


Identify which one of these is an assignment operator. (1)
☐ A. modulus
☐ B. OR

☐ C. >=
☐ D. =
Answer:D

c) Describe one difference between a one-dimensional array and a two-dimensional array.


(2)

Page 2 of 21
d) Open Q01d in the code editor.
The program should calculate the volume of a rectangular swimming pool with a depth of
two metres. The formula for calculating the volume is: volume = length x width x depth.
There are three errors in the code.
Amend the code to correct the errors.
Save your amended code as Q01dFINISHED with the correct file extension for
the programming language. (3)

e) Amna has written a program that display only odd numbers from the given array using for loop.
Open Q01e in the code editor.
Amend the code by adding a suitable comment (you may need to add more than one comment
to a line.
(i) at the end of the line where there is a relational operator (1)

(ii) at the end of a line where iteration starts (1)

Page 3 of 21
(iii) at the end of the line where selection starts (1)

(iv) at the end of a line where a data structure is initialised. (1)

Save your amended code as Q01eFINISHED with the correct file extension for the programming
language.

(Total for Question 1=11 marks)

2 a) Estelle is learning about sorting and searching algorithms.


Estelle’s friend has given her a partially completed program to carry out a binary search.
This pseudocode contains the logic required to complete the program.

Page 4 of 21
Open file Q02a in the code editor.
Amend the code to complete the program.
You must use the structure given in Q02a to write the program.
Do not add any further functionality.
Save your code as Q02aFINISHED with the correct file extension for the programming language.

Page 5 of 21
(10)

Page 6 of 21
b) A merge sort algorithm can be used to sort a list into ascending order.
The list 6,4,8,3,2,9,1,7 needs to be sorted.
Complete the merge sort using the space provided. (5)

6, 4 ,8 ,3, 2, 9,1, 7

1, 2, 3, 4, 6, 7, 8, 9

Page 7 of 21
2 (c) A super market has announced the following discounts on the purchase of items:

Amount Discounts

0-100 No discount

101-200 5%

201-300 10%

Above 300 20%

Open Q02(c) in the code editor


Write a python program that:

 Ask user to enter the amount.


 Calculate the discount
 Display the bill amount paid by customer. (6)

Page 8 of 21
(Total for Question 2=21 marks)

Page 9 of 21
3 a) Cerys Jones is the manager of a shop that sells electrical goods.
She is creating a stock control program.
Each item of stock will have a ten-character code.
Each code consists of three parts.

WAS123456o, FDG232324e and VAC129222e are valid codes.


All codes need to be validated.
Complete the table to show two additional validation tests.
For each test, give one example of erroneous data.
The example that you give should fail only that test. (4)

Page 10 of 21
b) Cerys will use functions and procedures in her program.
(i) One similarity between a function and a procedure is that they are both subprograms.
State two other similarities. (2)

c) Encryption is used to encode data.


(a) Identify the word that describes a Pigpen cipher. (1)

Page 11 of 21
(d) Figure 1 shows a Pigpen cipher grid. (3)

e) Figure 2 shows another grid.

Page 12 of 21
Page 13 of 21
(Total for Question 3=13 marks)

4)A program is needed to track the number and health scores of native British trees.
The tree data is stored as structured data. These are implemented as three lists.
The program needs to be amended to meet these requirements:
• construct a record for each type of tree consisting of fields for name, number and
health score
• use commas to separate fields
• write each record to a separate line in an output file.

Page 14 of 21
This is what your final output file should look like.
There are exactly 7 lines in the output file.

Open file Q04 in the code editor


Amend the code to:
• process the lists to generate the output file.
Do not add any additional functionality.
Use comments, white space and layout to make the program easier to read
and understand.
Save your amended code file as Q04FINISHED (7)

Page 15 of 21
(Total for Question 4=7 marks)

5) A circle is cut out of a square of card. A program is needed to calculate the area of the excess
card. The image shows the excess card in light grey.

Page 16 of 21
The required formulae are:
area of a square = s2
diameter of a circle = 2r
area of a circle = πr 2
• s is the length of a single side of the square
• r is the radius of the circle, the distance from the centre to
the edge
• π is the constant Pi. (π=3.14)
The table shows accurate test results for two sets of inputs.

The program has these requirements:


• the length of the square’s side is an integer
• the radius of the circle is an integer
• the user inputs both the length of a side and the radius
(no validation required)
• the diameter of the circle must be the same size or smaller than the side
of the square
• the variables supplied in the code file must be used
Open file Q05 in the code editor
Amend the code to meet the requirements.
Do not change the functionality of the given lines of code.
Do not add any additional functionality.
Save your amended code file as Q05FINISHED. (8)

Page 17 of 21
Page 18 of 21
(Total for Question 5=8 marks)
6) In a board game, users build words from letter tiles. Each letter tile has a points value.
There are 107 valid two-letter words.
A program is required to check that each two-letter word placed on the board is valid.
Each valid two-letter word with its points value is stored as a record in the
two-dimensional list, wordTable. The records are stored in alphabetical order.
Open file Q06
Write a program to meet these requirements:

Inputs

Page 19 of 21
• prompt for and accept a two-letter word from the user, AA to ZZ, inclusive
• accept uppercase and lowercase input
• no other validation is required.
Process
• create a linear search to locate the word in wordTable
• stop the search when:
• the word is located
• the expected location of the user’s word is passed
• the end of the list is reached after all words have been checked
• ensure the search works for any length of wordTable
Outputs
• when the user’s word is located, inform the user of the word and the number of points
it scores
• when the expected location of the user’s word is passed, suggest the next
word and the number of points it scores
• when the end of the list is reached after all words have been checked,
suggest the last word in the list and the number of points it scores.
Use comments, white space and layout to make the program easier to read and understand.
Do not add any additional functionality.
Save your amended code as Q06FINISHED. (20)

Page 20 of 21
(Total for Question 6=20 marks)
END OF THE QUESTION PAPER

Page 21 of 21

You might also like