0 ratings 0% found this document useful (0 votes) 67 views 4 pages Structured Programing Module20001
The document is an examination paper for a Craft Certificate in Information Technology focusing on Structured Programming, issued by the Kenya National Examinations Council. It consists of two sections, with Section A containing mandatory questions and Section B offering a choice of questions. The paper covers various programming concepts, including C language syntax, data structures, and error handling, and includes practical programming tasks.
AI-enhanced title and description
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save STRUCTURED PROGRAMING MODULE20001 For Later 1920/203
STRUCTURED PROGRAMMING
July 2019
Time: 3 hours
THE KENYA NATIONAL EXAMINATIONS COUNCIL,
CRAFT CERTIFICATE IN INFORMATION TECHNOLOGY
MODULE IL
STRUCTURED PROGRAMMING
3 hours
INSTRUCTIONS TO CANDIDATES
This paper consists of TWO sections; A and B.
Answer ALL the questions in section A and any FIVE from section B in the answer booklet provided,
Candidates should answer the questions in English.
This paper consists of 4 printed pages.
Candidates should check the question paper to ascertain that all the
Pages are printed as indicated and that no questions are missing.
(©2019 The Kenya National Examinations Council. Turn overSECTION A (40 marks)
Answer ALL the questions in this section.
1. Outline four advantages of sub-programs in a computer program. (4 marks)
2. (@)_ State two classes of data types used in C language. (2 marks)
(b) Explain the concept of recursive function as used in programming. (2. marks)
3. A student wrote a program in C language. Outline four modes that the student would use to
‘open a data file in this program. (4 marks)
4. Write a program in C language that computes an absolute value of a given number. (4 marks)
S- With the aid of a diagram, describe a queue data structure...) -="" (4 marks)
6. Differentiate between machine and assembly languages as used in programming. (4 marks)
7. The following program was written by a student during a practical lesson. Use it to answer the
question that follows.
#include
main()
(
int x;
x=1;
do
{
printf£("x is %d\n”,x);
xt=l;
} while (x>10);
)
Explain the loop body. (4 marks)
8 Write a program in C language that prompts the user to enter the amount of fees paid. When
the amount of fees paid is less that Ksh 20,000 the program displays a message “Cyber services
denied’ (4 marks)
J. Distinguish between by value and by reference parameter passing as used in programming.
(4 marks)
10. Outline four characteristics of high level languages. (4 marks)
1920/203 2
July 20191. @)
)
©
@
2 @
()
©)
: @
2B. @)
()
©
(@)
1:
(b)
©)
1920/203
July 2019
SECTION B (60 marks)
Answer any FOUR questions in this section
&
Outline three reasons for compiling a program under development. (3 marks)
Write a program in C language that determines if a character entered is a vowel. The
program then displays an appropriate message. Use switch statement. (4 marks)
‘A student wrote a program in C language. Outline four programming styles he could
use to improve the readability of the program. (4 marks)
Differentiate between monolithic and modularity approaches to programming. (4 marks)
Outline two types of fest data used during program testing. (2 marks)
Explain two types of errors that are encountered when developing @ Program. (4 marks)
Write a program in C language that prompts a user to enter five different marks for a
test in an array. The program then computes and displays the average mark correct to
two decimal places. (5 marks)
Write a program in C language that generates the first ten positive numbers. Use a
pretesting loop other than the For loop. (4 marks)
Define each of the following terms as used in programming:
(i) __ Reserved word; (1 mark)
(i) Dry run; (1 mark)
(iii) Order of priority. (1 mark)
Write a program in C language that prompts a user to enter two integers. The program
then divides the bigger by the smaller integer provided it is not a zero through a
function, (5 marks)
Write an algorithm that could be used to add an element in a stack data structure.
(4 marks)
John compiled documentation for a program he wrote. Outline three parts of the
documentation that he could include to ease access to the information in the
documentation. 3 marks)
State two items contained in each of the following type of documentation:
@ System; (mpiler Smopred e¢ (2 marks)
Gi) Program. <0 (2 marks)
Outline two reasons a binary search technique is preferred. (2 marks)
Write a program segment in C language to assign each of the following:
() 15 to an integer variable x through a pointer p; (2 marks)
(ii) The address of a float type 16.54 variable x to a pointer pt_ (2 marks)
3 Turn over(a)
i {0)
(©)
@)
1920/203
July 2019
Table 1 show the employee monthly bonus in a manufacturing company based on sales.
Use it to answer the question that follows.
Sales Bonus Rate (%)
‘Above 50,001 15
Between 25,001 and 50,000 10
Between 1 and 25,000 5
Table 1
Draw a flowchart for a program that prompts a user to enter the employee’s basic salary
and sales. The program then calculates the gross salary and outputs employee’s basic
salary, gross salary and bonus. (5 marks)
Outline four advantages of using pseudo code during program design. (4 marks)
(i) Mary created a data file in a C program, When trying to read this data file the
fopen() returned NULL. Outline two possible causes ofthis. (2 marks)
Gi) Outline two functions that are used to randomly retrieve data in a'€ projram
data file F (2 marks)
Draw a binary tree with nodes labelled A to G. Generate each of the following:
(i) Two sets of siblings; DA (1 mark)
(ii) Twoancestors; a (1 mark)
i) Two forests. (1 mark)
The data input to a program array is as follows; 54, 33, 76, 23, 15. The data is to be
sorted in ascending order using the insertion sort method, Show all the steps to be taken
to sort this data. (4 marks)
- [8
v QHYS IS THE LAST PRINTED PAGE.