0% found this document useful (0 votes)
226 views

Software Development Techniques 05 March 2020 Examination Paper

This document provides a sample examination paper for software development techniques. It contains 9 questions testing various concepts related to programming including loops, algorithms, data structures, functions, logic and problem solving. The paper is designed to be completed within 3 hours and has a maximum score of 100 marks.

Uploaded by

Yuki Ko
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
226 views

Software Development Techniques 05 March 2020 Examination Paper

This document provides a sample examination paper for software development techniques. It contains 9 questions testing various concepts related to programming including loops, algorithms, data structures, functions, logic and problem solving. The paper is designed to be completed within 3 hours and has a maximum score of 100 marks.

Uploaded by

Yuki Ko
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Software Development Techniques

05 March 2020

Examination Paper
Answer ALL questions.

Clearly cross out surplus answers.

Time: 3 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

a) Describe the FOUR (4) key steps in writing a simple computer program. 4

b) The following program code calculates the average of 10 exam marks. Copy the 4
code inserting comments in any FOUR [4] suitable places. The comments must
describe the intentions of the programmer and not simply repeat the code lines.

Loop until examMarks is equal to 10


Input nextMark
examMarks = examMarks + 1
totalMarks = totalMarks + nextMark
Next loop
Output totalMarks / examMarks

c) Give TWO [2] reasons why machine code is not the preferred code for 2
programming modern computers.

Total 10 Marks

Question 2

a) Various test methods are used to make sure a program works correctly. Identify 4
the method that:

i.) Assesses the flow of logic, making sure every branch of execution is tested.
ii.) Only considers the inputs and the outputs and does not look at the flow of
logic.
iii.) Uses a set of proven test cases that are applied each time a program is
altered in some way.
iv.) Tests those areas where errors are very likely to creep in because of the
transition between data values.

b) What is a test set? What does the size of a test set depend on? What does 6
running a test set involve?

Total 10 Marks

Page 2 of 8
Software Development Techniques © NCC Education Limited 2020
Marks

Question 3

The following algorithm is used to convert a binary number to a decimal number. 10


The binary number is stored in a String data type.

01. data binaryNo as String


02. data powerOfTwo as whole number
03. data counter as whole number
04. data decimalNo as whole number
05.
06. powerOfTwo = 1
07. counter = sizeOf(binaryNo) - 1
08. decimalNo = 0
09.
10. loop while counter is greater than or equal to 0
11. decimalNo = decimalNo + (binaryNo[counter] * powerOfTwo)
12. powerOfTwo = powerOfTwo * 2
13. counter = counter - 1
14. next loop

Assuming binaryNo = “0101101101”, copy the following table and fill in the
missing values at code line 13, just before line 13 is executed.
counter binaryNo[counter] decimalNo powerOfTwo

Total 10 Marks

Page 3 of 8
Software Development Techniques © NCC Education Limited 2020
Marks

Question 4

a) The code below shows a loop where count is a whole number data type. State 2
whether this is a bounded or unbounded loop and explain your answer.

count = 0
Loop until count is equal to 100
count = count + 1
Next loop

b) The code below shows a loop where userInput is a string data type. State 2
whether this is a bounded or unbounded loop and explain your answer.

Loop until userInput is equal to “q”


Input userInput
Next loop

c) Write a bounded loop in pseudocode that fills an array of whole numbers of size 6
100 with -1. You will need to declare the variables required by this code.

Total 10 Marks

Question 5

a) Below is pseudocode that accepts two values from the user, adds them up and 5
outputs the result. It repeats this THREE (3) times. Re-write this pseudocode
using a function to remove the repetitive code and reduce the code size.

Data num1 as whole number


Data num2 as whole number
Output “Enter the first number”
Input num1
Output “Enter the second number”
Input num2
Output “Sum = “+ (num1 + num2)
Output “Enter the first number”
Input num1
Output “Enter the second number”
Input num2
Output “Sum = “+ (num1 + num2)
Output “Enter the first number”
Input num1
Output “Enter the second number”
Input num2
Output “Sum = “+ (num1 + num2)

Page 4 of 8
Software Development Techniques © NCC Education Limited 2020
Marks

b) Complete the missing parts of the following statements.

i) Data or information given to a function is called …………... 1

ii) Data or information given back from a function is called ……………… 1

iii) To run the code contained within a function it must be …………... 1

c) A program has functions A, B and C.

i) What test method would you use to test each function individually works 1
correctly?

ii) What test method would you use to make sure all three functions 1
communicate correctly?

Total 10 Marks

Question 6

a) Identify and describe the data type suitable for storing.

i) the count of students in a class. 2

ii) the temperature of the weather. 2

iii) the name of a street. 2

iv) True or False value only. 2

b) What is a memory leak? 2

Total 10 Marks

Page 5 of 8
Software Development Techniques © NCC Education Limited 2020
Marks

Question 7

a) Using the information in the truth table below, fill in the missing column 6
headings with the correct compound conditionals in the table.

X Y
F F F F T T
F T F T T F
T F F T T F
T T T T F F

b) The following is a logical if statement where A and B are Boolean values. 4

if (A and B) then result = 0


otherwise if (A) then result = 1
otherwise if (B) then result = 2
otherwise result = 3

Fill in the missing values in the result column in the table below.

A B result
True True
False False
False True
True False

Total 10 Marks

Page 6 of 8
Software Development Techniques © NCC Education Limited 2020
Marks

Question 8

a) An array of whole numbers has 1000 elements. A linear search algorithm is used
to search for a number. State and explain, what is:

i) The best case of number of searches? 2

ii) The worst case of number of searches? 2

iii) The average case of number of searches? 2

b) Explain how a bubble sort algorithm works. 4

Total 10 Marks

Question 9

a) Discuss the differences between a stack data structure and a queue data 6
structure. In your answer, you need to include a description of differences in
how data is moved to and taken away from both data structures.

b) Fill in the missing stack contents corresponding to the listed stack operations 4
in the following table. The sequence of stack operations is from left to right. The
first cell under stack contents is filled in for you.

A, B and C are variables in which the popped numbers are stored, for example,
if top of stack contains number 1 then pop A will move number 1 into the
variable A, i.e. A = 1. If pop operation has no variable letter next to it then the
popped number is simply thrown away.

Stack operations Stack contents


(order from left to right) (leftmost number is top of stack)

push 1, push -8, push 3 3, -8, 1

pop, pop, push 12

push -5, push 7

pop A, pop B
push (A + B)

pop A, pop B, pop C


push (A – B + C)

Total 10 Marks

Page 7 of 8
Software Development Techniques © NCC Education Limited 2020
Marks

Question 10

Consider the following code:

Class Student
data name as String
data gender as Character
data bornIn as Whole number

Function Student (needs n as String, g as Character, b as


Whole number)
name = n
gender = g
bornIn = b
End function

Function setName(needs newName as String)


name = newName
End function

Function getAge() returns Whole number


Return age
End function
End class

a) Write code to create a new student object with the name “Jane Monroe”, 3
gender F and bornIn 2008. You need to first declare a correct object variable
for this.

b) The function Student has the same name as the class name and is a special 3
type of method in a class. What is this type called and what is its main purpose?

c) Functions setName and getAge are called accessor methods. Explain what an 2
accessor method is, in a class.

d) What is method overloading? Give a version of the function Student as an 2


example of function overloading. You need not repeat the body of the function.

Total 10 Marks

End of paper

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

You might also like