BIT 1304 PROGRAMMING METHODOLOGY KCA Past Paper

UNIVERSITY EXAMINATIONS: 2012/2013
EXAMINATION FOR THE BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY
BIT 1304 PROGRAMMING METHODOLOGY
DATE: AUGUST, 2013 TIME: 2 HOURS
INSTRUCTIONS: Answer Question ONE and Any Other TWO Questions

QUESTION ONE
a) Explain four advantages of procedural programming [4 Marks]
b) What is an array? Explain any two types of arrays. [3 marks]
c) Write a program that will initialize an array with days of a week and prints their
names. [5 Marks]
d) Differentiate between source code and object code [2 Marks]
e). State four rules that are applied in naming variable [4 Marks]
f) Write a simple program that uses a for loop to print the numbers 1 through 10
[4 Marks]
g). Write java code statements to accomplish the following [4 Marks]
i) f the variable “Num” is not equal to 7, print “value not 7”.
ii) Print the message “this is a java program”.
g) Explain any FOUR programming methodologies [4 Marks]
QUESTION TWO
a) Using one statement for each and some explanation, illustrate how the following
string functions are implemented [4 Marks]
i) Substring
ii) indexOf
b) State and explain three categories of control structures. [3 Marks]
c) Write a program that displays employee IDs and first and last names of
employees. [4 Marks]
d) Explain purpose of „ new‟ operator . write java code that shows its usage in
programming. [3 Marks]
e) Explain the purpose for „++‟ and „- -„ operators. Write code that demonstrates
implementation of each case. [4 Marks]
f) Define what a „variable‟ is [2 Marks]
QUESTION THREE
a) Briefly explain the meaning of the following terms as used in java programming.
Give java code example for each case. [6 Marks]
i) Class
ii. Syntax error:
iii) concat
b) Draw a flow chart of the following Pseudo code [4 Marks]
if student’s grade is greater than or equal to 40
Print “adult”
else
if student’s grade is greater than or equal to 20
Print “youth”
else
if student’s grade is greater than or equal to 13
Print “teen ager”
else
if student’s grade is greater than or equal to 5
Print “toddler”
else
Print “baby”
d) Write a well commented program that prints the following output. [4 Marks]
Age is 20
Name is peter
Course is Bscit
e) Define the meaning of the term „comment‟. Explain three sections of a program
where comments can be used. [4 Marks]
c) Describe purpose of „return‟ keyword in a program. [2 Marks]
QUESTION FOUR
a) Explain three advantages of object oriented programming. [3 Marks]
b) Write a class named employee that instantiates a kcau_emp object from the class
you created. Prompt the a user to enter personal details such as idno, name,
occupation and then display all the values entered by the user. [6 Marks]
c) The final mark for a student is obtained by computing the sum of three continuous
assessment tests(CATs), two assignments and a final examination. Create a
program to execute this task. [7Marks]
d) Briefly describe the term „integrated development environment (IDE) tools. Give any
two examples [4 Marks]
QUESTION FIVE
a) A retail shop offers discounts on its merchadise to its customers as indicated in the
table below;


i) Write an appropriate algorithm to represent this problem. [4 marks]
ii) Write a program to calculate and display the amount payable a customer.
[5 marks]
b) Distinguish between high level and low level languages. Give one example for
each case [4 Marks]
c) Declare and initialize an array called TEMPERATURES to contain the following
values. [4 Marks]


d) Describe three different types of loops that are used in programming methodologies.
[3 Marks]

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

Written by