SDT QP Spring 2021 Sample 2
SDT QP Spring 2021 Sample 2
Time: 4 hours
b) Identify and briefly explain THREE (3) qualities that a good algorithm should 6
have.
Total 10 Marks
Question 2
a) White-box testing, and black-box testing are two test strategies. Explain what 5
they are and state which strategy desk-checking comes under.
Total 10 Marks
Page 2 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 3
The t-shirt sizes in an array are as follows: [10, 12, 14, 8, 18, 12, 20, 8, 16, 14]
i) Copy the following table and fill in the values of ALL the data variables at line 10
19. The counter values are already filled in. You need to fill in all the cells of
the table. When you finish, the counts of small, medium and large t-shirts
should add up to 10.
Total 10 Marks
Page 3 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 4
a) You are asked to write an application that will store daily weather information.
You will need to decide on the data representation by using the most appropriate
data types for the following variables: temperature, name_of_month,
day_of_month and is_dry_day which is true if a dry day.
i) State what data types you will choose and explain why you would choose 8
them.
b) Data types can be primitive or complex types. Give ONE (1) example of each 2
type.
Total 10 Marks
Question 5
a) Loops are very useful in computer programs. There are two types: bounded loop 2
and unbounded loop. Explain when you should use a bounded loop and when
you should use an unbounded loop.
b) Below is a program that outputs the contents of an array. Re-write this program 7
using a bounded loop. You do not need to declare the array.
Output array[0]
Output array[1]
Output array[2]
Output array[3]
Output array[4]
Output array[5]
Output array[6]
Output array[7]
Output array[8]
Output array[9]
Output array[10]
Output array[11]
Total 10 Marks
Question 6
a) Data structures are extensively used in computer programs. Two data structures 6
employ access methods that are particularly useful: First-in-first-out (FIFO) and
Last-in-first-out (LIFO). Give the names of the data structures and explain how
their access methods work.
Page 4 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
b) Push and Pop are two operations that operate on a stack. Below are the two
functions that implement the Push and Pop operations. The stack is represented
by the stack_array and si is the stack index. These are globally declared.
i) The Push function is fine. However, the programmer made TWO (2) 4
mistakes in the Pop function. Identify these mistakes and explain why they
are mistakes.
Total 10 Marks
Question 7
i) Fill in the truth table below for this expression. T stands for True and F 5
stands for False.
Page 5 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
b) The following if statement assigns a value to the variable B depending on the
value of the variable A. Both variables A and B are data type whole number.
if A > 0 then
B = A + 1
otherwise
if A < -1 and A > -5 then
B = -1
otherwise
B = A
A B
8
0
-1
-6
Total 10 Marks
Question 8
a) An array of whole numbers contains the numbers 2, 5, 10, 16, 28, 42, 55 in 4
sorted order. How many binary search operations will be needed on the array
before locating the number 55? Explain how you calculated this.
b) Big O notation gives us a generalised view of how well algorithms scale. Some
typical Big O notations for search and sort algorithms are:
O(n)
O(log n)
O(n log n)
c) An algorithm has two nested loops. Each loop completes after N counts. How 2
many counts will it take for both loops to complete? What is the Big O notation for
this algorithm?
Total 10 Marks
Page 6 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 9
a) The following program breaks down a sentence into its individual words which
are then stored in an array of strings. This is called parsing the sentence.
ii) Copy the following table and fill in the values of the data variables at line 10. 9
The values of variable n are already filled in.
n p sentence[n] words[p]
0
1
2
3
4
5
6
7
8
Total 10 Marks
Page 7 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 10
01 Class Student
02 data name as String
03 data gender as Character
04 data age as Whole number
• Create the new object myStudent of type Student using suitable parameters.
• Print the age of myStudent.
Total 10 Marks
End of paper
Page 8 of 8
Software Development Techniques © NCC Education Limited 2021