Computing (Modular) CP4
June 2009

(2 Hours)

[1] Companies often use software packages to solve a problem rather than asking their programmers to develop new programs. Describe three benefits of this approach. [3]
   
 
[2] A certain computer character code represents alphabetical characters in ascending binary order. For instance, the character "E" is represented by 01110101, "F" by 01110110, etc.

Write down the code for:

 
(a) "G" [1]
   
(b) "D" [1]
   
 
[3] Stacks and linked lists are two types of data structure.
 
 
(a) Explain what is meant by the term data structure and explain why data structures  are useful in computing. [2]
   
(b) Name a computer application where a stack is the most appropriate data structure and explain why it is the most appropriate data structure in this case. [2]
   
(c)(i) Explain what is meant by the term linked list. [2]
   
(ii) In a certain implementation, a linked list of names is actually stored in a table form as shown below. The names are to be accessed in ascending alphabetical order. A variable points to the first name in the alphabet, Bennett.
 
Address Name Pointer
501 Goldstein  
502 Tomkins  
503 Huang  
504 Bennett  
505 Kareem  
506 Davies  
.... .... ....

Copy the table and complete the pointer column.

[3]
   
 
[4](i) Convert the eight-digit binary number 00011110 to  
(a) hexadecimal [1]
   
(b) denary (decimal) [1]
   
(ii)(a) Show how the number -510 is represented in two's complement form using 8 bits. [1]
   
(b) Showing your working, demonstrate that 910 is the result of the binary addition of -510 and 1410. [2]
   
 
[5](a) Explain what is meant by the term algorithm. [2]
   
(b) A recursive algorithm must have a terminating condition.  
(i) What other feature does a recursive algorithm need to have? [1]
   
(ii) Describe one benefit of using a recursive algorithm. [1]
   
(iii) Name one example of a recursive algorithm. [1]
   
 
[6] P is the eight-digit binary number 11011011

Q is the eight-digit binary number 01110101

 
(a) Two logical operations that can be carried out on a pair of binary numbers are OR and XOR.

One of these logical operations has been carried out on P and Q giving the result 10101110. Which logical operation has been carried out in this case?

[1]
   
(b) Write down the eight-digit binary number which results from carrying out the logical operation NOT Q. [1]
   
(c) Write down the eight-digit binary number which results from carrying out an arithmetic shift right by one place on Q. [1]
   
(d) M is the eight-digit binary number 00000001

M is used for masking.
 

 
(i) State what logical operation is used during masking. [1]
   
(ii) What effect will masking with M have on any eight-digit binary number? [1]
   
 
[7] The following incomplete algorithm is intended to perform a sort on the n elements of the array Customer.

The asterisks below indicate four lines which are incomplete.

 

 
 
1   repeat
2 *   set Swap :=
3 *   for Count := 1 to
4       if Customer[Count] > Customer[Count+1] then
5         Temp := Customer[Count]
6 *       Customer[Count] :=
7 *       Customer[Count+1] :=
8         Swap := TRUE
9       endif
10     endfor
11   until Swap = FALSE
 
  Copy and complete the four lines indicated by asterisks. [4]
   
 
[8](a)(i) What is the purpose of Backus Naur Form (BNF)? [1]
   
(ii) Why is a natural language (such as English or Welsh) not suitable for this purpose? [1]
   
(b) In a certain programming language a variable name is made up of letters (which can be upper case or lower case) and digits. The first character must be an upper case letter. The name may be of any length.

For instance, the following are permitted as variable names in this language:

T    Total    TOTAL    TotalValue3    Value2009    XYZ

Produce a BNF definition for a variable name in this language.

[4]
   
(c) Name a type of diagram which could have been used instead to show the definition of a variable in this language. (There is no need to draw the diagram) [1]
   
 
[9](a) Many computer programs pass variables to a procedure.  
(i) What is the name for the variable passed in this way? [1]
   
(ii) During this operation, data is sometimes passed by reference. Variables can be passed by another method. Name the other method and explain how it operates. Explain one advantage of this method over passing by reference. [3]
   
(b)(i) Describe what is meant by a local variable in a computer program. [1]
   
(ii) Describe what is meant by a global variable in a computer program. [1]
   
(iii) Describe one benefit of using global rather than local variables. [1]
   
 
[10] There are many different types of programming language.  
(a) Describe what is meant by a non-procedural programming language and give an example of a suitable use for this type of language. [2]
   
(b) Describe circumstances under which a visual programming language will be particularly useful and give an example of a human computer interface (HCI) feature which could be produced easily in this type of language. [2]
   
(c) Describe what is meant by an application generator. [1]
   
 
[11](a) A compiler is often used to translate a source program to make it ready for execution. One stage of compilation is syntax analysis. Explain what happens during the syntax analysis stage. [2]
   
(b) In other cases, an interpreter is used instead of a compiler. Briefly explain how an interpreter works. [1]
   
(c) A debugging tool is often used while developing a computer program. Facilities available in the debugging tool may include:
  • program trace
  • break point
  • store dump

Explain each of these facilities.

[3]
   
 
[12] In the following question, additional credit (up to 3 marks) will be gained if your answer demonstrates skill in written communication.

When a new computer system is being developed, considerable care is taken over the design of the human computer interface (HCI). Modern HCIs often make use of speech recognition, handwriting recognition and speech synthesis.

Describe in detail the features of the three types of HCI named above, including their suitability for novice and handicapped users.

[9+3]