Professional Documents
Culture Documents
SDT Winter Exam 2022 QP FINAL (3)
SDT Winter Exam 2022 QP FINAL (3)
SDT Winter Exam 2022 QP FINAL (3)
Time: 4 hours
Class Hotel
Data Rooms as whole number
Data Address as string
Data Distance as real number
Function Hotel()
End function
Function SetDistance(………………….)
………………….
End function
End class
a) The function Hotel has the same name as the class name. What is such a function 2
generally known as and what is the main purpose of this function?
What are the functions with same name known as in object-oriented languages?
Page 2 of 8
Software Development Techniques © NCC Education Limited 2022
d) What are the functions GetRoom and SetDistance generally known as in object- 2
oriented languages?
Total 10 Marks
Question 2
a) The following numbers are put in a queue: 1, -2, 5, -10, in that order.
iii) TWO (2) numbers are taken from the head of the queue. 2
The TWO (2) numbers are then multiplied, and the result is put in the queue.
List the contents of the queue, starting from the head of the queue.
b) The following numbers are put on a stack: 1, -2, 5, -10, in that order.
iii) TWO (2) numbers are taken from the top of the stack. 2
The TWO (2) numbers are then multiplied, and the result is put on the stack.
List the contents of the stack, starting from the top of the stack.
c) What TWO (2) complex data types are normally used to be queue and stack data 2
structures?
Total 10 Marks
Page 3 of 8
Software Development Techniques © NCC Education Limited 2022
Question 3
Fill in the test values in the table below for each type of test condition. You must
use only whole numbers as test values.
b) In the table below is a list of THREE (3) test methods used in testing the 3
correctness of programs. Fill in the missing parts of the test method descriptions.
Total 10 Marks
Question 4
Total 10 Marks
Page 4 of 8
Software Development Techniques © NCC Education Limited 2022
Question 5
The following program gets the number of books from the user.
If the number is not ZERO (0), it adds this number to the total.
read books
if books greater than 0 then
total = total + books
read books
if books greater than 0 then
total = total + books
read books
if books greater than 0 then
total = total + books
if total ………………………
a) Explain why a loop is useful in this case and why an unbounded loop would be 3
most appropriate.
Total 10 Marks
Question 6
columns
0 9
0
rows
Page 5 of 8
Software Development Techniques © NCC Education Limited 2022
ii) Set the element highlighted in the grid to -1. 2
result = false
If p is ……… than or equal to 0 then
result = true
end if
……… result
End function
ii) The logical operator ………… means either condition must be true to give a 1
result of true.
Total 10 Marks
Question 7
ii) An algorithm that scales well is one that does not significantly increase the 4
time it takes to complete as data increases.
The following are big O notations that represent how well algorithms scale.
Page 6 of 8
Software Development Techniques © NCC Education Limited 2022
b) Fill in the missing words below:
iv) ………… splits an array into sub-arrays and sorts each individually. 1
Total 10 Marks
Question 8
Copy and fill in the truth table below for the above equation.
P Q P AND Q P OR Q R
F F
F T
T F
T T
b) A simple logic circuit has TWO (2) inputs A and B, and TWO (2) outputs C and D. 4
C = NOT A AND B
D = NOT C
Draw a truth table that represents the logic of the above circuit for all combinations
of the inputs A and B.
Sets the value of variable var1 to ONE (1) if the value of variable var2 is higher
than ZERO (0).
Sets the value of variable var1 to ZERO (0) if the value of variable var2 is not
higher than ZERO (0).
Total 10 Marks
Page 7 of 8
Software Development Techniques © NCC Education Limited 2022
Question 9
iii) Variables which are made up of other variables are ……………. data types. 1
b) Write a function in pseudocode that accepts ONE (1) parameter of type whole 4
number.
The function prints the string “Yes” if the number is a negative number or prints the
string “No” if it is a positive number.
Total 10 Marks
Question 10
a) In the following program various variables with different data types are declared.
These variables are then assigned values, but the programmer made a mistake
and assigned the values to the wrong variables.
Data a as string
Data b as whole number
Data c as real number
Data d as Boolean
Data e as character
a = 123
b = 1.23
c = “Hey”
d = ‘M’
e = True
Total 10 Marks
End of paper
Page 8 of 8
Software Development Techniques © NCC Education Limited 2022