Q1. What do you understand by event driven programming? List and explain about some of the events supported by Visual Basic Objects.
Q2. What are the different data types supported by Visual Basic ? How they can be declared? Also mention their uses.
Q3. Give examples of passing arguments by value and passing arguments by reference in Visual Basic procedures.
Q4. Give difference between arrays and dynamic arrays. How they can be created in Visual Basic? Give Syntax.
Q5. What are the advantage of ADO Data Control ? Explain about different objects of ADO model.
Q1. Write a program using dynamic arrays to record the high temperatures of last seven days and to display all of them with the average of high temperatures. Use three buttons on the screen, one to enter the temperature, second to display the result and third to exit from program.
Q2. Write a small hand calculator. Use command buttons for the number keys, the Enter key and the + key etc. Use a label to display the results.
Q3. Develop a WordPad application using MDI forms, having basic features of File and Edit.
Q4. Write an event procedure to automate the billing system of a supermarket. Give the details of database tables, forms, controls and menu design (if any). Make assumptions, wherever necessary.
1. VB is considered to be a
(A) first-generation language.
(C) higher-level language.
(D) machine language
2. The person who actually runs a computer program is called a
3. Programming in VB is different from most other programming environments because first you should
(A) write the code.
(B) input the data.
(C) name the buttons.
(D) draw the user interface.
4. GUI stands for
(A) graphical user interface.
(B) graphing user introduction.
(C) graphical unit interface.
(D) graphical user input.
5. Press F4 to
(A) run a program.
(B) display the Properties window.
(C) display the Solution Explorer window.
(D) terminate a program.
6. Which of the properties in a control’s list of properties is used to give the control a meaningful name?
7. When a VB program is running, the user can move from one control to another using the keyboard by pressing the
(A) Tab key.
(B) Space bar.
(C) Enter key.
(D) Backspace key.
8. Which of the following properties determines the words appearing in a form’s title bar?
9. What effect will the following statement have? Label1.Visible = False
(A) Enable Label1
(B) Delete Label1
(C) Make Label1 invisible
(D) It is not a valid VB statement.
10. The Font dialog box allows you to select different Fonts, their style, their size, and some other special effects. How do you bring up this Font dialog box?
(A) In the Properties window, click the ellipsis (c) on the right side of the settings box for the Font property.
(B) Double-click the textbox, and select Font Property.
(C) Right-click the textbox, and select Font Property.
(D) None of the above.
11. What keyboard shortcut allows you to run the current program?
12. Which property is available for most controls that allows you to hide/unhide them either manually by setting the property or by setting it during runtime via code?
13. When the user clicks a button, _________ is triggered.
(A) an event
(B) a method
(C) a setting
(D) a property
14. Select the code statement that will set the current text color to Red.
(A) txtBox.ForeColor = “Red”
(B) txtBox.ForeColor = Red
(C) txtBox.ForeColor = Color.Red
(D) txtBox.ForeColor = “Color.Red”
15. The statement btnButton.Focus()
(A) has no effect.
(B) moves the focus to the button btnButton.
(C) has the same effect as clicking on the button btnButton.
(D) is invalid in VB.
16. Which of the following statements sets the words on a button to “Submit Button”?
(A) btnButton.Name = “Submit Button”
(B) btnButton.Text = Submit Button
(C) btnButton.Text = ” Submit Button ”
(D) btnButton = ” Submit Button ”
17. A user action such as clicking a button is called:
(A) an accident
(B) an event
(C) a procedure
(D) a property
18. What is the correct statement when declaring and assigning the value of 100 to an
Integer variable called commission?
(A) Dim commission = 100
(B) Dim commission = Int(100)
(C) commission = 100
(D) Dim commission As Integer = 100
19. Which of the following statements removes all text from lstBox?
20. Which statement will assign the words gHello Worldh to a text box?
(A) txtBox.Text = Hello & World
(B) txtBox.Text = “Hello ” & World
(C) txtBox.Text = Hello & ” World”
(D) txtBox.Text = “Hello” & ” World”
21. What character is used to signify the beginning of a comment statement?
(B) exclamation mark
22. What will be displayed when the following lines are executed?
Dim x As Double = 2
‘x = 3
txtBox.Text = CStr(x)
(D) None of the above
23. When an End Sub statement is reached in a Sub procedure, execution jumps to
(A) the statement before the call statement which invoked the Sub procedure.
(B) the statement after the call statement which invoked the Sub procedure.
(C) the beginning of the event procedure containing the call statement.
(D) the end of the event procedure containing the call statement.
24. Which one of the following is true about arguments and parameters?
(A) Arguments appear in call statements; parameters appear in Sub statements.
(B) Parameters appear in call statements; arguments appear in Sub statements.
(C) They are synonymous terms.
(D) They are completely unrelated in a program.
25. Items appearing in the parentheses of a call statement are known as____________.
(A) call variables
(B) call strings
26. Variables declared inside a procedure are said to have ________________.
(A) local scope
(B) procedure-level scope
(C) class-level scope
(D) none of the above
27. Assume that A, B, and C are conditions, with A being true, B being true, and C being false. Give the truth value of each of the following conditions.
(a) A And (Not B)
(b) A And Not (B Or C)
(c) Not (A And B)
28. Consider the following two sets of code.
(a) If (a = 1) And (b = 1) Then (b) If a = 1 Then
txtBox.Text = “Hi” If b = 1 Then
End If txtBox.Text = “Hi”
Which one of the following statements is true?
(A) (a) and (b) will produce different outputs.
(B) (b) is not a valid set of VB instructions.
(C) The two sets of code are equivalent, but (a) is preferred to (b) because (a) is clearer.
(D) The condition statement in (a) is not valid.
29. What will be displayed by the following program when the button is clicked?
Private Sub btnDisplay_Click(…) Handles btnDisplay.Click
Dim a, b, c, x As Double
a = 5
b = 3
c = 6
If a > c Then
x = 1
If b > c Then
x = 2
x = 3
txtBox.Text = CStr(x)
(D) None of the above.
30. If the loop is to be executed at least once, the condition should be checked at the __________.
(A) top of the loop
(B) middle of the loop
(C) bottom of the loop
(D) Nothing should be checked
31. Suppose a variable is to tell whether or not the user wants further information. A good data type for such a variable is
32. VB uses an object called ____________ to hold a table.
33. Which of these is not an collection of the VB project ?
(A) The Global Module
(B) The form Module
(C) The object Module
(D) The class Module
34. Which of these is used to open an database ?
(A) Set dbMyDB = OpenDatabase(“MyDatabase.mdbh)
(B) dbMyDB = OpenDatabase(“MyDatabase.mdb”)
(C) Set dbMyDB = OpenDatabase None of these
(D) None of these
35. MDI stands for
(A) Multiple Document Interface
(B) Modular Document Interface
(C) Management Document Interface
(D) Multilingual Document Interface
36. Microsoft Notepad is __________ based application.
37. The ________ Forms are forms from where user can switch to any other Forms in the application without closing it.
d. None of the above
38. ODBC stands for
A. Open database connectivity
B. Other database connectivity
C. Optimistic database connectivity
D. Old database connectivity
39. Visual Basic uses the ______property to determine the control that would receive the focus next when a tab key is pressed.
40. ______________ makes the compulsory declaration of all the variables.
c. Option Explicit
d. None of the above