Computing (Modular)
CP1
January, 2001
(2 Hours)
1(a) | A program team is developing a suite of programs. Frequently, they need to deal with syntax errors, execution errors and logical errors. In each case, explain the term and give an example. | ||
(i) | syntax error | [2] | |
An error in using the
rules of the language which causes failure to compile. Eg Mis-spelling a command |
|||
(ii) | execution error | [2] | |
An error which occurs
when the program is run. Eg If an unusual item of data is entered and the program crashes. |
|||
(iii) | logical error | [2] | |
The program runs but does
not do the right thing - ie an error in the design of the program. Eg An incorrect mathematical formula may have been used. |
|||
(b) | Why is it generally easier to find syntax errors than logical errors? | [1] | |
The compiler will detect
syntax errors and stop the compilation process and output a diagnostic
error message. |
|||
2(a) | Character,string and boolean are names of simple data types. | ||
(i) | Give an example of data which could be held in the character type. | [1] | |
Eg
A code letter eg 'M' or 'F' for a sex field. |
|||
(ii) | Give an example of data which could be held in the string type. | [1] | |
Eg
A name |
|||
(iii) | Give an example of data which could be held in the boolean type. | [1] | |
Eg
A field indicating whether a house has a garage or not (True or False) |
|||
(b) | There are at least two numerical data types. What numerical data type is best suited to storing: | ||
(i) the number of elements in an array | [1] | ||
Integer |
|||
(ii) the temperature of a liquid in a scientific experiment? | [1] | ||
A
real number |
|||
3 | A binary search is used in certain circumstances to attempt to find an element in an array. | ||
(i) | State the major advantage of a binary search over a linear search. | [1] | |
It
is much faster to find data. |
|||
(ii) | A binary search cannot always be used. In what circumstances is it not suitable to use a binary search? | [1] | |
If
the data is not sorted, a binary seacrh will not work |
|||
(iii) | It can be shown that, for a binary search, it takes around 14 steps to search for an element in an array of 10000 items. Assuming this is true, what would be the corresponding figure for an array of 20000 items? | [1] | |
15
steps (After one step the data to be searched is halved ie down to 10000
items) |
|||
4. | Different programming languages are used in different application areas. | ||
(i) | Certain programming languages are used for commercial applications, while others are used for scientific applications. Describe one feature which it would be useful to have in each of the following: | ||
I. a language used in a commercial application; | [1] | ||
File-handling
commands eg Searching and sorting |
|||
II. a language used in a scientific application. | [1] | ||
High-precision
calculations eg Trigonometrical function |
|||
(ii) | Hypertext mark-up language (HTML) is an example of a language which is used to produce web pages. Explain why this type of language is suitable for this application. | [2] | |
|
|||
(iii) | A source code program is often input to a translation program. Explain the two terms: | ||
I. source code program | [1] | ||
The
(text) program as written by the programmer using a programming
language. |
|||
II. translation program | [1] | ||
A
program (assembler, compiler, interpreter) which converts the souce code
program into a program which the computer can execute. (machine code) |
|||
5. | An office worker uses a computer package which contains a word processor and a spreadsheet. | ||
(a) | There are benefits and drawbacks of using an integrated package of this type compared with using separate word processing and spreadsheet packages. | ||
(i) Describe two benefits of the integrated approach; | [2] | ||
|
|||
(ii) Describe one drawback of the integrated approach. | [1] | ||
it
will use more memory when running or storage space on a disk. |
|||
(b) | The worker frequently uses the following features: | ||
Explain each of these terms. In each case, give an example of the use the office worker might make of the feature. |
[6] | ||
|
|||
6. | Records and two-dimensional arrays are examples of data structures which a manufacturing company uses to store information about its sales staff and their sales. | ||
(i) | Give a detailed example of sales staff information which might be stored in the form of records, and state why this data structure is suitable in this case. | [2] | |
The details of each member of staff would be stored as a record of the above type. This data structure is suitable because there is data od different types in each record. |
|||
(ii) | Give a detailed example of sales information which might be stored in the form of two-dimensional arrays, and state why this data structure is suitable in this case. | [2] | |
The
number of sales each member of staff had made in each month of a year
would be stored as a two-dimensional array.
This data is suitable because all the data is of the same type (integer). |
|||
7. | The following algorithm is intended to output the maximum value in an array of positive integers. The array is called cost and has n values from cost[1] to cost[n]. | ||
|
|||
(i) What other item of information does the algorithm output? |
[1] | ||
The
position of the maximum value. |
|||
(ii) What will happen if the array contains two or more equal values? | [2] | ||
The
maximum value will be output together with the position of the first
integer with that value. |
|||
(iii) The loop in this algorithm is controlled by the variable count. An alternative method of controlling a loop would be by the use of a rogue value. Give an example of a suitable rogue value in this case and state where the rogue value should have been placed in the data. | [2] | ||
A
suitable rogue value would be -1 (since all the integers are positive)
The rogue value must be placed at the end of the data so it is the last one to be input. ie at cost[n+1] |
|||
8. | After an electricity meter reader has visited a
number of customers' homes, he or she inputs all the data into the
company's computer system. In each case, a check is then made that the
current meter reading is not far too large or far too small compared with
the reading taken six months ago, which would suggest an error had been
made. If this check is satisfactory, the new figure is included in the
data held for each customer.
The situation described so far is shown in the diagram below: |
||
|
|||
(i) Write down the name for this type of diagram. | [1] | ||
A
data flow diagram. |
|||
(ii) Describe why this type of diagram is particularly useful to systems analysts. | [1] | ||
It
shows the flow of data through a system in an easy-to-understand way. |
|||
(iii) What type of object does the open box symbol in the diagram represent? | [1] | ||
A
data store |
|||
(iv) Give a suitable name for this object (shown as a) | [1] | ||
Customer's
previous readings. |
|||
(v) What type of object does the arrow symbol in the diagram represent? | [1] | ||
data
flow |
|||
(vi) Give a suitable name for the object shown as b in the diagram. | [1] | ||
previous
meter reading |
|||
(vii) Give a suitable name for the object shown as c in the diagram. | [1] | ||
current
meter reading |
|||
9(a) | A small shop still uses a paper-based system to
control its stock flow. Imagine that you are asked to carry out a systems
analysis and design for a new computer-based system for stock flow.
The new system must support the following operations:
As systems analyst, you will need to carry out a number of tasks. |
||
(i) feasibility study | [2] | ||
|
|||
(ii) analysis of the existing system | [2] | ||
|
|||
(iii) data validation | [2] | ||
|
|||
(iv) design of the user interface | [2] | ||
|
|||
(b) | When a new system is implemented, there is usually a changeover period. | ||
(i) Explain the term changeover | [1] | ||
|
|||
(ii) Why is it useful that the old system should still be available? | [1] | ||
|
|||
(c) | After a computer system is developed, there are often post-implementation costs. Give two examples of post-implementation costs and state in each case how the cost can be minimised. | [4] | |
|
|||
10 | In the following
question, additional credit (3 marks) will be gained if your answer
demonstrates skill in written communication.
A company wishes to undertake a substantial software development. Software is normally written in the form of modules. This approach often makes use of standard modules and most programmers use some form of self-documenting code. Describe in detail why it is useful to organise a program into modules and explain what is meant by the term standard module, giving one example of a task which might be carries out by a standard module. Also explain two advantages of using standard modules. Explain why it is sensible to use self-documenting code, giving two different examples. |
[7+3] | |
Large
programs should be broken down into small self-contained modules. These
are easier for the programmer to analyse, design, code and then test. A
number of different programmers may be assigned to different modules,
coding and testing each one separately before putting them together in
the final program.
A standard module consists of a number of previously coded subroutines. For example, a standard module may consist of a number of routines used to validate input data. These have already been thoroughly tested and programmers will save time by including these in their programs. Self-documenting code should be used where there are a number of comments included in the program explaining each section. This is useful for future programmers who may have to maintain the program. Another method of self-documentation would be to use sensibe variable names in the source code. |
|||