Computing (Modular)
CP4
2008
(2
Hours)
[1] | Pupil information in a school is held on a computer system. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | Give an example involving pupil information where a record would be the most appropriate data structure. Describe why an array would not be suitable in this case. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Draw a diagram to show a situation involving pupil information where a three-dimensional array would be the most appropriate data structure. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exam marks for three pupils and three subjects for two years. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[2] | A well designed human computer interface (HCI) is very important to the users of a computer system. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | For each of the following three types of HCI, describe a different situation which could sensibly use this type of HCI and give one reason why this would be beneficial in each case. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(I) | handwriting input; | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(II) | speech recognition input; | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(III) | speech synthesis output. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Describe three problems associated with speech recognition input | [3] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[3](a) | Write down truth tables for: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | the AND operation | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | the OR operation | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(b) | If A=10110001 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
B=11001011 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Carry out the following operations: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | (A AND B) | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | (A AND B) OR A | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[4] | A queue is a type of data structure. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | Explain, using a diagram, the term queue. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Explain what should happen when an attempt is made to add an item to a full queue. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(iii) | Describe a situation where a queue would be used in a computer system, and explain why the queue is the most appropriate data structure in this case. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[5](a) | A standard code for storing characters in a computer system stores the following characters in ascending binary order: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"0" 00110000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"1" 00110001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"2" 00110010 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Write down the codes for: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | "3" | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | "9" | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(b) | In a certain computer sign/magnitude representation is used to store positive and negative integers using 8 bits. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | Explain what is meant by the term sign/magnitude representation. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Demonstrate the use of the sign/magnitude representation using 8 bits, for the integers 5 and -5 | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(c) | Explain the term overflow when used in connection with storing numbers in a computer. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(d) | Numbers are often stored in computers in floating point form. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | State one benefit of storing numbers in floating point form. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | State one problem associated with storing numbers in floating point form. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[6](a) | State two methods of describing algorithms. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(b) | Quicksort is a recursive algorithm. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | Explain the term recursive algorithm. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Briefly outline how Quicksort operates. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[7](a) | Give an example of an application which might use a special purpose language. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(b) | Describe two features normally available in a fourth generation language (4GL). | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(c) (i) | Describe the difference between a procedural programming language and a non-procedural programming language. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Give an example of a suitable use for each type of programming language: procedural and non-procedural. | [2] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(d) | Describe briefly what is meant by an object oriented approach to programming. | [1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
8. | The email addresses of students at Clynnog College are made up of the surname plus three digits, followed by the @ sign, followed by clynnog.ac.uk | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
All letters used are in lower case. Assume all surnames consist of letters only, and can be of any length. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
For instance, the email address for David Jones is jones034@clynnog.ac.uk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(i) | Produce a Backus Naur Form (BNF) definition for a Clynnog College student email address. | [4] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(ii) | Produce a syntax diagram for a Clynnog College student email address. | [3] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
9. | The following incomplete algorithm is intended to perform a linear search for an item Search Value in an array Numbers[1..n] and output the position if the item if it is found. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The asterisks below indicate four lines which are incomplete. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copy and complete the four lines indicated by asterisks. | [4] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[10] | In the following question additional
credit ( up to 3 marks ) will be gained if your answer demonstrates skill in
written communication.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A compiler is used when a computer program is translated into a form ready for execution by a computer. Describe in detail the main stages of compilation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Once the program has been successfully compiled, a debugging program may be used with it. Describe in detail the various elements which may be available in a debugging program. | [8+3] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In Lexical Analysis, all comments and unnecessary
spaces are removed, and the program is converted into numerical tokens. During Syntax Analysis, the tokens are used to produce a Symbol Table of numerical values and a dictionary of variable names and string values. The tokens are checked that they obey the syntax rules of the language used and any error messages are output if they do not. Semantic Analysis checks that all variables are properly declared and no incorrect operations are being used such as assigning real values to integer variables. Code Generation converts the program into executable machine code and there may be some code optimisation to make the program smaller or run faster. A debugging program may allow breakpoints to be placed in the program. The program is run, stops at the breakpoint and the programmer can then check the values of variables to see if they are as expected. Single-stepping will allow one line of code to be executed at a time. Traces will show the order in which the lines of the program are executed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||