SDT Autumn Exam 2022 QP FINAL
SDT Autumn Exam 2022 QP FINAL
SDT Autumn Exam 2022 QP FINAL
07 September 2022
Time: 4 hours
Class Vehicle
Data Model as String
Data Year as Whole number
Data Length as Whole number
Data Consumption as Real number
End class
a) Write a constructor, in pseudocode, for the class Vehicle that initialises all the 4
class variables.
b) Add an accessor method to Vehicle class that sets the model name to a given 3
name.
c) Declare and create a new object named Mercedes of type Vehicle with the 3
following attributes: Model = “A180”, Year = 2021, Length = 4419, Consumption =
47.9
Total 10 Marks
Question 2
a) Various data structures are used by computer programs to store data and
retrieve data in different ways, such as where and in what order. For each of the
following data structures, briefly explain how data is stored and retrieved.
Page 2 of 8
Software Development Techniques © NCC Education Limited 2022
Marks
b) The following numbers are pushed on a stack data structure: -1, 5, -2 and 4, i.e. 4
-1 first and 4 last. Two numbers are popped and multiplied. The result is then
pushed back on the stack (i.e. pop, pop, multiply, push). This is repeated until
only one number is left on the stack. Fill in the table below to show this process
(note: stacks are filled from the top cell to the bottom cell, if there is no data then
leave the cell empty).
Initial Stack after 1st Stack after 2nd Stack after 3rd
contents of pop, pop, pop, pop, pop, pop,
the stack multiply, push multiply, push multiply, push
Total 10 Marks
Question 3
a) Below is a function that accepts a whole number as a parameter and tests to see 7
if the number is a negative or positive number:
otherwise
output(“Bad value”)
End function
Fill in the test values in the table below for each type of test condition. You must
use only whole numbers as test values.
Page 3 of 8
Software Development Techniques © NCC Education Limited 2022
Marks
b) In the table below is a list of THREE (3) test methods used in testing the 3
correctness of functions. Give a brief description of each test method.
Total 10 Marks
Question 4
a) The Requirements stage of the Software Development Life Cycle (SDLC) is the 4
cheapest stage. Explain what is meant by this statement and identify the most
expensive stage.
b) The Waterfall lifecycle development model has an iterative version. Explain how 3
this differs from the original (non-iterative) Waterfall model and why it was
invented.
Total 10 Marks
Question 5
Sum = Value[0]
Sum = Sum + Value[1]
Sum = Sum + Value[2]
Sum = Sum + Value[3]
Sum = Sum + Value[4]
Sum = Sum + Value[5]
Sum = Sum + Value[6]
Sum = Sum + Value[7]
Sum = Sum + Value[8]
Sum = Sum + Value[9]
You have been asked to redesign the program using a loop. You must decide whether to
use a bounded loop or an unbounded loop for the design of this algorithm.
a) Explain which type of loop should be used for the above requirement. 2
Page 4 of 8
Software Development Techniques © NCC Education Limited 2022
Marks
b) Write pseudocode that implements the above algorithm using a loop. 7
c) State ONE (1) advantage of using a loop in this case, bearing in mind that the 1
Value array could be more than 10 elements.
Total 10 Marks
Question 6
i) How many elements does array BigArray have? You must show how you 2
calculated the answer.
ii) The logical operator ………… means either conditions must be true to give 1
a result of true.
Total 10 Marks
Page 5 of 8
Software Development Techniques © NCC Education Limited 2022
Marks
Question 7
Total 10 Marks
Question 8
P OR (NOT P) AND Q = P OR Q
ii) Which TWO (2) columns show that the logic equation above is correct? 1
Page 6 of 8
Software Development Techniques © NCC Education Limited 2022
Marks
b) A simple logic circuit adds two binary inputs P and Q. R and C are the two
outputs. The following algorithm describes the logic of this circuit:
R=P+Q
if R = 2 then C = 1 otherwise C = 0
if C = 1 then R = 0
i) Draw the truth table that represents the logic of the above circuit for all 4
binary combinations of the inputs P and Q. Use only zeros and ones as
logic values.
Total 10 Marks
Question 9
b) Write a function in pseudocode that accepts TWO (2) parameters of type whole 7
number. The function compares the TWO (2) numbers and returns true if the first
number is greater than the second number, otherwise it returns false.
Total 10 Marks
Page 7 of 8
Software Development Techniques © NCC Education Limited 2022
Question 10
ii) You need to count the number of calories in the ingredients of a meal. 2
iii) The algorithm needs to decide whether it is a cloudy day or not. A variable 2
is required to hold one of the possible two values such as true or false.
Total 10 Marks
End of paper
Page 8 of 8
Software Development Techniques © NCC Education Limited 2022