Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Explain the difference between the terms compilation and interpretation.
Compilation – Complete source code is converted to intermediate step and then combined
with other resources. Finally assembly code is produced.
Interpretation – Each line of code is interpreted and executed in turn. Requires an
interpreter to be running on the host platform.
State TWO (2) advantages of compilation in relation to software development.
It produces a fixed executable, which will be optimised for the chosen platform.
Needs no other resources to run.
State TWO (2) advantages of interpretation in relation to software development.
Highly portable code as long as the interpreter is available on other platforms.
Fast development time as no compilation stage required to test code
Explain what is meant by the term compilation in relation to software development.
Compilation is the process of taking a human readable, representation of code and
converting it into a form the computer can understand.
Explain what is meant by the term compilation and explain its relationship to low and high level
languages.
Compilation is the process of turning human readable.
High level languages into machine comprehensible low level languages.
.
Briefly explain the purpose of an interpreter.
An interpreter is a program that reads, analyses and then executes each instruction of the
source code.
Briefly explain what is meant by pseudocode and provide TWO (2) advantages and TWO (2)
disadvantages of its use.
Pseudocode is an implementation independent, representation of structured programming
processes.
Advantages:
It can be applied to all programming languages.
It is easier to modify than code on a computer.
Disadvantages:
It must be ‘ported’ to individual systems.
It must be desk-checked, which can be cumbersome.
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Explain what is meant by a low level language and briefly outline the process through which it is
generated.
Low level languages are in a format understood by the computer as opposed to being
human readable. High level languages are turned into low level languages through the
process of compilation.
Outline the term high level language and explain the process through which it goes to become
machine code.
A high level language is one that is designed for humans and is far removed from the low
level languages that computers understand. Our algorithms go through a compilation
process which turns human readable code into machine code.
Briefly explain the process high-level language code goes through in order to run on different
types of systems.
In order to run high-level language code, it must be compiled into machine code, through a
structured logical conversion. The same high-level code can be compiled multiple times
using compilers for different systems, thus enabling the program to run on multiple types of
systems
Briefly describe machine code and high level languages, and provide ONE (1) advantage and ONE
(1) disadvantage of each language.
Machine code description:
Written in 1s and 0s.
Written in the language of the CPU.
Machine code advantage:
No compilation required.
Very efficient.
Machine code disadvantage:
Platform-specific so not portable
Hardest type of programming language to learn
No standardised machine code – varies by type of computer/ CPU.
High- level languages description:
Written in a human-readable syntax
Must be compiled to machine code or interpreted at run time.
High- level languages advantage:
Easier to learn than machine code
Easier to debug than machine code
More portable than machine code
High- level languages disadvantage:
Needs to be compiled
Not optimised for the hardware
FOUR (4) reasons why most software development projects use high-level languages
Machine code is hard to write
Programs written in high-level languages are portable
High level languages are easier to learn
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Programs written in high level languages are easier to maintain
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Briefly explain what is meant by an algorithm and state FOUR (4) features of a good algorithm.
An Algorithm is a series of instructions that manipulate data.
: Complete Robust Efficient Readable Maintainable
Explain the terms algorithm and pseudocode and describe the relationship between.
An algorithm is a list of sequential instructions for solving a problem.
One way in which an algorithm can be documented is by using pseudocode.
Pseudocode is the term used to describe a set of structured instructions that outline some
logically distinct process, written in a way which is implementation independent but can be
easily translated into a high level programming language.
State FOUR (4) advantages of writing algorithms in pseudocode rather than a specific
programming language.
It means we are not tied to a specific programming language.
it means we can focus on the logic of an algorithm rather than the language specific
features.
It means we can formally check the correctness on paper.
Define what is meant by a ‘desk check’, and explain why we perform this process when developing
algorithms.
A desk-check is when we perform the job of the computer, working through the pseudocode
and seeing how it all fits together.
We perform a desk check to ensure that the logic in our algorithms is correct, and to ensure
that we sensibly deal with user input.
Describe what is meant by ‘flow of execution’ in a program.
The flow of execution through a program is the order in which code statements are
executed, and this can be manipulated by loops and selections.
Explain what is meant by the term variable.
A variable is a piece of data that may change its state during the running of a program
Explain the difference between black box and white box testing and explain what program
deficiencies each method is best suited to identifying.
Black box testing involves testing inputs against expected outcomes,
whereas white box testing stresses each path through a program to make sure all branches
can be reached.
Black box testing finds areas where functionality is incorrect by focusing on unexpected
output. White box testing is suitable for finding errors on rare paths through a program
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Briefly explain what is meant by inputs and outputs
Input data is read into the algorithm and the algorithm produces some output depending on
its purpose (1 mark).
Good software must be robust and maintainable. Define robust and maintainable in relation to
software development and explain the difference between the two terms.
A program is robust if it can deal with misformed and malformed input
A program is maintainable if it can easily be altered to repair defects
They both relate to how well software deals with defects, but one is at runtime and the
other is important when a program is being changed in code
Pseudocode is designed to be implementation independent. Define the term implementation
independent and provide ONE (1) advantage and ONE (1) disadvantage with the concept.
An implementation language has no assumption as to what programming language will be
used to implement the logic so as to ensure it is applicable to all.
Advantage is that there is no need to port an algorithm from one language to another
Disadvantage is that an algorithm must be converted into a language before it can be used.
Briefly describe FIVE (5) qualities of a good algorithm.
Complete: A Complete algorithm is one that contains the steps required to arrive at a
desired conclusion.
Robust: A Robust algorithm is one that can deal with unlikely situations and incorrect data.
Efficient: An Efficient algorithm is one that accomplishes its task in the minimum number of
steps.
Readable: A Readable algorithm is one that is clear and can be easily understood.
Maintainable: A Maintainable algorithm is one that can be changed easily.
Well-documented: A Well-documented algorithm is one where every part of the algorithm is
clearly explained in natural language.
Explain what is meant by the term unbounded loop and give an example of when its use is
appropriate.
An unbounded loop is a loop that will iterate an unknown number of times . They are useful
when we do not know in advance how many times a section of code will need to be
repeated. Unbounded loops are often used for data validation of user input.
Explain what is meant by the term ‘bounded loop’ and give an example of when it would be
appropriate to use one.
A bounded loop is one in which we know at the time of execution how many times we are to
loop
e.g. filling an array
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Explain the term flow of execution and describe how unbounded loops can impact upon this.
Flow of execution is the order in which program statements are executed.
The default flow of execution through a program is sequential.
Unbounded loops allow for changes in the flow of execution
The loop may not execute, or may run one or more times depending on whether the loop
condition is met.
Selection statements can contain multiple conditions, joined together using logical operators.
Describe the “AND” and “OR” logical operators, and give a pseudocode example for each.
The AND operator means that both conditions A and B must be true in order to return
true
The OR operator means that either condition A or condition B (or both) must be true in
order to return true.
Define the term scaling and explain how it is an issue for programs we create.
Bigger is different as far as programs go – what works well for a small set of input might
work differently for a larger set of input.
This issue is known as a scaling issue and it is a problem for our programs because we need
to be sure that our programs will work effectively for the amount of data we will be
manipulating
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
For each of the following, suggest an appropriate data type and justify your decision:
Student matriculation number in the form 01242221
o Student matriculation number should be a string, because it could include leading
zeros
Date of birth in the format DD/MM/YYYY
o Date of birth should be a string, because it has a format that includes slashes
The BMI of a person, in the format 28.2
o BMI should be a real number, because it stores decimal information and we may
wish to perform arithmetic on it.
An email address.
o Data type should be string, made up alphanumeric characters
A six digit sort code for a bank, in the format 11-03-52.
o Data type should be string, because not used in calculation.
The gold weight of a ring in grams
o Data type is Real number, may be used in calculations and is not accurate enough as
a whole number
7-digit Student ID number
o Data type is String, Made up of alphanumeric characters
Height of a mountain in kilometres
o Data type is real number, To store the height of mountains accurately as most
mountains are not a whole number of kilometres in height
Engine size in litres
o Data type is real number, May be used in calculations
The first name of an employee
o explanation: String because it is made up of characters
The salary of an employee
o 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
o explanation: String because it will have a leading zero
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
The name of a student
o explanation: String because it is made up of characters
The phone number of a student
o explanation: String because it will have a leading zero
The age of a student
o Integer because we usually measure age in whole years
The height of a student in metres
o Real/float because we will have fractional part of a metre
Define the terms primitive and complex with relation to data types and provide ONE (1) example
of each term.
Primitive data types are the building blocks that are used to build all other data types.
o An example of a primitive data type is the real number data type.
Complex data types are those made up of combinations of primitive data types.
o An example of a complex data type is the string data type which is a collection of
characters
Briefly explain what is meant by the term compound conditional.
A compound conditional is one in which two logical conditions are joined together using the
AND or OR logical operators
Explain what is meant by the ‘AND’ and ‘OR’ logical comparisons and provide ONE (1) example of a
scenario in which each logical comparison can be used.
The AND comparison is used to join conditions together so that both must be true.
The OR comparison is used to join conditions together so that either can be true.
AND is suitable in a scenario such as ‘if john and bill go to the cinema then I go too’.
Or is suitable in a scenario such as ‘If a horror or a comedy is playing at the cinema, I will go’
Explain the term iteration and provide ONE (1) example of a suitable programming structure that
demonstrates it.
Iteration is a repetition which results in a piece of code executing until a condition is met
loop while counter < 100 next loop
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
State FOUR (4) considerations when choosing between a single precision and double precision
floating point data type.
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
Data conversions from one type to another may be carried out implicitly by the chosen
language.
State TWO (2) questions that should be considered when choosing a data type.
What kind of information you need to store?
What kind of format will be used for output?
Explain what is meant by the term regression testing and outline why this is a necessary process.
Regression testing is the process of re-testing code which has been fixed to check for new
errors introduced as a result.
It is often the case that in fixing one error we may introduce another and as such we need to
make sure that the software we have previously written has not been adversely impacted by
our fix
Briefly describe TWO (2) types of looping structure and provide ONE (1) example of when each
type of looping structure might be used.
Two looping structures are the bound and unbound loops.
Bound loops are when we know at runtime how often to repeat and are suitable for tasks
such as repeating up until a set number.
Unbounded loops are when the termination condition is not known to us such as waiting for
a user to type a particular key.
Define the term truth table and outline its purpose.
A truth table is a technique for assessing the conditions under which a compound
conditional expression will evaluate as true, so that we can tell what combination of values
will trigger an associated condition.
They are used to assess the logical validity of expressions
Compound conditions can be used in unbounded loops or in selection statements. Describe each
of these programming structures, showing the difference between them.
An unbounded loop is a loop that will iterate an unknown number of times.
They are useful when we do not know in advance how many times a section of code will
need to be repeated.
Sections of code will only execute if a particular condition is met.
Unlike unbounded loops, selection statements do not loop: they either execute once or not
at all
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Briefly explain the following components of a bounded loop
i) Initialisation – the counter is given a starting value
ii) Continuation Condition – the condition under which we stop looping
What the difference between a bounded loop and an unbounded loop?
With a bounded Loop, we know how many times we are going to repeat.
In contrast, an unbounded loop is when we do not know how many times we are going to
repeat
Bounded – iterate known number f times
Unbounded – iterate unknown number of times
What is the difference between the terms lazy evaluation and compound conditional?
A compound conditional is one where more than one condition is bound together through a
logical operator.
Lazy evaluation is when a compound terminates as soon as it can determine the evaluation
of the overall condition without checking the others.
Explain what is meant by the term assigned memory and allocated memory and provide ONE (1)
pseudocode example of each term.
Allocated memory is created when we set up a variable, and assigned memory is used when
we give a variable a value.
data name as string // allocated
Name = “Michael” // Assigned
Explain what is meant by the term function and explain how functions are related to the main
program.
A function is a self-contained piece of code which exists independently of the main program.
A function will only be executed if it is called from the main program
Identify FOUR (4) benefits that are associated with the effective use of functions within a
computer program.
Functions simplify program code.
allow for easier unit testing
allow for functionality to be effectively partitioned within a program
allow for reusability
Explain the term function and briefly outline the importance of functions in developing
programming solutions.
A function is a self-contained unit of code which communicates with the rest of a program
through parameters and return values.
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
They are important for building modular solutions.
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
What is the difference between unit testing and integration testing?
With unit testing we take each function in turn and run it against our test cases.
With integration testing, we test the communication between units making the
complementary techniques
Explain the difference between black box and white box testing and explain what program
deficiencies each method is best suited to identifying.
Black box testing involves testing inputs against expected outcomes, whereas white box
testing stresses each path through a program to make sure all branches can be reached.
Black box testing finds areas where functionality is incorrect by focusing on unexpected
output.
White box testing is suitable for finding errors on rare paths through a program
Provide the pseudocode implementation of a function which takes a whole number parameter
and returns ‘true’ if it can be divided by five or by three without leaving a remainder. It should
return ‘false’ otherwise.
The parameter
The return type
The even condition
The return
The odd condition
The return
Function isEven (needs n as whole number) returns Boolean
If num % 5 is 0 AND num % 3 is 0 then
return true
else
return false
end if
End Function
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
State FOUR (4) advantages of using arrays in programming.:
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.
State FOUR (4) advantages of using functions in programming.
Breaks problems down into manageable parts
Simplifies checking and testing
Make it easier to change/expand program
Easier to follow programs
There are FOUR (4) main stages completed when writing a program. Identify and briefly describe
each of the FOUR (4) stages.
Firstly we need to determine data representation where we work out what information we
need to store.
Second, we need to work out the input in which we determine how we’re going to get the
information.
Thirdly, we decide on how to manipulate the information by developing an algorithm.
Fourthly, we determine how to display the result as an output.
Explain what is meant by the term scaling.
Scaling is the extent to which an algorithm works with different sets of data– an algorithm
that works with a small set of data may not work as well with a larger set of data
Making an algorithm work for large amounts of data and operation
Outline FOUR (4) benefits that are associated with using arrays in computer programs.
Arrays allow for certain kinds of programs to be written that cannot be written with single
variables
greatly reduce the amount of code needed for dealing with large sets of homogenous data
They make code more maintainable
easier to read
Explain what is meant by the term index.
The index is the numerical value used to indicate which element of an array is to be accessed
c) Explain what is meant by the term element.
The element is the data value stored within a compartment of an array and is of the same
type as that of the array
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Explain the quicksort algorithm and the bubblesort algorithm.
Quicksort: Divide the array by selecting a pivot and move values so that they are on the
correct side of the pivot. Then perform quicksort on the array on each side of the pivot until
all subproblems are solved.
Bubblesort: Work through from the beginning of the array and compare each two adjacent
values and swap if in the wrong order Repeat this process until there is nothing left to swap
The following pseudocode program is used to display the times table of the user’s choice:
1. data userChoice as whole number
2. output “Please enter the times table you would like to calculate:”
3. input userChoice
4. call timesTable(userChoice)
5. output “Goodbye!”
The program uses a function called “timesTable()” to create and display the times table specified in
an argument. Write the contents of the function timesTable() in pseudocode.
Function timesTable(needs num as whole number) returning nothing
1. data counter as integer
2. counter = 1
3. loop until counter is equal to num
4. result = num * counter
5. output counter + “ x “ + num + “ = “ + result
6. increment counter
7. next loop
Binary Search
A binary search works by finding the middle point of a sorted array and checking to see if the target
element is greater or less than the middle element. It then checks the appropriate half of the array
by doing the same thing until the target is found
Explain the concept of a class
A class is used to represent a collection of objects in our programme. These things will have
data or information stored about them and will perform operations. The class includes
member variable to represent the data and methods to represent the operations that the
classes can perform.
A class represents a collection of similar things, and specifies the common properties,
and functions of those things
Explain the term Object.
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
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.
Differentiate Objects, regular Variables, and arrays.
An array is a data structure with lots of compartments into which data may be slotted Differentiate accessor and constructor
A constructor is a special behaviour in an object that is call when an object is instantiated.
Accessor is a function used to set or get a variable in a class
Queue
A queue is a FIFO structure where we push elements on to the end and remove them from
the top
print job queue
Stack
Stack is LIFO structure where elements are pushed on to the top (1 mark) and then popped off of the top
keeping track of where we are in a recursion.
Recursion
Recursion is the process of a function calling itself with smaller versions of a problem until it reaches a termination point
List
An array that grows as needed
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017
Software Development Techniques Past Year Paper Compilation
Jayson Lalata Sagaoinit Micronet International College
© March2017