TELONE CENTRE FOR LEARNING
Technical Department
CFL TE 1201: C Programming
Examination Model: May 2021
This examination paper consists of 4 pages
Time Allowed: 3 Hours
Total Marks: 100
Special Requirements: None
INSTRUCTIONS
1. Answer all the questions.
2. Questions can be answered in any order
3. Cheating or any attempt to cheat will result in disqualification
SECTION A
Answer all questions in Section A
Question 1
Define the following terms with relationship to C programming
a) Variable
b) Get(char)
c) Scanf
d) Data types
e) Pointers
f) Token [12]
Question 2
a) Give two examples on each of the following
i) Logical operators
ii) Conditional statements [6]
iii) Keywords
b) Use a suitable example to show any two rules to follow when declaring variables. [4]
c) What are Library functions in C? [2]
Question 3
a) Design a program that allows the following inputs to be entered one at a time in order
to display the information in the table below.
INPUT OUTPUT
H High temperature
N Normal
L Low temperature
Any other character Invalid input
[7]
b) Design a program to show your understanding of at least three bitwise operators you
have learnt. [5]
SECTION B
Answer any two questions in section B
Question 4
a) Write a program which prompts the user to enter their name, surname, program they
are doing, and then ask for a password from the user. The program must authorize or
deny access to the user. Use the password 1234. [10]
b) Show the above program using a flow chart or pseudo code or algorithm. [6]
Question 5
TCFL has decided to design a page where students can do online registration.
Design a program that you think must be used to design the page. The program must include
the following:
a) Age of student
b) Student ID
c) Fees paid
d) Name of program
[12]
e) Discuss why functions are needed in C programming. [4]
Question 6
a) Outline the differences between a structure and an array. [4]
b) Write a program to display all the even numbers inside the following array
x = {5, 4, 1, 23, 6, 54, 43}; [4]
c) For the above array x, write a program to find the sum of all the elements of this array
5+4+1+23+………43. [4]
d) Explain the use of the following string library functions
i) Strcat
ii) Strlwr [4]
SECTION C
Answer any three questions in Section C
Question 7
a) State the different types of functions you have learnt in C programming. [4]
b) Show how functions can be used to calculate the area and perimeter of a circle on a
single program. Use a function type of your choice.
[6]
Question 8
a) Show the syntax of writing the following
i) Do while loop
ii) Continue statement
iii) Else if [6]
b) State any four errors found in c programming. [4]
Question 9
Design a program that display the pattern below
@@@@@
@@@@
@@@
@@
@ [10]
Question 10
i) ‘C’ is middle level language – Comment. [6]
ii) What is escape sequence for vertical tab? [3]
iii) What is escape sequence for Null character? [3]