Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

August 1999
CP103 : COMPUTER PROGRAMMING

SECTION B [60 Marks]

Click here to access other sections
Section A
Front Cover

Click to access
SUGGESTED SOLUTIONS
for Section B

 

Answer ANY TWO questions in this section

 

1. (a) A linear search for a particular record in an array of records works as follows. Suppose that there are N student records (stud_rec) in a student file. A counter, 'i', is set to 1 to start searching from the first record. A flag, 'found', is set to false before searching starts. Once the target record is found, 'found' will be set to true so that the searching loop will be terminated.

There are two conditions for the loop : the first involves the value of 'found' and the other involves the value of 'i'. If both conditions are true, stud_rec[i] is compared with the target record. If there are equal, a message should be displayed giving the position of the target in the array. The value of 'found' is then set to true. If target is found, the value 'i' is incremented by 1 to go to the next record. The entire process is repeated until the value of 'found' is set to true or the value of 'i' no longer lies between 1 and N.

After the loop, the value of 'found' is checked: if it is false, a message is displayed saying that the target has not been found in the student file.

Construct a flowchart which describes the above linear search algorithm.

 

 

 

 

 

 

 

 

 

 

[16]

(b) Identify the three types of programmers in the programming group. For each, state two of the job responsibilities for members of that group.

 

[9]
(c)

(i) Explain briefly what a recursive procedure is .

(ii) Give one advantage and one disadvantage of using recursion as compared to iteration.

 

 

[3]

[2]

2. (a) Give two advantages of each of the following program design checking methods:

 

(i) Dry run

 

[2]
(ii) Structured walkthrough

 

[2]
(iii) Independent inspection

 

[2]
(b)

(i)Explain what is involved in Program Maintenance.

(ii) Give three actions programmers can take on to make program maintenance easier.

 

 

[4]

[3]

(c) An employee record is made up of the following fields :
Employee number
Employee date of birth
Employee address
Employee basic salary
Category of job (managerial or non-managerial)
Employee part job(s) history (designation and last drawn salary)

 

(i) Create a data structure diagram for the above record.

 

[9]
(ii) Explain two differences between data types and data structure, and give two examples of each.

 

[8]
3. (a) Explain what is meant by a test harness and a dummy stub. You may use the diagram below to help your explanation.

pic1.gif (3428 bytes)

 

[8]
(b)

(i) State the purpose of SQA.

(ii) List the major activities which are involved in SQA.

 

 

[2]

[7]

(c)

(i) Explain briefly the differences between limited entry and mixed entry decision tables.

(ii) Write brief notes to explain what is meant by a decision table preprocessor.

 

 

[4]

 

[4]

(d) Use pseudocode to construct a for-loop which prints out all odd numbers between 1 and 10.

 

[5]1