0% found this document useful (0 votes)
3 views4 pages

VB Exam

This document outlines the examination details for the COMP 329 - Visual Programming course at Kabarak University, including instructions for candidates and a breakdown of exam sections. Section A is compulsory and consists of various programming tasks and theory questions related to Visual Basic, while Section B allows candidates to choose two questions from a selection. The exam is scheduled for December 6, 2022, and covers topics such as GUI design, tax calculation, and error handling in Visual Basic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

VB Exam

This document outlines the examination details for the COMP 329 - Visual Programming course at Kabarak University, including instructions for candidates and a breakdown of exam sections. Section A is compulsory and consists of various programming tasks and theory questions related to Visual Basic, while Section B allows candidates to choose two questions from a selection. The exam is scheduled for December 6, 2022, and covers topics such as GUI design, tax calculation, and error handling in Visual Basic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

KABARAK UNIVERSITY

UNIVERSITY EXAMINATIONS
MAIN CAMPUS
THIRD SEMESTER, 2022 ACADEMIC YEAR
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
COMPUTER SCIENCE

COMP 329-VISUAL PROGRAMMING

STREAM: Y3S2-REGULAR TIME: 11:30-1:30PM


EXAMINATION SESSION: SEPT. –DEC. DATE: 6/12/2022

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]

e) Explain the usage of suffixes with literals.


[5 Marks]

f) Using a syntax and an example, explain how a constant is declared.


[5 Marks]

g) Design a GUI and write a code to explain the if statement.


[5 Marks]

SECTION B. TOTAL MARKS FOR THIS SECTION IS 40.


ANSWER ANY TWO QUESTIONS FROM THIS SECTION. EACH QUESTION IN
THIS SECTION CARRIES 20 MARKS.
2. a) Explain circumstances under which each of the following controlled are used in Visual
Basic.
i. Label [2 Marks]
ii. Radio button [2 Marks]
b) Write a program in Visual Basic program to calculate the volume of a cuboid given the
height as 10, length 20 and width 15. The results should be displayed on the label command.
[6
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]

3. a) A company computes tax from employee’s salary as follows;

SALARY TAX MESSAGE


Less than 10000 No Tax No Tax
10000 to 20000 10% Lowest Tax
21000 to 35000 15% Middle Tax
Above 35000 20% Highest Tax

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]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim myNumber As Integer
myNumber = TextBox1.Text
If myNumber > 100 Then
Label2.Text = “Congratulation! You win a lucky prize"
Else
Label2.Text = " Sorry, You dif not win any prize"
End If
End Sub
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 3 of 4
c) Write a code that explains thefore….Next loop. [5 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]

5. a) Using a radio button, develop a quiz program. [6 Marks]


b) Using checkbox in VB 2010, develop a shopping cart. [8 Marks]
c) Write a visual basic program where one enters age to confirm whether they are eligible
to vote or not. The confirmation message should pop up on a message box. [6 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

You might also like