BIT1303A BBIT 105  PROGRAMMING METHODOLOGY . KCA Past Paper

UNIVERSITY EXAMINATIONS: 2016/2017
EXAMINATION FOR THE DEGREE IN BACHELOR OF SCIENCE
IN INFORMATION TECHNOLOGY/
BACHELOR OF BUSINESS INFORMATION TECHNOLOGY/
BIT1303A BBIT 105 PROGRAMMING METHODOLOGY
MODE: DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: JULY, 2017 DURATION: 2 HOURS
INSTRUCTIONS: Answer QUESTION ONE and any other TWO questions

QUESTION ONE [30 MARKS]
a) Briefly explain the problem-solving steps with respect to programming.
[6 Marks]
b) Differentiate between debugging and profiling as used program testing.
[4 Marks]
c) Differentiate between compiled programming language and interpreted programming language.
[4 Marks]
d) Briefly describe four properties of a good program.
[4 Marks]
e) Briefly explain the use of a pre-processor in programming.
[2 Marks]
f) Explain the difference between a logical operator and a relational operator
[2 Marks]
g) Design a program using a flow chart to prompt the user to enter a score, then return a grade based on
the following criteria.

[5 Marks]
h) Briefly describe three ways of calling a function in C
[3 Marks]
QUESTION TWO [20 MARKS]
a) Briefly outline three types of information provided whenever a variable is declared in C.
[3 Marks]
b) Differentiate between a fatal and non-fatal error in a program. Give one example for each.
[4 Marks]
c) Briefly explain two operators that be used with pointers in C.
[2 Marks]
d) It is recommended that programmers should indent program statements properly, explain why this
necessary.
[3 Marks]
e) Write a C program to prompt the user to enter his user name and password then validate the values
and return the appropriate message using the criteria below.

[6 Marks]
f) Explain the difference between escape sequence characters and format specifiers in C.
[2 Marks]
QUESTION THREE [20 MARKS]
a) Briefly describe the three program control structures in structured programming.
[3 Marks]
b) Briefly explain two ways of creating a symbolic constant in C.
[2 Marks]
c) Briefly explain the difference between a for loop and a while loop.
[2 Marks]
d) Describe the difference between break and continue statements in a loop.
[4 Marks]
e) TWIGA Sacco allows its customers to make deposits in a savings account. The amount deposited
earns a 12% annual interest. Given that P is deposit, A is the amount accumulated in n years and r is
the interest rate. Write a C program that prompts the user to enter the initial P and n in years, then
computes A given that A=P x (1+r/100)n
.
[5 Marks]
f) 7marks Explain the difference between compile time and run time of a program.
[2 Marks]
g) Estimate the memory size allocated to the following arrays after compilation
i. Float num[2][4][6]
ii. Char T[4][2][2]
[2 Mark ]
QUESTION FOUR [20 MARKS]
a) Discuss the following user defined data types in C
i. Enumeration
ii. Typedef
iii. Union
iv. Array
[8 Marks]
b) Write a C program to store twenty floating numbers in an array, then display them in reverse order.
[4 Marks]
c) Explain the difference between order of precedence and associativity with respect to operators in C.
[2 Marks]
d) Explain the output of the following statements in C. Assume x=100 and y=23 that use bitwise
operators.
i. printf (“%d \n”, x>>2);
ii. printf (“%d \n”, y<<2);
iii. printf (“%d \n”, x&y);
[6 Marks]
QUESTION FIVE [20 MARKS]
a) Briefly explain three advantages of modularization in C.
[3 Marks]
b) Write a C program to prompt the user to key in a natural number, then calculate and display its
factorial.
[5 Marks]
c) Explain the user of formal parameters in a function.
[4 Marks]
d) A C program function be user defined or built-in. Explain the use of the following built-in functions
in C.
a. printf ()
i. strcat ()
ii. pow ()
iii. sqrt ()
[8 Marks]

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

Written by