Software Development Techniques 03 September 2020 Examination Paper
Software Development Techniques 03 September 2020 Examination Paper
03 September 2020
Examination Paper
Answer ALL questions.
Time: 4 hours
IMPORTANT INFORMATION
b) Identify the FOUR (4) key steps in writing a simple computer program. 4
Total 10 Marks
Question 2
a) The following are the various test methods used to make sure programs work
correctly. Explain the key features of each method.
b) Unit testing is an important testing strategy that programmers use to ensure correct 2
operation of their programs. Explain what unit testing is and what it involves.
Total 10 Marks
Page 2 of 8
Software Development Techniques © NCC Education Limited 2020
Marks
Question 3
a) A global array, named Stack, of type whole number is used as a stack. A global 4
pointer, named SP, of type whole number is used to index the last entry in this
stack. The value of SP is initially set to -1.
b) A function called, Pop, first tests if SP is greater than or equal to 0. If it is, then it 6
gets the value in Stack indexed by SP and decrements SP by one. It then returns
this value. Otherwise it outputs a suitable error message. The following code is
incomplete. Copy it and fill in the missing parts.
Total 10 Marks
Page 3 of 8
Software Development Techniques © NCC Education Limited 2020
Marks
Question 4
Total 10 Marks
Question 5
a) What do the following abbreviations stand for with respect to data structures?
i.) FIFO 1
ii.) LIFO 1
b) The following numbers are pushed on an empty stack in the order 5, 10, -6, 3. 4
Copy the stack shown below and fill in with the pushed numbers.
Top
Bottom
Stack
The numbers in the stack in part (b) are then popped one by one and queued in 4
c) an empty queue until the stack is empty. Copy the queue shown below and fill in
with the numbers queued.
Head Tail
Queue
Total 10 Marks
Page 4 of 8
Software Development Techniques © NCC Education Limited 2020
Marks
Question 6
a) The following pseudocode uses two loops to perform a simple algorithm. The 10
variables sum, a, and b are of data type whole number. You are required to
perform desk-checking on this algorithm. Fill in the values of sum, a and b, in the
table below, when the new sum is calculated at line 6.
1. sum = 0
2. a = 1
3. Loop while a is less than 4
4. b=3
5. Loop until b = 0
6. sum = sum + (a * b)
7. b=b-1
8. End loop
9. a=a+1
10. End loop
sum a b
Total 10 Marks
Page 5 of 8
Software Development Techniques © NCC Education Limited 2020
Marks
Question 7
if X > 0 then
Z=X
otherwise
if X = 0 and Y > 0 then
Z=0
otherwise
Z=1
X Y Z
1 0
0 1
-1 0
0 0
Total 10 Marks
Page 6 of 8
Software Development Techniques © NCC Education Limited 2020
Marks
Question 8
a) Identify the data type that can store the kind of data described by the following
statements and give an example of data in each case.
i) Can store negative and positive numbers that are not fractions 2
ii) Can store numbers that can include negative or positive fractions 2
b) Data types can be primitive or complex types. State which type is each of the
following:
i) Real number 1
ii) String 1
Total 10 Marks
Question 9
• O(n)
• O(log n)
b) The following numbers are stored in an array in sorted order. A binary search is 3
used to search for the number 8. Explain the steps the search algorithm will take
until the search successfully locates the number 8.
Total 10 Marks
Page 7 of 8
Software Development Techniques © NCC Education Limited 2020
Marks
Question 10
Class Animal
data hasWings as Boolean
data legs as Whole number
data type as String
End Class
a) Write a constructor function that initialises all three attributes of the class 5
Animal.
b) Write the pseudo code necessary to create an Animal object called Starling with 3
the following attributes:
hasWings =True
legs = 2
type = “Starling”
c) Write an accessor function called canFly that returns a True or False value 2
depending on the value of the attribute hasWings.
Total 10 Marks
End of paper
Page 8 of 8
Software Development Techniques © NCC Education Limited 2020