UNIVERSITY EXAMINATIONS: 2014/2015
ORDINARY EXAMINATION FOR THE BACHELOR OF SCIENCE
IN INFORMATION TECHNOLOGY/BUSINESS INFORMATION
TECHNOLOGY
BIT 1303A BBIT 105 PROGRAMMING METHODOLOGY
DATE: DECEMBER, 2014 TIME: 2 HOURS
INSTRUCTIONS: Answer Question ONE and any other TWO
QUESTION ONE
a) Define the following as they apply to programming
i). Flowchart
ii). Pseudocode
iii).Object code
iv). Pointer
v). Pre-processor directive [5 marks]
b) Name any four rules adopted in naming variables [2 marks]
c) A program is required to calculate and output the sum and product of all odd integers
between 39 and 87 inclusive.
As part of your solution to the problem above, write:
a) An algorithmic solution for your answer
b) Draw a flow chart to represent this [5 marks]
d) Differentiate between the following
a) Keyword and identifier
b) Function prototype and function definition
c) define and include preprocessor commands [6 marks]
e) Write a program segment that does the following;
a) Initialize the 5 element of an integer array count to zeros
b) Add 2 to each of the 5 elements of the array count
c) Print the 5 values of the array count sorted in ascending order
[9 marks]
f) Differentiate between a struct and a Union. [2 marks]
g) Define a pointer showing how an describing how and integer pointer is initialized.
[1marks]
QUESTION TWO
a) Make a structure declaration for an ACCOUNT with the following members
Accno
Balance
Acc_name [4 marks]
b) Using the structure defined above, write a statement that creates a structure variable
called Saving_Account. [2 marks]
c) Using the variable, write a program segment to perform the each of following
i). Access the structure member balance and assign to it the value 200
ii). Read a name through the keyboard and store it in the address for account
name. [5 marks]
d) Define what you understand by the following concepts
i). Modular programming
ii). Structured Programming [4 marks]
e) Explaining whether the following statements are valid or invalid
i). int =0 total;
ii). float total@
iii).sum+=k;
iv). define const pi 3.14;
v). include “c:\first.c” [5 marks]
QUESTION THREE
a) Structured programming is characterized by the following;
i.) Variables
ii.) Control structures
iii.) Assignments
iv.) Modules
Explain the role played by each of the above feature. [16 marks]
b) List and briefly explain 2 ways that data is shared in C [4 marks]
QUESTION FOUR
a) A program is required to compute the sum of even numbers between 30 and 366.
i.) Write a pseudocode as part of the solution to this problem
ii.) Draw a flowchart to depict solution to the problem
iii.) Implement the above using C. [8 marks]
b) Explain with a diagram how a while control construct differs from a do while
[4 marks]
c) Give one similarity and 3 differences between a compiled and interpreted Language
[4 marks]
d) Define what a comment is in C and their importance. [4 marks]
QUESTION FIVE
a) Define the following
i.) Function prototype
ii.) Function call
iii.) Function definition [6 marks]
b) Write a program that can be used to get the area and volume of a cylinder (Hint:
area=2 PI r(r + h) and volume=PI r2 h)
As a solution to the problem, write a function AREA and VOLUME to return the
respective values. These functions are called via main ()
[11 marks]
c) Define the following
i.) Syntax
ii.) Semantic
iii.) Programming Language
[3 marks]