NATIONAL UNIVERSITY OF SCIENCE AND TECHNOLOGY
FACULTY OF APPLIED SCIENCES
MAY EXAMINATIONS 2011
SUBJECT: VISUAL PROGRAMMING CONCEPTS AND DEVELOPMENT
CODE: SCS1206
INSTRUCTIONS TO CANDIDATES
This paper consists of five questions. Answer any four questions.
All questions carry equal marks
Time: 3 hours
QUESTION ONE
a) (i) The following code can be used to declare variables in Visual
Basic.net
Dim password As String, Name&surname As String, first_num As
Integer
What is wrong in this declaration and why? [5]
b) Figure 1 shows the Graphic User Interface designed to compute
examination grades based on the marks that a student obtained.
Figure 1
A student who gets 80 or above gets a D . A student who gets 70 and above, gets a 2:1.
One who gets 60 and above gets a 2:2. One who attains between 40 and 59 gets a P.
Anyone who get less than 40 has a P as a grade.
1
With the above information, write the decision making code and show your
object property table. [20]
d) Explain what an event is and give two examples of events in Visual
Basic.NET. [3]
QUESTION TWO
a) What does the following program do? Explain the meaning of each line of
the code snippet.
Do while counter <=1000
num.Text=counter
counter =counter+1
Loop
[10]
b) Explain what the following are used for in Visual Basic.net
(i) Text box
(ii) List box
(iii) Label
(iv) Combo box
(v) The control with an icon shown below.
[10]
c) (i) Which numeric data type has a range of values 0 to 255? [1]
(ii)What are the main differences between an option button control and a
check box? [4]
2
QUESTION THREE
a) What are the different ways of starting Visual Basic.net [4]
b) Giving a suitable example, explain what user defined data types are.
[5]
c) Why is Visual Basic.net called an Object Oriented Programming Language?
[10]
d) Define the following as applied to programming:
(i) DLL
(ii) A bug [4]
b) What do you find on a Visual Basic.net IDE toolbox? [2]
QUESTION FOUR
The following, Figure 2 is a small calculator designed in Visual Basic.net
Figure 2
a. Write code that will create a similar calculator. The calculator should allow the
operation add (+), subtract, (-), multiply (*) and divide (/). Your code
should include clearing of the display in case of erroneous data entry using
the button clear. [20]
b. Write a Visual Basic.net code to connect to a Microsoft Access Database.
[5]
3
QUESTION FIVE
a) Give a detailed description of a Visual Basic.net IDE and its components.
[10]
b) Outline steps to create the form shown in Figure 3 below and write
Visual Basic.net code to calculate the sum of two numbers. [15]
Figure 3
END OF QUESTION PAPER