Introduction To Programming APRIL 2019 - Revised
Introduction To Programming APRIL 2019 - Revised
INSTRUCTIONS
1. The Paper is made up of FIVE (5) Questions, question ONE is compulsory plus any other
TWO questions.
2. Credit is given for legibility, clarity of expressions and use of relevant illustrations.
3. Clearly write your registration number on each answer sheet used.
QUESTION 1
b) Give any four escape sequences and explain their use in a C program (4 marks) .
c) Name and explain the 3 types of errors found as you develop programs in C (6 marks)
d) Differentiate between the following: (4 marks)
Global and Local Variables
Signed and Unsigned Integers
e) Develop a C application that will prompt the user to enter His/her name then output the name with a
welcome message. (6 Marks)
Page | 1
QUESTION 2
a) Write an algorithm and flowchart of a program that reads three values, determines the largest value
and prints the largest value with an identifying message. (8 Marks)
c) list and explain three types of operators used in C programming. (6 Marks)
d) Write a program that will allow the user to input 2 numbers and compute the sum, product and
division. (6 Marks)
QUESTION 3
a) Explain the steps followed during the program development process in C programming( 8 marks)
b) With the use of illustrations explain the structure of a C program ( 6 marks)
c) Give any four rules followed in naming identifiers. ( 6 marks)
QUESTION 4
a) With the use of examples explain the difference between a while and do while loop. (6 marks)
b) Explain the different rules that have to be followed when using the switch statement (4 marks)
c) Explain the advantages/benefits of functions in structured programming (4 Marks)
d) State any 4 essentials of a counter controlled repetition (4 marks)
e) Differentiate between counter-controlled repetition and Sentinel-controlled repetition (2 marks)
QUESTION 5
a) Re-write the program below using a nested if statement. (10 marks)
#include<stdio.h>
#include<conio.h>
void main()
{
int choice;
printf("\n \t MENU");
printf("\n 1=chips");
printf("\n 2=rice");
printf("\n 3=matoke");
printf("\n enter your choice");
scanf("%d",& choice);
switch (choice)
{
case 1:
Page | 2
printf("\n you selected chips");
break;
case 2:
printf("\n you selected rice");
break;
case 3:
printf("\n you selected matoke");
break;
default:
printf("\n invalid choice");
}
getch();
}
b) Using the appropriate control statement write a program that accepts marks a student got in three
subjects and then computes the average mark. The program should then assign the student a grade
based on the average mark. The grading system is given below. (10 marks)
END
Page | 3