UNIVERSITY EXAMINATIONS: 2020/2021
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY / BUSINESS I. T/ APPLIED COMPUTING/
INFO. SECURITY & FORENSICS/ SOFTWARE DEV.
BIT 1210/BBIT 1210/BCT 1104/BAC 1203/ BISF 1203/ BSD 1203:
PROGRAMMING METHODOLOGY/ INTRODUCTION TO
PROGRAMMING
FULLTIME/ PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: DECEMBER, 2021 TIME: 2 HOURS
INSTRUCTIONS: Question ONE IS COMPULSORY, Choose TWO OTHER Questions
QUESTION ONE (20 marks) Compulsory
a). Using examples explain the relational operators used in a C program 6 marks
b). Write a program to convert Celsius values to Fahrenheit using the following formula fahr =
(9.0/5.0) * celsius + 32.0 8 marks
c). Using examples differentiate between the division operator and the modulus operator
4 marks
d). Define the term variable and explain how a variable is declared using appropriate examples
2 marks
QUESTION TW0 (15 marks)
a). Define the term program 1 marks
b). Differentiate between
i) source code and object code
ii) Compiler and Interpreter
iii) Syntax and Semantic error 6 marks
c). Examine the benefits provided by High-level programming languages 4 marks
d). Explain the main features of an algorithm 4 marks
QESTION THREE (15 marks)
a). Write a program for printing prime numbers between 1 and 100 6 marks
b). List five basic data types used in C programming language 5 marks
c). Explain any four components of a C program 4 marks
QUESTION FOUR (15 marks)
a) Describe using examples the syntax for following control structures:
i) do while. (2 Marks)
ii) while loop. (2 Marks)
iii) Switch statement. (2 Marks)
b) A program is required to accept two numbers A and B, if the value of A is greater than the
value of B then they are added together otherwise the value of A is subtracted from B.
Required:
i) Write an algorithm to represent your solution (3 Marks)
ii) Write a program in C programming language to accomplish the above. (6 Marks)