Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Software Development Techniques

07 September 2022

Time-Controlled Assessment Paper


Answer ALL questions.

Clearly cross out surplus answers.

Time: 4 hours

The maximum mark for this paper is 100.

Any reference material brought into the examination room must be


handed to the invigilator before the start of the examination.
Answer ALL questions
Marks
Question 1

The class Vehicle is defined as

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.

i) The Queue data structure. 2

ii) The Stack data structure. 2

iii) The List data structure. 2

Questions continue on next page

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:

Function TestValue(needs value as whole number)


If value is greater than -16 and value is less than 16 then
if value is less than 0 then
output("Negative value")
if value is equal to 0 then
output("Null value")
if value is greater than 0 then
output("Positive value")

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.

Test condition Test values


Transition in values (maximum 3)
Extreme values (maximum 2)
Bad values (maximum 2)

Questions continue on next page

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.

Test method Description of test method


Whitebox testing
Blackbox testing
Unit testing

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.

c) State THREE (3) features of the Agile model of software development. 3

Total 10 Marks

Question 5

The following program adds together all the numbers in an array.

Data Value (10) as whole number


Data Sum as whole number

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

Questions continue on next page

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

a) An array variable is declared as:


Data BigArray (100, 2500) as Whole number

i) How many elements does array BigArray have? You must show how you 2
calculated the answer.

ii) Array BigArray(X, Y) is a two-dimensional array indexed by TWO (2) 2


numbers X and Y. Which number is known as the column and which as
the row?

b) The following function accepts a number. It decides if the number is a positive 4


number, or it is a negative number. Parts of the function are missing. You need to
fill in the missing parts.

Function IsPositive (……… p as whole number) ……… Boolean


Data result as Boolean
result = ………
If p is greater than or equal to 0 then
result = true
end if
……… result
End function

c) Complete the following sentences.

i) An object is a specific ………… of a class. 1

ii) The logical operator ………… means either conditions must be true to give 1
a result of true.

Total 10 Marks

Questions continue on next page

Page 5 of 8
Software Development Techniques © NCC Education Limited 2022
Marks
Question 7

a) The simplest kind of search is a linear search of an array.

i) Describe how linear search works. 3

ii) We have an array of 10,000 elements to search using a linear search. 3


Given this information fill in the missing values in the following table:

Our best case of number of searches is


Our worst case of number of searches is
Our average case of number of searches is

b) Fill in the missing words below:

i) Binary searches need to have ………… array to function. 1

ii) The Big O notation O(n) belongs to ………… search algorithm. 1

iii) The simplest form of sorting is known as a ………… sort. 1

iv) Quicksort algorithm is ………… than Bubble sort algorithm. 1

Total 10 Marks

Question 8

a) A rule in Boolean logic states the following fact:

P OR (NOT P) AND Q = P OR Q

i) Fill in the truth table below. 4

P Q NOT P (NOT P) AND Q) P OR ((NOT P) AND Q)) P OR Q


F F
F T
T F
T T

ii) Which TWO (2) columns show that the logic equation above is correct? 1

Questions continue on next page

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.

ii) If R represents the sum of P and Q, what does C represent? 1

Total 10 Marks

Question 9

a) We often develop algorithms in pseudocode. Complete the missing parts of the


following statements about pseudocode:

i) Pseudocode is not tied to a specific ……………. 1

ii) Pseudocode focuses mainly on the ……………. of an algorithm 1

iii) Pseudocode allows the checking of the ……………. of the algorithm on 1


paper.

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

Questions continue on next page

Page 7 of 8
Software Development Techniques © NCC Education Limited 2022
Question 10

a) For each of the following cases state:

The most appropriate data type


A pseudocode declaration for that type

i) Your algorithm needs to store and process information such as the 2


temperature of the soil.

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.

iv) The algorithm stores the efficiency category of a domestic washing 2


machine as a single letter from A to H.

v) In today’s very efficient appliances, the efficiency category can be more 2


than just a single letter. It could also be A+++, A++ or A+

Total 10 Marks

End of paper

Page 8 of 8
Software Development Techniques © NCC Education Limited 2022

You might also like