You are on page 1of 8

REVISION WORKSHEET- FINAL EXAM 2023

YEAR 9 – COMPUTER SCIENCE

Answer ALL questions.


1) The following algorithm is written using pseudocode.

a) WHILE index < 10 DO


SET index TO 1
SEND index TO DISPLAY
SET index TO index + 1
END WHILE
i) Identify the logic error in the pseudocode.

ii) What would have happened if the above algorithm was executed?

iii) What is the expected output from the above algorithm after correction?

b) The following is a program written in Python. Answer the questions below:

num1=2
num2=3
for index in range(1,3):
num1=num1*num2
num2=num2+num1
print(num1)
print (num2)

i) Write the output of the above program.

Page 1 of 7
ii) How many times will the loop be executed?
iii) What is type coercion?

c) Write a written description of an algorithm, to check whether the number centered is even or
odd. The algorithm should display the message accordingly.

d) Observe the Python code below to find the output:

a = 40
b = 20
c = 30
d = 10
x=0

x = (a + b) * c / d
print ("Value of (a + b) * c / d is ", x)

x= ((a - b) * c) / d
print ("Value of ((a + b) * c) / d is ", x)

x = (a + b) / d
print ("Value of (a + b) / d is ", x)

Output

Value of (a + b) * c / d is

Value of ((a - b) * c) / d is

Value of (a + b) / d is

2) Here is an algorithm expressed in pseudocode which calculates the pay of the employees

1. SEND ‘Please enter the number of hours.’ TO DISPLAY


2. RECEIVE NumHour FROM KEYBOARD

Page 1 of 7
3. SEND ‘Please enter the rate.’ TO DISPLAY
4. RECEIVE Rate FROM KEYBOARD
5. SET pay TO NumHour*Rate
6. SEND pay TO DISPLAY
a) List any two variables in the pseudocode.
b) Identify the line number which calculates the pay of the employees.
c) Draw a flowchart for the above algorithm.

3) a) Below is an algorithm which calculates the average of five numbers.


1: Start
2: Sum=0
3: Read Num
4: Add the Num to Sum
5: Any more number?
6: If yes goto step3
else
7: Avg=Sum/5
8: Print Avg
9: stop
i) Identify the variables used in the algorithm.
ii) Identify the most suitable data type of each variable in the algorithm.
iii) What is the difference between variables and constants?
b) Below is a python code for a customers who gets 10% discount if the total amount spend in the
shop is greater that AED 500/-.

totalSpend = integer(input ("What is your total spend?"))


if (totalSpend >500):

Page 1 of 7
print ("Discount 10%")
elif (totalSpend > 0)
print ("No discount")
else:
print ("Invalid input")

i) Name two constructs used above in the Python code.


ii) Identify two errors in the program by rewriting only those lines showing the correct code.

4) Study the algorithm below and answer the following questions:

Page 1 of 7
A

a) Identify any two variables used above.


b) State the type of the construct labeled A.
c) If the income was AED 1000/- and cost was AED 999/-, what will be printed.

Page 1 of 7
5) a) List the types of computational model?

b) Complete the flowchart and show the direction of the arrows;

INPUT PROCESS

6) a) Write down the escape sequence for the following;

Effect Escape sequence

Tab

New line

Displays “

b) Computers store all data as patterns of 0's and 1's. Information systems using 0's and 1's are
collectively known as binary information systems.

i) State two types of data that can be represented in binary in a digital computer.

ii) Write the bit pattern to represent these pixels

Page 1 of 7
7)a) Find the denary equivalent of the following binary numbers. Show your working.

i) 01011100
ii) 11001100

b) Find the binary equivalents of the following denary numbers.

i) 75

27 26 25 24 23 22 21 20
Place values 128 64 32 16 8 4 2 1

ii)28

27 26 25 24 23 22 21 20
Place values 128 64 32 16 8 4 2 1

c) Add the following 8-bit binary numbers. Show your working.

i) 10011111 + 00110000

ii) 00111011 + 10000110

d) Carry out an arithmetic shift right 3 places on the following binary numbers which is in two’s
compliment.
i) 10010101

Page 1 of 7
ii) 10101000

8) a) Show the stages of bubble sort when applied to the following list.

10 8 17 14 6

SAM KARL NITIN TOM HAMZA

(b) (i) Calculate the file size of an image having a width of 2432 and height 4224 pixels
with a bit colour depth of 24.

(ii) What is fidelity of a recording?

Page 1 of 7

You might also like