DBIT303  COMPUTER PROGRAMMING CONCEPTS.

UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR THE DIPLOMA IN BUSINESS INFORMATION
TECHNOLOGY
DBIT303 COMPUTER PROGRAMMING CONCEPTS
FULLTIME
DATE: APRIL, 2018 TIME: 1 ½ HOURS
INSTRUCTIONS: Answer ANY THREE questions.

QUESTION ONE [20 MARKS]
(a) Describe five factors to consider when selecting a computer programming language[5
Marks]
(b) Outline four benefits associated with modular programming [4 Marks]
(c) State three differences between a compiler and an interpreter [3 Marks]
(d) Given that X=30 and Y=5, determine the output when each of the following statements are
executed in C: [6 Marks]
(i) X++
(ii) Y- –
(iii)X%Y
(e) Write a C program that gets three names (Firstname, surname and lastname) from the user
via the keyboard. The program should then display the user entered names via the monitor
[8 Marks]
(f) Explain two features of C programming language [4 Marks]
QUESTION TWO [20 MARKS]
(a) List and briefly explain four data types supported by C language [8 Marks]
(b) Explain why the main function is critical in any C language program. [2 Marks]
(c) Write a C program that calculates and outputs the area of a circle given that:-
circleArea=3.14*radius*radius [7 Marks]
(d) Give three examples of operators used in C programming language [3 Marks]
QUESTION THREE [20 MARKS]
(a) Outline three benefits and two disadvantages of using functions in C programming language
[5 Marks]
(b) List and explain three control structures used in C programming language [6 Marks]
(c) Write a pseudo code description for a C program that prompts the user to enter the student
mark; the program should then grade and display the student grade [9 Marks]
Note:-Use the student mark grading criteria provided below:-

QUESTION FOUR [20 MARKS]
(a) Write a pseudo code Algorithm for a program that read the values A,B, and C and displays
the values of X where X=a/b-c [6 Marks]
(b) Using examples, distinguish between syntax and logic errors [4 Marks]
(c) Give reason(s) why the following identifier names are not valid:- [5 Marks]
(i) 23mark
(ii) gross pay
(iii)#total
(iv)int
(v) TotalAmount
(d) Explain the following terms:- [5 Marks]
(i) Programming
(ii) Comments
(iii)Keyword
(iv)Programming language
(v) constant
QUESTION FIVE [20 MARKS]
(a) Write a C program to convert Kenya shillings to USA dollars when the user inputs the
amount in Kenya shillings. (Let kshs.120=1 US Dollar).The program should display the
amount in US Dollars. [8 Marks]
(b) C programs have the features mentioned below. State the role of each, giving an example:-[3
Marks]
(i) Comment
(ii) Keyword
(iii)Input statement
(c) Identify the errors in each of these statements: [5 Marks]
X, y are integers, p, q are floats:
(i) printf(welcome!”;
(ii) scanf(“%d”,&p);
(iii)scanf(“%d”,x);
(iv)scanf(“%f”,&Q);
(v) printf(”%d”,&y);
(d) Write C statements for:- [4 Marks]
(i) Setting up a constant PAYRATE as 400 using the define preprocessor
(ii) Test if age is below 23 or above 45
(iii)Decrementing a variable count by 1
(iv)Declare a variable named salary whose data type is float

(Visited 83 times, 1 visits today)
Share this:

Written by