BBIT 105BIT 1303A-PROGRAMMING METHODOLOGY.

UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR DEGREE OF BACHELOR SCIENCE/BUSINESS
INFORMATION TECHNOLOGY
BBIT 105&BIT 1303A-PROGRAMMING METHODOLOGY
MODE: FULL TIME/PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: JULY, 2018 DURATION: 2 HOURS
INSTRUCTIONS: Answer Question ONE and any other TWO questions

QUESTION ONE [30 MARKS]
a) Briefly explain FOUR programming paradigms.
4 Marks
b) Explain why you might want to write a program in a machine independent language instead of a
machine dependent language.
4 Marks
c) Program errors can be syntax, logical, linker or semantic errors. Classify the following errors.
i). Misspelling keywords. 1 Mark
ii). Dividing a number zero. 1 Mark
iii). Using undeclared variable. 1 Mark
iv). Misspelling function name. 1 Mark
d) Write a C program to receive two integers using pointers then calculate and display the sum of the
two integers.
7 Marks
e) Write a C program to store twenty natural numbers in a one dimensional array then calculate and
display the sum of the odd numbers that are members of this array.
7 Marks
f) Design a program using a flowchart to swap two values stored in two variables x1 and x1.
4 Marks
QUESTION TWO [20 MARKS]
a) Describe THREE basic data types in C while giving space occupied in memory by each.
6 Marks
b) Write a simple program to return memory addresses and size of the following variables:
i). int x; 2 Marks
ii). float y; 2 Marks
c) Describe TWO ways of creating a symbolic constant in C language
4 Marks
d) Write C statements for each of the following cases
i. Print three blank lines
ii. Read two integer values stored in variables a and b in one statement
iii. Display the value of a floating point variable in three decimal places.
6 Marks
QUESTION THREE [20 MARKS]
a) Using flowcharts, describe following program control structures characteristic of structured
programming.
i). Repetition structure
3 Marks
ii). Selection structure
3 Marks
iii). Sequential structure
3 Marks
b) Design a program using pseudo code to calculate and display the gross pay of fifty
employees given that gross pay=basic pay + allowances.
5 Marks
c) Implement the design in b) using C. The program should prompt the user to enter basic pay
and allowance, then calculate and display gross pay for all the fifty employees.
6 Marks
QUESTION FOUR [20 MARKS]
a) Differentiate between arguments and parameters as used in functions.
2 Marks
b) Design a program that uses functions to calculate the perimeter and area of a rectangle once
given dimensions. Hint: use a flowchart.
6 Marks
c) Implement the design in a) using C. The program should prompt the user to enter the
dimensions of the rectangle.
6 Marks
d) Write a program in c to pass an array containing age of a person to a function. The function
should prompt the user to enter age for all persons then find the average age and display the
average age in main function.
8 Marks
QUESTION FIVE [2 MARKS]
a) Discuss the four lexical elements of a C language.
4 Marks
b) You are required to write a program that uses structure called product whose members are
price and quantity. There are two objects (instances) of this structure namely soap and salt.
Assume price is of type float while quantity is of type integer.
8 Marks
c) Write a C program that uses two, one dimensional array to store 10 integers. Each of the element
stored in the first array is then modified by incrementing its value by 2 and the value stored in another
array. The program should display all the values in these two arrays.
8 Marks

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

Written by