UNIVERSITY EXAMINATIONS: 2016/2017
EXAMINATION FOR THE DIPLOMA IN BUSINESS INFORMATION
TECHNOLOGY
DBIT303 COMPUTER PROGRAMMING CONCEPTS
DATE: AUGUST, 2017 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.
QUESTION ONE [30 MARKS] – COMPULSORY
(a)Outline five benefits of high level programming languages over low level programming
languages [5 Marks]
(b)Using examples differentiate between logic and semantic errors [4 Marks]
(c)State the meaning of the following expressions: – [3 Marks]
(i) j++
(ii) j- –
(iii)a%b
(d) (i) Design a pseudo code design for a C program that prompts the user to enter the student
mark. The program should then grade and display the student grade. [6 Marks]
Page 2 of 4
Note: Use the grading criteria provided below:-
Student Mark Grade
(ii) Using If ..…Else statements, write C code to implement your program design in question
1d(i) above [8 Marks]
(e) Explain the following terms as used in programming: – [4 Marks]
(i) Source code
(ii) Object code
(iii)Compiler
(iv)Programming
QUESTION TWO [20 MARKS]
(a) Create a function named area( ), that accepts the base and height as arguments and returns the
area of a triangle given that trianglearea formula =1/2 *base*height [6 Marks]
(b)State whether the following statements are true or false: [3 Marks]
(i) Keywords can be used as variable names
(ii) Variable names can contain digits
(iii)Variable names do not contain blank spaces
(c)Using examples, explain the following terms as used in a C program:-
(i) Preprocessor directive [2 Marks]
Page 3 of 4
(ii) Comments [2 Marks]
(d)Briefly discuss the four basic C data types used to declare variables [4 Marks]
(e)Using 3.14 as the value for constant PIE, demonstrate how you would create symbolic
constant. [3 Marks]
QUESTION THREE [20 MARKS]
(a) Explain why the main() function is special in a C program [3 Marks]
(b) (i) Define the term operator precedence [2 Marks]
(ii) Using the principles of operator precedence, evaluate the expression below: [6 Marks]
X=3.0/2+5*4.0/2.0
(c) List four benefits of using functions in programming [4 Marks]
(d) List and explain five factors you would consider while selecting a programming language
[5 Marks]
QUESTION FOUR [20 MARKS]
(a) With the aid of illustrations, describe the following control structures:-
(i) Sequence [4 Marks]
(ii) Branching [4 Marks]
(b) Outline two benefits of using comments in a C program [2 Marks]
(c) State two functions of a compiler [2 Marks]
(d) With the aid of a diagram, describe the top down approach to program development.
[4 Marks]
Page 4 of 4
(e) Identify the errors in each of these statements: – [4 Marks]
X,Y are integers, p,q are floats
(i) printf(“welcome”;
(ii) scanf(“%d”,&p);
(iii)scanf(“%d”,x);
(iv)scanf(“%f”,&Q);
QUESTION FIVE [20 MARKS]
(a) Write a program to convert Kenyan shillings to USA dollars when the user inputs the amount
in Kenyan shillings.(Let Kshs.96=1 USA dollar). The program should display the amount in US
Dollars. [8 Marks]
(b) Explain four features that have made C a popular programming language amongst computer
programmers [4 Marks]
(c) Giving appropriate examples, explain the following operators supported by C: – [6 Marks]
(i) Arithmetic
(ii) Relational
(iii)Logical
(d) Outline two benefits of using functions in a C program [2 Marks]