Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views16 pages

Semester2 G9 CS Paper2 AnsKey

This document is an answer key for a Computer Science examination for Grade 9, covering topics such as algorithms, programming, and logic. It includes instructions for answering questions, a breakdown of marks, and sample answers for various questions related to programming concepts, logic circuits, and database management. The document serves as a guide for evaluating student responses in the examination.

Uploaded by

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

Semester2 G9 CS Paper2 AnsKey

This document is an answer key for a Computer Science examination for Grade 9, covering topics such as algorithms, programming, and logic. It includes instructions for answering questions, a breakdown of marks, and sample answers for various questions related to programming concepts, logic circuits, and database management. The document serves as a guide for evaluating student responses in the examination.

Uploaded by

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

ANSWER KEY

Details

Academic Year 2024-25 Date March 03, 2025

Name of student Grade 9


Name of
Semester 2
examination
Subject Computer Science (CS)_Paper 2 (Algorithm, programming and Logic)_AnsKey

Duration 1 hour 45 minutes

Maximum marks 75

INSTRUCTIONS
1. You must answer on the question paper. No additional materials are needed.

2. Answer all questions.

3. Use a blue or black pen. You may use an HB pencil for any diagrams or

graphs.

4. Write your answer to each question in the space provided.

5. Do not use an erasable pen or correction fluid

6. Calculators must not be used in this paper.

INFORMATION
1. The total mark for this paper is 75.

2. The number of marks for each question or part question is shown in brackets [ ].

3. No marks will be awarded for using brand names of software packages or

hardware.

1
ANSWER KEY

1. Choose the correct option.

a) Tick (✓) one box to identify which option is used to show the inputs and
output of a Boolean expression. [1x1=1]

b) Tick (✓) one box to complete this sentence. [1x1=1]

c) Tick (✓) one box to complete this sentence. [1x1=1]

A solution to a problem may be represented using pseudocode, flowcharts or

d) Tick (✓) one box to complete this sentence. [1x1=1]

2
ANSWER KEY

A pseudocode example of a selection statement is

2. Four operators and three types of operator are shown.

Draw one or more lines from each operator to its correct operator type.
[1x4=4]

3. Identify three stages of the program development life cycle from the
following list. [1x3=3]

3
ANSWER KEY

1 Analysis

2 Design

3 Testing

4. Describe three methods that are used to design and construct a solution
to a problem. [1x6=6]

Ans:

Method 1: Structure Diagram

A hierarchical diagram showing the breakdown of a computer program into sub-


program.

Method 2: flowchart

A diagram showing the ordered steps to complete a computer program.

Method 3: Pseudocode

It shows what a program does in plain language.

5. Consider the logic circuit:

a) Write a logic expression for the given logic circuit. Do not attempt to
simplify the logic expression. [1x3=3]

4
ANSWER KEY

W= NOT X OR (Y XOR Z) // (Y XOR Z) OR NOT X

b) Complete the truth table from the given logic circuit. [1x4=4]

6. A programmer is designing a a program to check the length of a


password and to check if the password input is the same as the stored
password.

The program requirements are:


• input the password, Password
• check if there are at least 8 characters in the password
• check that the password is not the same as the stored password,
OldPass
• output ‘accepted’ if both tests are completed successfully
• otherwise, output ‘rejected’.

5
ANSWER KEY

Use the variable names given.

a) Complete the flowchart for the program. [1x6=6]

b) The accepted password, Password, is to be written to the file


MyPassword.txt. Explain why the accepted password needs to be stored
in a file. [1x2=2]

6
ANSWER KEY

Ans. Saved for a later date and storage must be non-volatile.

7. An algorithm has been written in pseudocode to check if a temperature


is in a given range. The temperature values used in the algorithm are
correct.

a) Identify the line numbers of four errors in the pseudocode and suggest a
correction for each error. [1x4=4]

Error 1: line number 03

7
ANSWER KEY

Correction

Temp should be Temperature

Error 2: line number 04

Correction

= should be <>

Error 3: line number 14

Correction

OR should be AND

Error 4: line number 19

Correction

WHILE should be UNTIL

b) Identify the temperature range used. [1x1=1]

Greater than or equal to 35 and less than or equal to 38

c) Complete the trace table for the corrected algorithm using this data:

34.22, 36.1, 37.4, 38.0, 999, -1 [1x2=2]

8
ANSWER KEY

8. A shop that sells cheese has has set up a new database table called
CheeseStock to store details of the cheeses available for sale. Part of
the table is given.

9
ANSWER KEY

a) State the number of records in this part of the database table. [1x1=1]

19
b) Give the name of the field that would be used for the primary key. [1x1=1]

ChNo

c) State the reason for choosing this field for the primary key. [1x1=1]

Unique Identifier

10
ANSWER KEY

d) Write the output from this structured query language (SQL) statement.

[1x2=2]

Ans. CH04 0.0


CH05 50.0

e) i) Complete this SQL statement to display only the name of all the cheeses
that are out of stock. [1X3=3]

SELECT Name

FROM CheeseStock

WHERE NOT InStock = No / “No” / False / / Where WeightKg = 0.0;

ii) Explain how one of the lines in your statement in part (e)(i) could be
changed to display the same information. [1x2=2]

Ans. Where clause can check either the InStock field for FALSE / No / “No”
or

The WeightKg field for 0.0

9. Consider the logic expression:

X = (NOT P OR Q) NAND (Q XOR R)

a) Draw a logic circuit for this logic expression.


Each logic gate must have a maximum of two inputs.
Do not simplify the logic expression. [1x4=4]

11
ANSWER KEY

b) Complete the truth table for the given logic expression. [1x4=4]

12
ANSWER KEY

10. A database table called Booking28 stores details of hotel rooms and
bookings for the week beginning Monday 7 July 2025.

a) State the number of fields and records in this database table. [1x2=2]

Fields: 11

Records: 15

b) State the reason why the Type field would not be suitable as a primary
key. [1x1=1]

Ans. The Type field contains data that repeats / data is not unique.

13
ANSWER KEY

c) The database uses only the data types:

• alphanumeric
• character
• Boolean
• integer
• real
• date/time.

Complete the table to show the fields that could have the given data types.

Only one field name is required in each box and each field name must be
different. [1x2=2]

Ans.

d) Give the output that would be produced by the structured query language
(SQL) statement: [1x3=3]

14
ANSWER KEY

Correct O/P

11. Four logic gates and five logic gate symbols are shown.
Draw one line to link each logic gate to its correct symbol. Not all logic
gate symbols will be used. [1x4=4]

15
ANSWER KEY

12. Complete the paragraph about databases. Use terms from the list. You
may need to use a term more than once. Some of the terms in the list
will not be used. [1x6=6]

Database tables consist of __rows/records________ and


____columns/fields______________ .

Rows are ____________records________.

_________columns_____ are fields.

Structured query language (SQL) __________scripts______ are used to


query data.

A ___Primary key__ uniquely identifies a record.

*************** End of Paper *********************

16

You might also like