KIBABII UNIVERSITY COLLEGE
(A Constituent College of MasindeMuliro University of Science
Technology)
P.O. Box 1699-50200 Bungoma, Kenya
Tel. 020-2028660/0708-085934/0734-831729
E-mail: enquiries@kibabiiuniversity.ac.ke
UNIVERSITY REGULARY EXAMINATIONS
2012 /2013 ACADEMIC YEAR
FOR THE CERTIFICATE
OF INFORMATION TECHNOLOGY
(MAIN EXAMINATION)
COURSE CODE: ITC 017
COURSE TITLE: Visual Basic Programming
DATE: 22nd August, 2013 TIME: 200pm – 5.00pm
_____________________________________________________________________________
INSTRUCTIONS TO CANDIDATES
Answer Questions ONE and ANY OTHER TWO.
1
Q1)
a.)
i) Define the following terms as used in programming
1. Semantics
2. Syntax
3. Logic (6Marks)
ii) Describe any five importance of programming (5 Marks)
iii) Differentiate between the following as used in Programming
1. Procedure and Function
2. A variable and an Array (4 Marks)
b.) Consider the following marks achieved in a Form One class at Kibabii Mixed School in
a maths class : -
Name Mark Name Mark
John 53 Augustine 71
Hillary 88 Mark 62
Rose 44 Sabina 34
If the grading system was as follows:-
0 – 19 E 45 – 49 C– 65 – 69 B
20 – 29 D– 50 – 54 C 70 – 79 B+
30 – 39 D 55 – 59 C+ 80 – 84 A–
40 – 44 D+ 60 – 64 B– 85 – 99 A
Write a program that would allocate grades to the students mark, capturing situations that fall below the
0 and above 99 mark respectively as “Not Applicable”. Use the select case decision making construct
(5 Marks)
c.) Consider the following program:-
Private Sub Command1_Click()
Dim x As integer
x=10
Do
2
x=x+1
debug.print x
loop Until x>1
End Sub
i) State the output of the above program (2 Marks)
ii) Identify and state the type of error committed in the above program. Correct it so
that it can print values from 10 to 1 in that order. (3 Marks)
d.) Write a program that implements a two dimensional array, to hold the values in the table
below:-
45 87 45 28
34 56 84 71
65 43 23 96
Use the For … Next iterative control construct. (5 Marks)
Q2 (a)
i) Giving appropriate examples, define a Procedure as used in programming (3 Marks)
ii) Differentiate between a Private and a Public Procedure (2 Marks)
iii) Write a procedure that would change the background of a textbox to blue color (2 Marks)
iv) Define a function as used in programming (2 Marks)
v) Differentiate between a Public and a Global Function (2 Marks)
vi) Write a simple function that would divide any two values requested from the user.(4 Marks)
Q2)
i) Differentiate between Integer and Double data types as used in visual Basic (2 Marks)
ii) Briefly describe the three types of control structures used in visual basic programming.
(9 Marks)
iii) Draw a flow chart diagram that shall implement the if … elseif … else control construct
(4 marks)
3
Q3)
a.) Differentiate between the Do while … loop and the Do … loop until control
constructs ( 4 marks)
b.) Draw a flow chart diagram that would implement the do … loop until control
construct. (2 Marks)
c.) Using the for … next loop control construct, write a program that would print
even numbers between 0 – 20 in descending order. (4 Marks)
d.) State and explain the output of the following program. (5 Marks)
Private Sub Command1_Click()
Dim x As Integer
x=0
while x<=10
If x=8 then
goto Ruka:
end if
x=x+2
debug.print x
wend
Ruka:
While x<=20
x=x+1
debug.print x
wend
End Sub
define the term array as used inprogramming (2 Marks)
giving examples, describe any two types of arrays (4 Marks)
Re-Write the following program using the for … next iterative construct (5 Marks)
Private Sub Command1_Click()
Dim Array_Values as Integer
Dim y As Integer
Dim z As Integer
y=0
z=0
while y<=2
while z<=4
select case y
case is =0
x(y,z)=z+1
case else
4
if z=0 then
x(y,z)=y+1
else
x(y,z)=x(y,(z-1))+(y+1)
end if
end select
z=z+1
wend
y=y+1
wend
End Sub
c) Write a program that implements the following two dimensional array, performing the required
operations to achieve values as shown below (5 Marks)
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15