Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Sit 004 Question Paper

Sit 004 

Course:Bachelor Of Science In Information And Technology

Institution: Kenyatta University question papers

Exam Year:2010



KENYATTA UNIVERSITY
UNIVERSITY EXAMINATIONS 2009/2010
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE
(INFORMATION TECHNOLOGY)
SIT 004:
VISUAL PROGRAMMING
=================================================================
DATE: TUESDAY 20TH JULY 2010


TIME: 2.00 P.M. - 4.00 P.M.

INSTRUCTIONS
Answer Question One and Any Other Two questions

Question One
a) Briefly explain the importance of the following windows as used in visual basic IDE
i) Properties Window
ii) Toolbox
[4 marks]
b) Using relevant examples explain the following terms as used in Visual Basic
programming
i)
Method
ii)
Object
[4 marks]
c) Differentiate between each of following:
i)
Implicit and Explicit declarations
ii)
Dynamic and Static variables
iii) Intrinsic controls and ActiveX controls
[6 marks]
d) Write a Visual Basic program that inputs three integer numbers using Inputbox
dialogs and computes for the sum and average of the numbers after a click of a
command button. The program should display the sum and average by use of a
picture box control. Design your GUI
[8 marks]


Page 1 of 4

e)
i) Write a function procedure to calculate a simple interest when the principal, rate
and number of years have been passed to the function
[3 marks]
ii) Write a short program that makes use of the function in (i) above to calculate the
simple interest. Input the principal, rate and number of years using text boxes and
display the results of the program in a label control. Use the formula shown
below for simple interest calculation and design your graphical user interface.
P i
r ncipal * Rate *Time

Simple Interest =

100



[5 marks]
Question Two
a) Differentiate between a Sub procedure and a function procedure
[4 marks]
b) A GUI is required to allow the user calculate the area of a circle in Visual Basic. The
user is to type the value of the radius in a textbox. When the user clicks a command
button, the area should be displayed in a label control.

i)
Sketch a suitable GUI for the above and write down the properties that you
would set for all the controls in the above GUI and their values.
[4 marks]
ii)
Write a function that receives the radius and returns its area.
[4 marks]
iii)
Write a procedure that receives the area and then displays it.
[4 marks]
iv)
Write the appropriate click event procedure for the GUI. The event
procedure should call the above procedures.
[4 marks]
Question Three
a) State the major difference between each of the following:
i)
Text box and a Label
ii)
List box and a Combo box




[4 marks]

b) Define the term control structure.





[2 marks]

c) You are requested to write a short program that will be used in a school to calculate
the average mark out of five subjects. The average mark is used to determine the
grade the student gets. The grade is displayed by use of a message box dialog. The
grading system is shown in the table below


MARK
GRADE


0-49
Fail

50-64
C

65-74
B

75-100
A

Page 2 of 4


ii)
Sketch the graphical user interface assigning the appropriate properties
[2 marks]
iii)
Write the code for your program
[8 marks]
d) Explain briefly the following data types as used in visual basic
i)
Single
ii)
Currency



[4 marks]
Question Four
a) Write a simple code that performs each of the following
i) Change the background colour of a label to blue when the form is clicked
ii) Produce a tip when a mouse rests on a command button after running the
application
iii) Disable a command button when a command button is clicked
[6 marks]
b) Explain briefly the importance of comments in a program and indicate the two ways
of including comments in Visual Basic programs.
[3 marks]
c) Write a visual basic application that uses the RND and RGB functions to generate
colours randomly after an interval of time. The generated colour is displayed in
a picture box control. Design your GUI.



[6 marks)

d) By use of a text box, and a command button, write code in the click event of the
command button so that when a character is entered into the text box, it
determines whether the character is a vowel or a consonant by displaying a
suitable message. Design your GUI.




[5 marks]


Question Five
a) Briefly explain the significance of a menu in an application.

[2 marks]

b) i)
Explain how you would produce the following menu in an MDI form


Applications
Windows




Exit

Tile Horizontal




Tile Vertical
Use the format below

Menu Item
Name Property
Caption Property
No. Of Times
To Indent








[6 marks]


Page 3 of 4





iii)
Write the codes to be tied to the Tile Horizontal menu items to enable the
user to tile vertically the MDI child forms.

[4 marks]


c) By use of a horizontal scrollbar, label, picture box and command button controls,
write a program that accepts the temperature in Fahrenheit using horizontal scrollbar
control. Your program should indicate current value of the horizontal scrollbar control
in a label control and should be in the range of between 0 and 150. The program then
converts and displays the value of the temperature in Celsius using a picture box
control, after a click of a command button. Design your graphical user interface. Use
the following formula for conversion:

Celsius = 5/9*(Fahrenheit-32)


[10 marks]







Page 4 of 4






More Question Papers


Popular Exams



Return to Question Papers