SECTION A
Question One
a. With regards to structured programming, write short note on the following
I. Functions:
A function is a portion of a program which can be called to perform a task and the return to the
calling program
II. Methods:
Method is a procedure associated with a message and an object.
III. Structured code:
Structured code is a unique pattern of execution of a specific set of instruction.
b. Outline the various component of stepwise refinements
i. System ii. Sub System iii. Procedures IV. Programs
c. Briefly explain the use of white box, gray box, and black box testing in structured
programming.
i. White Box Testing: it is used to test the internal workings of an application.
ii. Gray Box Testing: Used to test the internal workings of an application and the also
examines the functionality of an application
iii. Black Box Testing: this is used to examine the functionality of an application with
peering into it internal workings.
Question Two:
Consider the program segment below. What outputs would be produced if the following
inputs are provided for a, b, c clearly show your work
a. i. output => cout <<”Y”
ii. output => cout <<“X”
iv. output => cout << “Y”
b. What are the advantages of modularization in programming language?
I. Easier to debug
II. Reusable code
III. Readability
IV. Reliability
c. Explain the roles of the following keywords/commands in a C++ program
i. #include: for importation of program libraries.
ii. Break: to stop a function call (paused)
iii. Return: Return or send a value when called or invoked
iv. Continue: To continue a program after a brief pause
Question Three:
3a. functions and procedures in structured programming languages often accept Parameter with
relevant examples and illustration. Distinguish between parameter passed by value and passed by
reference:
Parameter by Value:
1. The caller and callee have two independent variables with the same value.
2. You are making a copy in memory of the actual parameter‘s value that is passed in, a copy of
the content of the actual parameter.
Parameter by Reference:
1. The caller and the callee used the same variable for the parameter.
2. A copy of the address of the actual parameter is stored.
3b. Rewrite the following code in two ways using a for loop structure and while structure.
FOR LOOP:
Try{
myTag
for(int A1=1; A1<= 5; A1++){
cin >> B!;
cout <<(B1*B1)<< endl;
GOTO mytag;
}}
WHILE LOOP
A1=1;
myTag
while(A1<= 5){
cin >> B!;
cout <<(B1*B1)<< endl;
A1 ++;
GOTO mytag;
}}
SECTION B
Question Four:
Discuss the term software crises and outline the various ways in which this crises manifested
4a. Software crisis is a term used in the early days of computing science for the difficulty of writing
useful and efficient computer programs in the required time. Software crisis was due to the rapid
increases in computer power and the complexity of the problems that could be tackled. With the
increase in the complexity of software, many software problems arose because existing method were
insufficient.
WAYS SOFTWARE CRISIS WAS MANIFESTED
1. Project running over budget
2. Project running over time.
3. Software was very inefficient.
4. Software was of low quality.
5. Software often did not meet requirement
6. Software was never delivered.
4b. Discuss briefly the contribution of professor Dijkstra as one of the following advocate of structured
programming
Dijkstra was the first who succeeded in formulating his ideas on the subject in a way which was
understood and which initiated a wide discussion. The quality of programmers is a decreasing function
of the density of GOTO statement in the program they produce.
Question Five:
5a. Describe any three (3) principal Techniques employed with the aim of advancing structured
programming.
1. Restriction.
2. Abstraction.
3. Step-wise refinement.
4. Notation
5b. According to Gries remark…”almost none of the elementary programming books say anything
about problem solving” while Dijkstra explicitly described the task of writing correct programs as an
intellectual problem. Discuss.
Gries remark is in regards to the fact that the real bottle neck in software development was not efficient
coding but structuredness, or efficient problem solving which led to Gries to make the remark.
Dijkstra remark was as results of the fact that the art of programming is the art of organizing complexity,
of mastering multitude and avoiding its bastard chaos as effectively as possible.
6a. Describe the major shifts of emphasis in software engineering that was put forward by Donaldson
(1973) in line with Naur’s 1966 prediction.
The primary requirement to be met in software engineering has always been to perform the function
specified for the software. But at one time, secondary emphasis was placed only on software efficiency
that is core and time required. Today three other factors are recognized as requiring special emphasis.
These factors are reliability, maintainability, extensibility.
6b. From (a) above, point out the four (4) Major Reason for the Occurrence of Changed described
hitherto.
1. The machine is today no longer the most expensive link in programming.
2. Software simplicity has become more important than hardware.
3. The average lifetime of software has increased.
4. Multiprocessing system.