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

December 1999
CP103: COMPUTER PROGRAMMING

SECTION A [40 Marks]

Click here to access other sections
Section B
Front Cover

Click to access
SUGGESTED SOLUTIONS
for Section A

Answer ALL questions in this section

 

1. For each of the following stages of the System Life Cycle, give two notations that are used during the stage:

a) System Analysis [2]

b) Program Design [2]

.

[4]
2. State whether each of the following statements is True or False:

a) A procedure must always return one or more values to the calling module or program. [1]

b) Variable parameters are not changed by the procedures which use them [1]

c) Local variables can only be accessed by the procedures that declare them [1]

d) A linked list implemented using pointers is an example of a static data structure where the size of the data structure can change as the program runs [1]

e) Elements in an array are accessible only through their indexes/subscripts [1]

.

[5]
3. The following segment of pseudocode is intended to show the logic of the Improved Bubble Sort algorithm. Flag is a boolean variable that is used to control the number of passes taking place. Once all the items are sorted, the sorting process will terminate.

State what values - either true or false - should be used in locations (a), (b), (c) and (d). [4]

DO
   SET flag to (a)
   WHILE flag is (b)
       SET flag to (c)
       FOR i = 1 to N - 1
            DO
                IF item[i]>item[i+1] THEN
                    DO
                         Swap the value of the two items
                         SET flag to (d)
                    ENDDO
                ENDIF
           ENDDO
ENDDO

 

[4]
4.

a) The following fragment of JSP is not drawn correctly. Modules C and D should be within a selection construct depending on the condition C1. Explain the error in the diagram and give a corrected version. [5]



b) The following fragment of JSP is also not drawn correctly. It is intended that function 1 should be carried out before the selection condition is evaluated. Explain the error in the diagram and give a corrected version. [5]


[10]
5. The Personnel Department of XYZ Hospital has adopted a scheme of promotions for its assistant nurses (AN) and staff nurses (SN). It is based on the following rules:

R1 - If an AN has > 5 years working experience, they should be promoted to senior AN
R2- If an AN has >5 years working experience and has completed an SN course, they should be promoted to SN
R3- If an AN has completed an SN course, has >5 years working experience and has good management skill, they should be promoted to senior SN
R4- If an AN has completed an SN course and has good management skill, they should be promoted to SN

Copy the decision table below to your answer booklet and complete it, based on the information given. [Note: Make sure you use the correct notation] [4]

  R1 R2 R3 R4
>5 years working experience        
Completed SN course        
Management skill        
         
Senior SN        
SN        

Senior AN

       

[4]
6.

List four factors that greatly affect the ease of program maintenance. [4]

 

[4]
7.

a) State the main difference between High Level Languages and Fourth Generation Languages. [2]

b) State four different applications of Fourth Generation Languages. [4]

 

[6]
8.

State the level of correctness that can be achieved for a multiplication instruction, based on the following testing schemes:

a) Multiply 3 * 4 and check that the result is 12. [1]

b) Every possible pair of numbers is tested for both operands. [1]

c) Several values are tested, including the obvious problem values such as zero, largest positive and negative numbers and so on. [1]

[3]