Software Development Techniques 26 November 2015 Marking Scheme This marking scheme has been prepared as a guide only to markers. This is not a set of model answers, or the exclusive answers to the questions, and there will frequently be alternative responses which will provide a valid answer. Markers are advised that, unless a question specifies that an answer be provided in a particular form, then an answer that is correct (factually or in practical terms) must be given the available marks. If there is doubt as to the correctness of an answer, the relevant NCC Education materials should be the first authority. Throughout the marking, please credit any valid alternative point. Where markers award half marks in any part of a question, they should ensure that the total mark recorded for the question is rounded up to a whole mark.
Answer ALL questions Question 1 a) Some programs written in high level programming languages are compiled. With the aid of a diagram, explain what is meant by the term compilation in relation to software development. Compilation is the process of taking a human readable (1 mark) representation of code (1 mark), and converting (1 mark) it into a form the computer can understand (1 mark). 7 Award up to 3 marks for a diagram. Award 1 mark for an illustration of a high level language and award 2 marks for multiple machine/code systems. b) Some languages are interpreted and not compiled. Briefly explain the purpose of an interpreter. An interpreter is a program (1 mark) that reads, analyses and then executes (1 mark) each instruction of the source code (1 mark). 3 Question 2 a) Briefly explain what is meant by an algorithm and state FOUR (4) features of a good algorithm. 6 An Algorithm is a series of instructions (1 mark) that manipulate data (1 mark). Award 1 mark for each feature up to a maximum of 4 marks: Complete Robust Efficient Readable Maintainable b) Briefly explain what is meant by pseudocode and provide TWO (2) reasons why pseudocode is used to write an algorithm. Pseudocode is an informal language (1) that helps us describe and design algorithms (1). 4 Award 1 mark for each feature up to a maximum of 2 marks: We are not committed to a specific programming language We can focus on the logic of an algorithm as opposed to the language specific features. We can formally check the correctness on paper. Page 2 of 15
Question 3 The following algorithm can be used to calculate the average of three scores in a game. Perform a desk-check on this algorithm using a table to show the values in each variable after the execution of each line. You should assume an input value of 150 for score1 and 100 for score2 and 200 for score3. 10 1. data score1 as whole number 2. data score2 as whole number 3. data score3 as whole number 4. data average as whole number 5. output Welcome to the average score calculator 6. output What is the first score? 7. input score1 8. output What is the second score? 9. input score2 10. output What is the third score? 11. input score3 12. average = (score1 + score2 + score3)/3 13. output The average score is: 14. output average 15. output Thankyou for using this program. Question 3 continues on next page Page 3 of 15
The maximum number of marks awarded to this question is 10. Award 1 mark in total for correctly stating lines 1-4. Award 1 mark in total for correctly stating lines 5,6 and 15. Award 1 mark for each correct line from 7-14 (up to a maximum of 8 marks. Line score 1 score 2 score 3 score 4 notes 1 0 0 0 0 score1 declared 2 0 0 0 0 score2 declared 3 0 0 0 0 score3 declared 4 0 0 0 0 average declared 5 0 0 0 0 Output 6 0 0 0 0 Output 7 150 0 0 0 User inputs 150 8 150 0 0 0 Output 9 150 100 0 0 User inputs 100 10 150 100 0 0 Output 11 150 100 200 0 User inputs 200 12 150 100 200 150 13 150 100 200 150 Output 14 150 100 200 150 Output 15 150 100 200 150 Output Page 4 of 15
Question 4 a) State FOUR (4) considerations when choosing between a single precision and double precision floating point data type. 4 Award 1 mark for each bullet point up to a maximum of 4 marks: A single precision data type may not be large enough to store a high value A single precision data type may not be able to store the value accurately enough A double precision data type takes up more memory space and may not be necessary Converting form a double to a single may mean loss of data/accuracy and the effect of this on the program needs to be considered carefully. Data conversions from one type to another may be carried out implicitly by the chosen language. b) State what data types should be used for the following variables and explain your answer: i) The first name of an employee 2 ii) iii) Award 1 mark for a correct choice and 1 mark for a correct explanation: String because it is made up of characters The salary of an employee Award 1 mark for a correct choice and 1 mark for a correct explanation: Integer if we are going to use the minimum units of currency, real/float if we are going to count it as a decimal The phone number of an employee Award 1 mark for a correct choice and 1 mark for a correct explanation: String because it will have a leading zero 2 2 Page 5 of 15
Question 5 a) What the difference between a bounded loop and an unbounded loop? 2 With a bounded Loop, we know how many times we are going to repeat (1 mark). In contrast, an unbounded loop is when we do not know how many times we are going to repeat (1 mark) b) Write a short pseudocode program that will read in exactly 3 scores from the user and calculate the average, displaying the result. The scores should be whole numbers and the calculation should be completed using the appropriate type of loop. 8 The number of marks awarded to this question is 8. The code should be something similar to this: 1. data score as whole number 2. data counter as whole number 3. data total as whole number 4. data average as float 5. total = 0 6. counter = 0 7. loop until counter is equal to 3 8. input score 9. total = total + score 10. increment counter 11. next loop 12. average = total / counter 13. output average 14. output Goodbye! should be allocated as follows: 1 mark for using the loop; 1 mark for using a counter; 1 mark for ending at 3; 2 marks for choosing a bounded loop; 2 marks for correct loop contents; and 1 mark for clarity. The pseudocode does not need to be exact but it does need to clearly solve the problem. Page 6 of 15
Question 6 a) Write a pseudocode algorithm which tests to ensure that a given input value is a positive whole number. You should make appropriate use of variable names and data types. 5 The maximum number of marks awarded to this question is 5. An example solution is: 1 data usernumber as whole number 2 output "Please enter a whole number" 3 input usernumber 4 if usernumber > 0 then 5 output "That's a positive number!" 6 end if 7 output "Goodbye!" Award up to 2 marks for appropriate use of if statement; 1 mark for correct logical condition; 1 mark for appropriate variable names; and 1 mark for appropriate data type. b) Using an if statement, write pseudocode that implements the following rule: 5 If a student's score is greater than 70 the grade is 1, otherwise if the grade is greater than 60 the grade is 2:1, otherwise if the grade is greater than 50 the grade is 2:2. You should use the following variables: (1) data score as float/real; and (2) data grade as string. The maximum number of marks awarded to this question is 5. An example solution is: 1. If score >= 70 then 2. grade = 1 3. else if score >=60 then 4. grade = 2:1 5. else if score >=50 then 6. grade = 2:2 7. End if Award up to 3 marks for correct logic and award 2 marks for correct if/else structure. For full marks, structure is important, but not syntax. Page 7 of 15
Question 7 Below is a partly complete truth table for the logical equation (A AND B) OR (C AND D). Complete the table. 10 A B C D A AND B C AND D (A AND B) OR (C AND D) False False False False False False False False False False True False False False False False True False False False False False True True False True False True False False False False False True False True False False False True True False False False False True True True False True True False False False False False True False False True False False True False True False True False True True True True False False True True False True True True True False True True True True Question 7 continues on next page Page 8 of 15
The maximum number of marks awarded to this question is 10. Award ½ marks for each cell in the last column (up to a maximum of 7 marks). Award ½ mark for each correct pair in columns 5 and 6 ( up to a maximum of 3 marks) A B C D A AND B C AND D (A AND B) OR (C AND D) False False False False False False False False False False True False False False False False True False False False False False False True True False True True False True False False False False False False True False True False False False False True True False False False False False True True True False True True True False False False False False False True False False True False False False True False True False False False False True False True True False True True True True False False True False True True True False True True False True True True True False True False True True True True True True True True Page 9 of 15
Question 8 a) State FOUR (4) advantages of using arrays in programming. 4 Award up to 1 mark for each bullet point up to a maximum of 4 marks: Can group a number of items of the same type together with a single name making them easier to manage, and code easier to read There are many functions for manipulating arrays making searching, sorting updating a relatively simple, and well understood task Accessing the elements of an array can be fast They are a logical representation of real world structures such as vectors and matrices. b) The following pseudocode program is used to find the largest value in an array of numbers that have been entered by the user. It uses two functions, CreateArray(), to get that array form the user and FindLargest(). FindLargest takes an array as input and returns the largest value in that array. Write a pseudocode algorithm that implements the FindLargest function. (Note: you should use the standard function sizeof() to find the size of the array that has been passed to your function). 6 1. data nums as array of whole number 2. data usernum as whole number 3. data largest as whole number 4. output "Enter the size of the array? 5. input usernum; 6. nums = CreateArray (usernum) 7. largest = FindLargest (nums); 8. output "The largest number in the list you entered was " + largest Question 8 continues on next page Page 10 of 15
The maximum number of marks awarded to this question is 6. Answer should be similar to below although syntax does not need to be precise. function FindLargest (needs nums as array of whole numbers) returning whole number 1 data l as whole number 2 data c as whole number 3 loop while c is less than sizeof (array) 4 if nums[c] is greater than l 5 l = nums[counter] 6 end if 7 c = c + 1 8 end loop 9 return l End Function should be allocated as follows: 1 mark for correct use of function keyword; 1 mark for correct specification of input; 1 mark for correct specification of output; 1 mark for use of sizeof() function. Award 1 mark for appropriate structure of loop and 1 mark for appropriate structure of selection. Page 11 of 15
Question 9 a) Quicksort and bubblesort are two algorithms for sorting sets of data. Explain how the quicksort and bubblesort algorithms work. You should also identify which algorithm is most efficient for dealing with small and large sets of data. Quicksort Algorithm works by splitting an array into two sections (1 mark) and then sorts each sub-array (1 mark). It is recursive (1 mark). 7 Bubblesort It works by checking adjacent pairs and then swapping them when they are not in order (1 mark). It requires us to step over the whole array several times (1 mark). Bubblesort better for small data sets but slows down as the size increases (1 mark), while quicksort is more efficient as the size of the data set increases (1 mark) b) Software can be tested using Black Box testing. Briefly evaluate Black Box testing as a suitable approach for examining the different logical paths through an algorithm. Black box testing is functional testing and checks the output of the program based on a given input (1 mark). It does not examine the details of the code (1 mark) therefore it is not a suitable approach for testing the logical paths through an algorithm (1 mark). 3 Page 12 of 15
Question 10 a) In Object Oriented Programming, briefly explain the difference between a Class and an Object. 2 Award 1 mark for each bullet point up to a maximum of 2 marks. A class represents a collection of similar things, and specifies the common properties, and functions of those things. An object is an instance of a class and represents an actual thing that has data attached to its properties, and state associated with its functionality. b) The following class is used to describe objects of type Student. These objects would appear in an enrolment application for a University. The class is incomplete as it does not contain accessor functions. Write some pseudocode accessor functions for this class. 8 Class Student data name as String data age as whole number End Class // Accessor functions to be written here The maximum number of marks awarded to this question is 8. Award 2 marks per function - syntax can be approximate but must refer to correct member variables (1 mark) and getters must return correct values (1 mark). function setname (needs n as String) name = n end function function setemail (needs a as whole number) age = a end function function getname() returns String return name end function function getage() returns whole number return age end function End of Examination Paper Page 13 of 15
Learning Outcomes matrix Question Learning Outcomes assessed 1 1 Yes 2 1,2 Yes 3 2,5,6 Yes 4 2,3 Yes 5 2,3 Yes 6 3,6 Yes 7 3 Yes 8 4,7 Yes 9 5,6 Yes 10 7 Yes Marker can differentiate between varying levels of achievement Page 14 of 15
Grade descriptors Learning Outcome Identify and explain the key stages of software development lifecycles Express, design and evaluate algorithms Identify and use programming language constructs Identify and use common data structures Explain and use common algorithms Explain and use test strategies Explain how software is modularised Pass Merit Distinction Provide adequate ability to explain the subject matter ability to perform the task ability to perform the task ability to perform the task adequate ability to explain the subject matter; adequate and appropriate use adequate ability to explain the subject matter; adequate and appropriate use Provide adequate ability to explain the subject matter Provide detailed and coherent explanation of the subject matter ability to perform the task consistently well ability to perform the task consistently well ability to perform the task consistently well detailed and coherent explanation of the subject matter; appropriate and effective use detailed and coherent explanation of the subject matter; appropriate and effective use Provide detailed and coherent explanation of the subject matter Provide comprehensive, lucid explanation of the subject matter ability to perform the task to the highest standard ability to perform the task to the highest standard ability to perform the task to the highest standard comprehensive, lucid explanation of the subject matter; highly appropriate and effective use comprehensive, lucid explanation of the subject matter; highly appropriate and effective use Provide comprehensive, lucid explanation of the subject matter Page 15 of 15