# BIT1303A BBIT105 PROGRAMMING METHODOLOGY.

UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR THE DEGREE IN BACHELOR OF
SCIENCE IN INFORMATION TECHNOLOGY/
BACHELOR OF BUSINESS INFORMATION TECHNOLOGY
BIT 1303A/BBIT 105: PROGRAMMING METHODOLOGY
MODE: FULL TIME/PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: NOVEMBER 2017 DURATION 2 HOURS
INSTRUCTION: Answer question ONE and any other THREE questions

QUESTION ONE (30 MARKS)
a) Explain why organizations and software developers are interested in searching for more
efficient ways to perform the software development process. (3 Marks)
b) Explain the following concepts in programming with the help of examples
i. Relational operator
ii. Variable
iii. Assignment
iv. Associativity (4 Marks)
c) Explain FOUR advantages of using functions in structured programming. (4 Marks)
d) Discuss any FOUR rules for naming variables, constants and arrays (4 Marks)
e) An algorithm is a list of instructions to be executed independently of any specific computer.
Discuss any THREE characteristics of a well-designed algorithm (6 Marks)
f) Study the following algorithm carefully and write a program in C to implement the design:
1 START
2 Declare structure SHAPE
3 Declare structure members length and width
4 Instantiate structure objects rectangle and triangle
5 Get values of length and width for each object
6 Calculate and display area of the rectangle as length
×width
7 Calculate and display area of triangle as 0.5x
(length× width)
8 STOP
(9 Marks)

QUESTION TWO (20 MARKS)
a) Differentiate between a pointer and array. (2 Marks)
b) Describe the TWO pointer operators in C. (4 Marks)
c) A person specialized/ trained in the technique of creating, maintaining and modifying
computer programs. Briefly describe THREE types of programmers (3 Marks)
d) Differentiate between user defined and built-in functions. (4 Marks)
e) Study the program design below, and then implement the design using a C program.
1 START
2 Define function ADD() to receive array
reference
3 Define function main()
4 Declare an array nums[] to store 12 integers
5 Get values of the 12 integers
6 Pass the array nums[] by reference to function
7 Calculate the sum for the 12 integers
8 Return the answer to the main function
9 STOP
(7 Marks)
QUESTION THREE (20 MARKS)
a) Explain why you might want to write a program in a machine independent language instead
of a machine dependent language. (4 Marks)
b) Explain the role of each of the following translator programs.
i. Compiler
ii. Assembler (4 Marks)
c) Explain any SIX criteria that can be used to evaluate programming languages. (6 Marks)
d) Using appropriate examples, explain the following control structures:
i. Sequence
ii. Decision
iii. Iteration (6 Marks)
QUESTION FOUR (20 MARKS)
a) Write appropriate C statements for:
i. Decrementing a variable by 1
ii. Setting up a constant PAYRATE as 1000.00 using define a preprocessor directive.
iii. Test if age is below 18 or above 65
iv. Display a number called “result” rounded off to 3 decimal places
v. Print five blank lines, then print the message “its over” (10
Marks)
b) Define the modulus operator. Explain the limitations of using this operator. (5 Marks)
c) A simple program is required which divides two integers entered by the user and displays the
result under the following conditions.
 If one of the two integers is zero then result will not be displayed but the program should
not terminate.
 If any of them is negative then the program should terminate.
Design an algorithm for this program in the form of a flowchart or pseudocode (5 Marks)
QUESTION FIVE (20 MARKS)
a) Write a C program that uses nested for loop to print the following Floyd’s triangle:
(6 Marks)

C
C p
C pr
C pro
C prog
C progr
C progra
C program
b) Discuss any FOUR characteristics of 4th generation programming languages (8 Marks)
c) For each of the following built-in functions in C, explain the use. Assume x is the argument.
i. sqrt(x)
ii. log(x)
iii. pow(x) (6 Marks)

(Visited 20 times, 1 visits today)