0% found this document useful (0 votes)
27 views11 pages

CS Year 10 Practical June 2022

The document describes a computer science exam with multiple programming questions. Students are asked to identify logic operators, describe differences between arrays, correct errors in code samples, add comments to code, write programs to implement flowcharts and generate product codes, and explain advantages of binary search.

Uploaded by

bondej642
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views11 pages

CS Year 10 Practical June 2022

The document describes a computer science exam with multiple programming questions. Students are asked to identify logic operators, describe differences between arrays, correct errors in code samples, add comments to code, write programs to implement flowcharts and generate product codes, and explain advantages of binary search.

Uploaded by

bondej642
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

COLOMBO INTERNATIONAL SCHOOL KANDY

SENIOR SECTION

Year 10

Computer Science - Practical


End of 3rd Term Examination – June 2022
1 and half hours

Name : …………………………………………………………………………………

Class : ………………………………………….………………………………………

Total marks : ………... / 75


Instructions:

1. The total mark for this paper is 80.

2. The marks for each question are shown in brackets – use this as a guide as to how much time to spend on
each question.

3. Attempt all questions.

4. Type your answers in the Question paper itself.

5. Save your work regularly.

6. Workings should be shown for conversions and calculations.

0
1 Computer programs make use of many programming constructs.

(a) Identify which one of these is a logic operator.


(1)

A modulus

B OR

C >=

D =
(b) Describe one difference between a one-dimensional array and a two-dimensional array.
(2)
....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

(c) Open Q01c in the code editor.

The program should calculate how many £20 are in £113 and how much is
left over.

There are three errors in the code.

Amend the code to correct the errors.


Save your amended code as Q01cFINISHED with the correct file extension for the
programming language.
(4)
(d) Jack has written a program that counts the number of vowels in a sentence.

Open Q01d in the code editor.


Amend the code by adding a suitable comment (you may need to add more than
one comment to a line):

1
(i) at the end of the line where there is a relational operator
(2)

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


(2)

(iii) at the end of the line where selection starts


(2)

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


(2)
Save your amended code as Q01dFINISHED with the correct file extension for the
programming language.

(Total for Question 1 = 15 marks)

2
3
Write a program to implement the logic in the flowchart. (11)

Open Q02a in the code editor.

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.

(b) The club sells books.


It needs a computer program to monitor:

• the number of books sold


• the amount of profit made.

Q02b provides a structure for the program.

Open Q02b in the code editor.


Amend the code to complete the If statement used to produce the outputs described in the
table.

Condition Output message

Number of books sold is at least 5 and Sales and profit are good this week
profit made is at least 10

Number of books sold is over 20 and profit Sales and profit are excellent this week
made is at least 20
Number of books sold is under 5 or profit Poor performance this week
made is under 5

All other inputs Alert manager


Do not add any further functionality.

Save your code as Q02bFINISHED with the correct file extension for the programming language.
(9)

(Total for Question 2= 20 marks)

4
3 Bill sells snacks at an after-school club.

(a) He wants a program that will hold details of the products he sells.
The program must:

• generate a five-character product code that:

– starts with the first three letters of the product name


– ends with a random number between 10 and 30

• display the product code followed by the product name.

Open Q03a in the code editor.

Write the program.

You must use the structure given in the file Q03a to complete the program.

Do not add any further functionality.


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

(10)

(b) Bill plans to implement a binary search algorithm to search a table of products.

(i) Explain one advantage of a binary search compared to a linear search.


(2)
....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

5
6
(iii) Bill has another list containing the names of five students who attend the after-school club.
Give the maximum number of names that would need to be examined by the binary
search algorithm to determine whether a name appears in the list.
(2)
....................................................................................................................................................................................................................................................................................

………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

(iv) Give the name of another algorithm that could be used to sort a list.
(2)
.........................................................................................................................................................................................................................................................................................................................................................

(Total for Question 3 = 20 marks)

7
4 Estelle is learning about sorting and searching algorithms.

(a) 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.

11 RECEIVE item FROM (INTEGER) KEYBOARD


12 WHILE start <= end AND NOT found DO
13 SET middle TO (start + end) DIV 2 14 IF numberList[middle] = item
THEN
15 SET found TO TRUE
16 ELSE
17 IF item < numberList[middle] THEN
18 end = middle – 1
19 ELSE
20 start = middle + 1
21 END IF
22 END IF
23 SET count TO count + 1
24 END WHILE

Open file Q04a in the code editor.

Amend the code to complete the program.

You must use the structure given in Q04a to write the program.

Do not add any further functionality.

Save your code as Q04aFINISHED with the correct file extension for the
programming language.
(10)

8
(b) Figure 3 shows an array of names.

0 1 2 3 4 5 6 7

Yoshitha Julian George Elisa Christine Samantha Melanie Shawn


Figure 3

Explain why a binary search algorithm would not find 'Julian' in the array.
(5)
....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

....................................................................................................................................................................................................................................................................................

9
(c) A merge sort algorithm can be used to sort a list ascending order. (5)

The list 38, 27, 43, 3, 9, 82, 10 needs to be sorted.


Complete the merge sort using the space provided.

38, 27, 43, 3, 9, 82, 10

(Total for Question 4 = 20 marks)

END OF PAPER

10

You might also like