[go: up one dir, main page]

0% found this document useful (0 votes)
43 views8 pages

SDT QP Spring 2021 Sample 2

The document provides a sample time constrained assessment for a software development techniques course. It consists of 9 multiple choice questions worth a total of 100 marks. The questions cover topics such as algorithms, testing strategies, data types, loops, data structures, logic expressions, searching and sorting algorithms. Students are required to complete all questions within the 4 hour time limit.

Uploaded by

prabhakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views8 pages

SDT QP Spring 2021 Sample 2

The document provides a sample time constrained assessment for a software development techniques course. It consists of 9 multiple choice questions worth a total of 100 marks. The questions cover topics such as algorithms, testing strategies, data types, loops, data structures, logic expressions, searching and sorting algorithms. Students are required to complete all questions within the 4 hour time limit.

Uploaded by

prabhakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

TIME CONSTRAINED ASSESSMENT

Software Development Techniques

SAMPLE TIME CONSTRAINED ASSESSMENT

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

a) A computer’s Central Processing Unit (CPU) cannot directly execute instructions 4


that are written in a language like a spoken language. Explain why this is the
case. Give TWO (2) types of software tools that can create machine-code
instructions.

b) Identify and briefly explain THREE (3) qualities that a good algorithm should 6
have.

Total 10 Marks

Question 2

a) White-box testing, and black-box testing are two test strategies. Explain what 5
they are and state which strategy desk-checking comes under.

b) Regression testing is an important method in making sure that programs are 5


correct. Explain why regression testing is required and how it is carried out. Give
TWO (2) examples of when regression testing is appropriate.

Total 10 Marks

Questions continue on the next page

Page 2 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 3

a) A clothes shop is counting their inventory of ladies’ t-shirts. The following


algorithm is used to count the number of small, medium and large sized t-shirts in
a list of TEN (10) t-shirts stored in an array:

The t-shirt sizes in an array are as follows: [10, 12, 14, 8, 18, 12, 20, 8, 16, 14]

01. data sizes as array (10) of whole numbers


02. data counter as whole number
03. data large as whole number
04. data medium as whole number
05. data small as whole number
06. large = 0
07. medium = 0
08. small = 0
09. counter = 0
10. loop until counter is equal to 10
11. if sizes[counter] is less than 12 then
12. small = small + 1
13. else
14. If sizes[counter] is greater than 16 then
15. large = large + 1
16. else
17. medium = medium + 1
18. end if
19. end if
20. counter = counter + 1
21. next loop

i) Copy the following table and fill in the values of ALL the data variables at line 10
19. The counter values are already filled in. You need to fill in all the cells of
the table. When you finish, the counts of small, medium and large t-shirts
should add up to 10.

counter small medium large


0
1
2
3
4
5
6
7
8
9

Total 10 Marks

Page 3 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 4

a) You are asked to write an application that will store daily weather information.
You will need to decide on the data representation by using the most appropriate
data types for the following variables: temperature, name_of_month,
day_of_month and is_dry_day which is true if a dry day.

i) State what data types you will choose and explain why you would choose 8
them.

b) Data types can be primitive or complex types. Give ONE (1) example of each 2
type.

Total 10 Marks

Question 5

a) Loops are very useful in computer programs. There are two types: bounded loop 2
and unbounded loop. Explain when you should use a bounded loop and when
you should use an unbounded loop.

b) Below is a program that outputs the contents of an array. Re-write this program 7
using a bounded loop. You do not need to declare the array.

Output array[0]
Output array[1]
Output array[2]
Output array[3]
Output array[4]
Output array[5]
Output array[6]
Output array[7]
Output array[8]
Output array[9]
Output array[10]
Output array[11]

c) Give ONE (1) advantage of using a loop in the program in b). 1

Total 10 Marks

Question 6

a) Data structures are extensively used in computer programs. Two data structures 6
employ access methods that are particularly useful: First-in-first-out (FIFO) and
Last-in-first-out (LIFO). Give the names of the data structures and explain how
their access methods work.

Page 4 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
b) Push and Pop are two operations that operate on a stack. Below are the two
functions that implement the Push and Pop operations. The stack is represented
by the stack_array and si is the stack index. These are globally declared.

i) The Push function is fine. However, the programmer made TWO (2) 4
mistakes in the Pop function. Identify these mistakes and explain why they
are mistakes.

01. Function Push(needs d as whole number)


02. stack_array[si] = d //put data d on top of stack
03. si = si + 1 //increment stack index
04. End function

05. Function Pop returns whole number


06. data d as whole number
07. d = stack_array[si]
08. si = si + 1
09. return d
10. End function

Total 10 Marks

Question 7

a) Given the following logic expression:

(X and not Y) or (not X and Y)

i) Fill in the truth table below for this expression. T stands for True and F 5
stands for False.

X Y not X not Y C = (X and not Y) D = (not X and Y) C or D


F F
T F
F T
T T

ii) Comment on the values of (C or D) column with respect to the values in X 1


and Y columns.

Page 5 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
b) The following if statement assigns a value to the variable B depending on the
value of the variable A. Both variables A and B are data type whole number.

if A > 0 then
B = A + 1
otherwise
if A < -1 and A > -5 then
B = -1
otherwise
B = A

i) Fill in the missing values in the B column in the table below: 4

A B
8
0
-1
-6

Total 10 Marks

Question 8

a) An array of whole numbers contains the numbers 2, 5, 10, 16, 28, 42, 55 in 4
sorted order. How many binary search operations will be needed on the array
before locating the number 55? Explain how you calculated this.

b) Big O notation gives us a generalised view of how well algorithms scale. Some
typical Big O notations for search and sort algorithms are:

O(n)
O(log n)
O(n log n)

i) Identify which algorithms they correspond to. 3

ii) Identify the best performing algorithm. 1

c) An algorithm has two nested loops. Each loop completes after N counts. How 2
many counts will it take for both loops to complete? What is the Big O notation for
this algorithm?

Total 10 Marks

Page 6 of 8
Software Development Techniques © NCC Education Limited 2021
Marks
Question 9

a) The following program breaks down a sentence into its individual words which
are then stored in an array of strings. This is called parsing the sentence.

01. data words as array of (2) string


02. data sentence as string
03. data n as whole number
04. data p as whole number

05. sentence = "Hello Ali"


06. n = 0 //index into string variable sentence
07. p = 0 //index into array variable words

08. Loop until n is equal to sizeof(sentence)


09. if sentence[n] not equal to " " then
10. words[p] = words[p] + sentence[n]
11. else
12. p = p + 1 //increment index into words array
13. end if
14. n = n + 1 //increment index into sentence string
15. Next loop

i) Explain what line 10 is doing. 1

ii) Copy the following table and fill in the values of the data variables at line 10. 9
The values of variable n are already filled in.

n p sentence[n] words[p]
0
1
2
3
4
5
6
7
8

Total 10 Marks

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

Given the following program:

01 Class Student
02 data name as String
03 data gender as Character
04 data age as Whole number

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


06 a as Whole number)
07 name = n
08 gender = g
09 age = a
10 End function

11 Function setName(needs newName as String)


12 name = newName
13 End function

14 Function setAge(needs newAge as String)


15 age = newAge
16 End function
17 End class

a) i) Identify the constructor method. 1

ii) Identify the accessor methods. 2

b) Add a method to Student class that queries the student’s age. 3

c) Write the code necessary to do the following actions: 4

• Create the new object myStudent of type Student using suitable parameters.
• Print the age of myStudent.

Total 10 Marks

End of paper

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

You might also like