12 May 2014
Examination Paper
Answer ALL questions.
Time: 3 hours
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
Question 2
The function below calculates the value of n to the power of p (for example, if n = 3 and 10
p = 4 then the function will calculate 34). Perform a desk check on this function using a
table like the template shown below. The input values for the desk check are n = 2 and
p = 3. The first five lines have been completed for you.
Total 10 Marks
a) Computer programs can use different data types. For each of the following, suggest
an appropriate data type and justify your decision.
i) National Insurance number in the format: 2 letters, 6 numbers, 1 letter 2
ii) Daily rainfall in metres 2
iii) The number of millilitres of liquid a particular container can hold 2
b) Identify FOUR (4) benefits that come from using functions in code. 4
Total 10 Marks
Question 4
a) Provide the truth table for the logical comparison (A AND B) AND (B OR C) OR (NOT 6
A).
T T T F T
T T F F T
T F T F F
T F F F F
F T T T T
F T F T T
F F T T T
F F F T T
b) Explain what is meant by the term compound conditional. 2
Total 10 Marks
b) Rewrite the function from part (a) so that the user can set the lower, pass/fail 4
boundary, and upper values to be used in the selection statements.
Total 10 Marks
Question 6
a) Describe the process of integration testing and explain its relationship to unit testing. 4
b) When conducting unit testing, it is important to include test cases for valid, boundary 6
and invalid data. Explain what valid, boundary and invalid mean in the context of
software testing and provide an example of each for the function below.
Total 10 Marks
a) A linear search is the simplest form of search function. It sequentially compares each 6
element in an array against the item being searched for.
Provide the pseudocode for a linear search function on an array of whole numbers.
The function should take in the array and the search term as parameters. It should
return the index at which the number was found, or return -1 if the number was not
found in the array.
b) Explain, with reference to Big O Notation, why linear search does not scale as well as 4
binary search.
Total 10 Marks
Question 8
b) Write the pseudocode to declare the janWeekOneRainfall array and fill the array with 5
values entered by the user.
Total 10 Marks
Question 9
Provide a pseudocode representation of a Stack for whole numbers, including the push 10
and pop functions required to add and remove from it.
Total 10 Marks
Question 10
a) Give a pseudocode outline of a class called Student. Its attributes are StudentID, 6
Name, Course of Study and Age. The StudentID is a code comprised of 2 letters
followed by 5 numbers. The student age is stored as a whole number rather than date
of birth.
b) Using the class from part (a), add a constructor method that allows for all four of these 4
values to be set when the object is instantiated.
Total 10 Marks
End of examination
Page 5 of 5
Software Development Techniques June 2014 Final © NCC Education Ltd 2014