ITC-017-Visual-Basic-Programming-Final-Exam
ITC-017-Visual-Basic-Programming-Final-Exam
OF INFORMATION TECHNOLOGY
(MAIN EXAMINATION)
COURSE CODE: ITC 017
INSTRUCTIONS TO CANDIDATES
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 : -
John 53 Augustine 71
Hillary 88 Mark 62
Rose 44 Sabina 34
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)
Dim x As integer
x=10
Do
2
x=x+1
debug.print x
End Sub
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
Q2 (a)
iii) Write a procedure that would change the background of a textbox to blue color (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
Re-Write the following program using the for … next iterative construct (5 Marks)
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