UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE
IN APPLIED COMPUTING
BAC2308 ADVANCED APPLICATION PROGRAMMING
DATE: AUGUST 2019 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.
QUESTION ONE (30 MARKS) COMPULSORY
a) Write a function in VB.net that can be used to calculate the balance (change) to be
given back to a customer after purchasing goods in store. The purchase should include at
least 5 items. 15 Marks
b) Write a program that can be used to call the above function and display amount given,
total purchased and change to be given in VB.net 5 Marks
c) Briefly describe the terms below
(i) Option strict
(iii) Explicit Declaration 6 Marks
d) VB has two different types of constants describe them using examples 4 Marks
QUESTION TWO (20 MARKS)
Roberta must decide which courses to register for in the upcoming semester. She has a
part-time job and is waiting to find out how many hours per week she will be working
during the semester.
· If she works 10 hours (or less) per week, she will register for three classes.
· If she works more than 10 hours per week she will register for only two classes.
· If she receives the scholarship for which she has applied, she will quit her job and
take five classes.
Hours worked is entered into a TextBox control named HoursTextBox. A CheckBox
control named ScholarshipCheckBox will be checked if she gets the scholarship. Display
the number of classes for which she will register to a TextBox control
QUESTION THREE (20 MARKS)
a) i) Define the VB intelligence 2 Marks
ii) Explain why you would prefer it for typing code to an ordinary text editor
b) Explain what is accomplished by the code statements below
Dim MyVariable as String
MyVariable = Combobox1.Text
MsgBox MyVariable 6 Marks
c) Define a module. Visual Basic stores code in three different modules. List and explain
these modules. 8 Marks
QUESTION FOUR (20MARKS)
a) Write a programme that does the following:
1. Asks users to enter a number between 10 and 20.
2. The number will be entered into the Textbox.
3. When the Button is clicked, your Visual Basic code will check the number
entered in the Textbox.
4. If it is between 10 and 20, then a message will be displayed.
5. The message box will display the number from the Textbox.
6. If the number entered is not between 10 and 20 then the user will be invited to try
again, and whatever was entered in the Textbox will be erased
b) Add a Combo box and another button to your form. Create a list of items for your
Combo Box. The list of items in your Combo box can be anything you like – pop
groups, football teams, favourite foods, anything of your choice. Then try the
Use a select case statement to test what a user has chosen from your drop-down
list. Give the user a suitable message when the button was clicked.
QUESTION FIVE (20 MARKS)
a) Using examples to illustrate describe the use of the Globalization enumeration
method in Vb.net 6 Marks
b) Describe using an example in VB the use of ToUpper and Tolower methods
c) Using sample VB code declare a module-level array and store values to the array
immediately. 8 Marks