VB Exam
VB Exam
UNIVERSITY EXAMINATIONS
MAIN CAMPUS
THIRD SEMESTER, 2022 ACADEMIC YEAR
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
COMPUTER SCIENCE
INSTRUCTIONS TO CANDIDATES
1. Answer Question 1 and any other two questions in the answer booklet provided.
2. Do not write on your question papers. All rough work should be done in your
answer booklet.
3. Clearly indicate which question you are answering.
4. Write neatly and legibly.
5. Follow all the instructions in the answer booklet
As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart,
Jesus as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 1 of 4
SECTION A: (COMPULSORY) TOTAL MARKS FOR THIS SECTION IS 30.
1. a) i. Describe the term “Visual programming language.” [2 Marks]
ii. Outline three examples of visual programming language other than visual basic.
[3
Marks]
b) State two events associated with a form object in Visual Programming. [2 Marks]
c) The body mass index (BMI) of a person is computed based on the body weight in
kilograms and the body height in meters using the formula weight/height2. Write a Visual Basic
program that allows a user to enter the weight and height text boxes to compute the BMI. The
result should be displayed on a label box. [6 Marks]
d) Write a code that will change the backcolor of a form.
[2 Marks]
As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart,
Jesus as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 2 of 4
c) Develop a GUI write a VB code to implement a simple traffic light system.[6 Marks]
d) Write a VB code to wish Ken a happy birthday. [4
Marks]
Write a Visual Basic program that will accept salary of an employee through a textbox
that will calculate salary less than the tax to be paid using an If....Then....else
statement and the result should be displayed on a label box. [8
Marks]
b) State the syntax of an if statement. [3 Marks]
c) Study the code below and design a GUI and an output for it. [4 Marks]
4. a) Error handling is an essential procedure in Visual Basic 2010 programming that helps
make a program error-free. Write the syntax for Try….Catch…… End Try Structure.
[4
Marks]
b) Design a GUI and write a VB code to develop a shopping Cart. [6 Marks]
c) Using an example, explain the usage of GoTo syntax in error handling. [6 Marks]
d) Study the the following output and write a corresponding VB code. [4 Marks]
As members of Kabarak University family, we purpose at all times and in all places, to set apart in one’s heart,
Jesus as Lord. (1 Peter 3:15)
Kabarak University is ISO 9001:2015 Certified
Page 4 of 4