2.2 Vba
2.2 Vba
2
PROGRAMMING WITH VBA
1. VBA is an acronym for
A. Visual Basic Algorithm B. Visual Basic Administrator
C. Visual Basic for Accounting D. Visual Basic for Applications
2. VBA is an integration of the programming language Visual Basic with
A. scripting language B. accounting software
C. Open office application D. microsoft office application
3. Name the standard Macro language used in most microsoft office products like Excel, Access etc.
A. C B. VBA C. HTML D. Javascript
4. Which Editor is inbuilt in MS Excel?
A. Notepad B. Worldpad C. Dos Editor D. Visual Basic Editor
5. The VBA language is a derivative of
A. Visual C B. Visual C++ C. Visual Basic D. Visual Fox-pro
6, The fundamental difference with VBA from VB is that VBA is used with in
A. scripting language B. accounting software
C. open office application D. microsoft office application
7. VBA is used to create
A. database B. charts and graphs
C. letters and documents D. macro-driven applications
8. Which macro language is used to automate repetitive operations?
A. C B. VBA C. HTML D. Javascript
9. Which macro language is used to automate a frequently performed task?
A. C B. VBA C. HTML D. Javascript
10. Which one of the following is used to create user interative froms?
A. C B. VBA C. HTML D. Javascript
11. Which one of the following is used to create button controls to which macros or code can be
assigned.
A. C B. VBA C. HTML D. JavaScript
12. Which one of the following is used for data analysis?
A. C B. VBA C. HTML D. JavaScript
13. The full form of VBE is
A. Visual Basic Editor B. Visual Basic Editing
C. Visual Basic Encoding D. Visual Basic Encryption
14. In object oriented programming which is a code element that defines an object?
A. Form B. Chart C. Class D. Button
15. Name the template from which objects are created
A. Form B. Chart C. Class D. Button
16 Object can be treated as instances of
A. Form B. Chart C. Class D. Button
17. In VBA which of the following is a proper object hierarchy?
A Worksheet, Work book, Application, Range B. Range, Application, Worksheet, Work book
C. Range, Worksheet, Work book, ApplicationD. Application, Work book, Work sheet, Range
18. In object hierarchy of VBA where does Excel come?
A. Range object B. Work book object C. worksheet object D. Application object
19. In object hierarchy of VBA where does Book1.xls come?
A. Range object B. Work book object C. worksheet object D. Application object
2o. In object hierarchy of VBA which object is undermeath the workbook object
A. Range object B. Work book object C. worksheet object D. Application object
21. In VBA, which of the following is used to define object characteristics?
A. Event B. Modules C. Methods D. properties
22. In VBA, which of the following is an example for property of an object?
A. Event B. Class C. Methods D. font colour
23. In VBA, which is a set of commands bundled together under one name?
A. Class B. object C. Macros D. Procedures
24. In VBA, which are logically are recorded commands that can be re-executed at later stage to repeat
the task?
A. Class B. object C. Macros D. Procedures
25. Which one of the following simplifies the work by eliminating/rewriting the code in VBA>
A. class B. object C. Macros D. Procedures
26. Which one of the following repeats the same steps in case of frequently needed actions in VBA?
A. Class B. object C. Macros D. Procedures
27. The macro recording tool is provided in
A. word only B. Excel only C. Access only D. all MS office applications
28. In VBA, which can be assigned to button controls to make the application user friendly?
A. Class B. object C. Macros D. procedures
29. In VBA which are name as set of statements that are executed as a whole?
A. Events B. Modules C. Methods D. Procedures
30. The keywords represents two main types of procedures in VBA are
A. sub and func B. sub and function C. subroutine and func D. subroutine and function
31. In VBA, all sub procedures must begin with the word
A. sub B. sub prg C. sub func D. sub routine
32. In VBA, all subs must end with
A. End prg B. End sub C. End func D. End proc
33. In VBA, which is simply a proceduce that acts object?
A. Macro B. Module C. Method D. Properties
34. Opening a workbook or deleting a work sheet is an exmple for
A. Macro B. Module C. Method D. Properties
35. In Excel VBA, Activate, Copy, Delete, Save of the work sheet are
A. Macro B. Module C. Method D. Properties
36. In VB, which one is a method of worksheet object?
A. Save B. Check C. Scroll D. Command
37. In VBA, which contain declarations and procedures?
A. Event B. Method C. Module D. Procedure
38. In Excel VBA, Name the trigger for an action to take place is
A. events B. macros C. methods D. procedures
39. Double clicking an object is
A. Event B. Macro C. method D. procedures
40. Mouse clik is
A. an event B. a macro C. a method D. a procedure
41. Scroll and change event is applied for
A. title bar B., scroll bar C. menu bar D. a procedures
42. Which is a container for holding VBA code?
A. Event B. Method C. Module D. Procedure
43. In VBA, which of the following contain procedures that are not associated with any particular object?
A. Macros B. Methods C. Class modules D. Standard modules
44. In VBA, which of the following contain procedures that are associated with a particular object?
A. Macros B. Methods C. class modules D. Standard modules
45. Which is used to type/edit the programming in VBA?
A. Form window B. Properties window C. Immediate window D. Visual Basic Editor
46. The shortcut key used to access Visual Basic Editor is..
A. F11 B. Alt + F11 C. Ctrl + F11 D. Shift + F11
47. In VBA, Ctrl +R is used to open the
A. menu bar B. project explorer C. standard tool bar D. properties window
48. In VBA, F4 is used to display
A. menu bar B. project explorer C. standard tool bar D. properties window
49. The Excel file containing VBA code or macros must be saved as type
A. Excel workbook B. Excel binary workbook
C. Excel 97-2003 workbook D. Excel Macro enabled workbook
50. Bugs mean
A. errors B. variables C. keywords D. constants
51. Software development is all about
A. writing code and pringing B. writing code and drawing flow chat
C. writing code and spotting the mistakes and printing
D. writing code and spotting the mistakes and fixing them
52. In VBA, which shortcut key is used to find where the variable is defined in the procedure?
A. F2 B. Alt F2 C. CtrlF2 D. Shift F2
53. Which short cut key is used to run the procedure in VBA?
A. F5 B. Alt F5 C. Ctrl F5 D. Shift F5
54. Which shortcut key is used to run the procedure line by line?
A. F8 B. Alt F8 C. Ctrl F8 D. Shift F8
55. Break points can not be placed on lines in the
A. sub function B. printing statement
C. calculating statement D. general declaration section
56. Which are placed on the code lines to invoke the debugger when the program tries to execute that
lines in VBA?
A. Events B. Methods C. Properties D. Break points
57. Which are temporary and an automatically removed when you close the database?
A. Events B. Methods C. Properties D. Break points
58. F9 is used to insert
A. Events B. Methods C. Properties D. Break points
59. In VBA, which shortcut key allows debugger to run the current line and go to next line in a
procedure?
A. F6 B. F7 C. F8 D. F9
60. In VBA, which shortcut key allows debugger to run the current procedure and go to the line after the
line that called the procedure?
A. Ctrl shift F6 B. Ctrl shift F7 C. Ctrl shift F8 D. Ctrl shift F9
61. In VBA, which command of a debugger lets you run the procedure and go to the next line in the
calling procedure?
A. set next B. step over C. step into D. step through
62. In VBA debugging, the shortcut key to set next statement is
A. F8 B. F9 C. Ctrl F8 D. Ctrl F9
63. In VBA, while debugging code, which statement allows to go the highlighted line?
A. Step out B. set next C. step into D. show next
64. Ctrl + G is used to open
A. form window B. watch window C. properties window D. immediate window
65. In VBA, which of the following keeps track of the procedure calling chain?
A. Call stack B. Local window C. Watch window D. Immediate window
66. Which window shows the entire local variables of a current procedure in VBA?
A. Call stack B. Local window C. Watch window D. Immediate window
67. In which window of VBA, the variable you want to track is to be added?
A. Call stack B. Local window C. Watch window D. Immediate window
68. Which shortcut key is used to toggle between Excel and Visual Basic Editor?
A. F11 B. Alt+F11 C. Ctrl+F11 D. Shift+F11
69. Which method is used to display the output in the immediate window?
A. Print B. Display C. Debug.print D.Display.print
70. Which are entitles that hold data?
A. Literals B. Variables C. Keywords D. Constants
71. Which are areas allocated by the computer memory to hold data?
A. Literals B. Variables C. Keywords D. Constants
72. In VBA, the variable name must start with a
A. digit B. letter C. plus sign D. minus sign
73. In VBA, which of the following character is allowed in variables names?
A. Dot(.) B. Hypen(-) C. Asterisk(*) D. Underscore(_)
74. A variable name cannot be the same as any one of Excel‟s
A. literals B. keywords C. constants D. data types
75. Which should be declared before using them by assigning names and data types?
A. Literals B. Variables C. Keywords D. Constants
76. If a variable is not declared, VB will automatically declare the variable as
A. data B. string C. variant D. numeric
77. In VBA, which data type can hold any type of data?
A. data B. string C. variant D. numeric
78. In VBA, which keyword is used to declare a variable?
A. Do B. Get C. Dim D. New
79. In VBA, which of the following declaration statement is correct one
A. Dim A,B,C,D B. Dim A; B; C; D C. Dim A, B; C, D D. Dim -A, B, C, D
80. In VBA, which statement forces you to declare or any undeclared variables?
A. Implicit B. Explicit C. Option explicit D. Option implicit
81. Where the option explicit is always automatically included in the VBA module?
A. Top B. Middle C. Bottom D. In between
82. Which one of the following is a VBA keyword?
A. Sub B. Tool C. Edit D. View
83. Which of the following is a VBA keyword?
A. Tool B. Edit C. View D. Integer
84. In VBA, an example for numeric data type is
A. city name B. student name C. student result D. examination mark
85. Which of the following is an integer number?
A. 485 B. 36.5 C. 36A D. 46.0
86. In VBA, the size of integer data is
A. 2 bytes B. 4 bytes C. 8 bytes D. 12 bytes
87. In VBA, the size of double data is
A. 2 bytes B. 4 bytes C. 8 bytes D. 12 bytes
88. In VBA, the size of single data is
A. 2 bytes B. 4 bytes C. 8 bytes D. 12 bytes
89. Which of the following is a non-numeric data?
A. String B. Single C. Integer D. Double
90. Which of the following data type stores only true or false?
A. Data B. Single C. Integer D. Boolean
91. In VBA, the size of data type is
A. 2 bytes B. 4 bytes C. 8 bytes D. 12 bytes
92. In VBA, the size of boolean data type is
A. 2 bytes B. 4 bytes C. 8 bytes D. 12 bytes
93. In VBA, which character is to be suffixed currency data type
A. & B. ! C. # D. @
94. In VBA, which character is to be suffixed single data type?
A. & B. ! C. # D. @
95. In VBA, which character is to be suffixed double data type?
A. & B. ! C. # D. @
96. In VBA, which character is to be suffixed long data type?
A. & B. ! C. # D. @
97. In VBA, date and time literals are enclosed with in
A. , B. “ C. # D. @
98. In VBA, which statement is used to declare the data type of an enumeration?
A. Enum B. Enumer C. Enumerate D. Enumeration
99. Which of the following is a valid assignment statement?
A. Basic = 1000 B. Basic == 1000 C. Basic Equals 1000
D. Basic is Equal to 1000
100. Which error occurs when you try to assign a value to a variable of incompatible data type?
A. Syntax error B. Logical error C. Compiler error D. Type mismatch error
101. In VBA, which operator is used to join two strings or data types?
A. & B. * C. + D. &&
102. In VBA, which function is used to prompt the user to enter a value?
A. Input Box B. Alert box C. Confirm box D. Msg Box
103. In VBA, which function provides a way to give information to a user?
A. Input Box B. Alert box C. Confirm box D. Msg Box
104. In VBA, which of the following method is used to display a pre-defined message to the user?
A. Input Box B. Alert box C. Confirm box D. Msg Box
105. In VBA, which of the following constant displays a single ok button in message box?
A. vbYesNo B. vbOKOnly C. vbOkcancel D. vbYesNoCancel
106. In VBA, which of the following constant displays a warning message icon in message box?
A. vbCritical V. vbQuestion C. vbInformation D. vbExclamation
107. What will be the result of the following VBA code?
Dim n As Integer
n = MsgBox (“congratulations”, vbExclamation, “result”)
End sub
108. Which value is returned by MsgBox function in VBA when ok button is clicked?
A. 1 B. 2 C. 3 D. 4
109. Which value is returned by MsgBox function when cancel button is clicked in VBA?
A. 1 B. 2 C. 3 D. 4
110. Which value is returned by MsgBox function which Abort button is clicked in VBA?
A. 1 B. 2 C. 3 D. 4
111. Which value is returned by MsgBox function when Retry button is clicked in VBA?
A.1 B. 2 C. 3 D. 4
112. Which value is returned by MsgBox function when ignore button is clicked in VBA?
A. 4 B. 5 C. 6 D. 7
113. Which value is returned by MsgBox function when Yes button is clicked in VBA?
A. 4 B. 5 C. 6 D. 7
114. Which value is returned by MsgBox function when No button is clicked in VBA?
A. 4 B. 5 C. 6 D. 7
115. Which of the following is a valid VBA statement?
A. n = InputBox „Enter your Age‟ B. n = InputBox (Enter your Age)
C. n = InputBox “Enter your Age” D. n = InputBox (“Enter your Age”)
116. What will be allowed by InputBox function when type is 0 in VBA?
A. Text B. Number C. Formula D. Logical value
117. In VBA, what will be allowed by InputBox function when type is 1?
A. Text B. Number C. Formula D. Logical value
118. In VBA, what will be allowed by InputBox function when type is 2?
A. Text B. Number C. Formula D. Logical value
119. In VBA, what will be allowed by InputBox function when type is 4?
A. Text B. Number C. Formula D. Logical value
120. In VBA, the function Asc converts given character value to numeric code in which system
A. Unicode B. Binary code C Double Byte Character Set (DBCS)
D. American Standard Code for Information Interchange (ASCII)
121. MS office records macros in which language?
A. VBA B. C++ C. C# D. Java
122. Excel file having VBA code is saved using the extension of
A. .xlsx B. .xlsm C. .xlst D. .xls
123. Which type of data transaction VBA permits in spread sheets?
A. reading B. writing C. both reading and writing D. neither reading nor writing
124. Which the programming environment permits coding, compilation, running and debugging from a
single window is called
A. Editor A. Compiler C. Highlighter
D. Integrated Development Environment (IDE)
125. In VBA languge is derivative from which language?
A. Basic B. COBOL C. HTML D. Visual Basic
126. Byte in VBA can store values in the range of
A. 0 to 255 B. +922,337,203,685,477.5808 to +9.22,337,203,685,477.5807
C. 01-Jan-100 to 31-Dec-9999
D. +79228162514264337593543950335 or + 7.9228162514264337593543950335
127. Currency data type in VBA can store values in the range of
A. 0 to 255 B. +/-922,337,203,685,477.5808 to +922,337,203,685,477.5807
C. 01-Jan-100 to 31-Dec-9999
D. +79,228,162,514,264,337,593,543,950,335 or +7.9228162514264337593543950335
128. Date data type in VBA can store values in the rage of
A. 0 to 255 B. +922,337,203,685,477.5808 to +9.22,337,203,685,477.5807
C. 01-Jan-100 to 31-Dec-9999
D. +79,228,162;514,264,337,593,543,950,335 or +7.9228162514264337593543950335
129. Decimal data type in VBA can store values in the range of
A. 0 to 255 B. +922,337,203,685,477.5808 to +9.22,337,203,685,477.5807
C. 01-Jan-100 to 31-Dec-9999
D. +/-79,228,162,514,264,337,593,543,950,335 or +/+/-7.9228162514264337593543950335
130. Double data type in VBA can store values in the rage of
A. +1.79769313486232E308 to +4.94065645841247E324
B. -32,768 to +32,767
C. -2,147,483,648 to +2,147,483,647 D. -3:402823E38 to -1:401298E45
131. Integer data type in VBA can store values in the rage
A. +1.79769313486232E308 to +4.94065645841247E324
B. -32,768 to +32,767
C. -2,147,483,648 to +2,147,483,647 D. -3:402823E38 to -1:401298E45
132. Long data type in VBA can store values in the range of
A. +1.79769313486232E308 to +4.94065645841247E324
B. -32,768 to +32,767
C. -2,147,483,648 to +2,147,483,647 D. -3:402823E38 to -1:401298E45
133. Single data type in VBA can store values in the range of
A. +1.79769313486232E308 to +4.94065645841247E324
B. -32,768 to +32,767
C. -2,147,483,648 to +2,147,483,647 D. -3.402823E38 to -1.401298E45
134. String data type in VBA can store a maximum of characters?
A. 65,400 B. 32,767 C. 2,147,483,648 D. 100
135. Which arithmetic operator in VBA takes the highest precedence?
A. % B. +addition C. -substration D. ^Exponentiation
136. Which arithmetic operator in VBA calculates power of a number?
A. % B. + C. = D. ^
137. Which arithmetic operator in VBA has precedence after the ^ operator?
A. -negation B. + addition C. - subtraction D. / Division
138. Which arithmetic operator in VBA has precedence after the /operator?
A. ^ B. + C. - D. &
139. Which arithmetic operator in VBA has precedence after the * operator?
A. ^ B. & C. - D. /
140. In the following expression, find out the first operation: 3 * 2 + 5 / 2 + 3 % 2 * 2 ^ 4
A. 3 *2 B. 2 ^ 4 C. 5 / 2 D. 3 % 2
141. What would be the result of the following comparison? 5 <=3
A. true B. false C. neither true nor false D. both true and false
142. What would be the result of the following comparison? 5>=3
A. true B. false C. neither true or false D. both true and false
143. Choose the result of the following VBA expression x = “hi, “ & “how are you?”
A. “how are you, Hi?” B. “Hi: how are you” C. “Hi, how are you?” D. “Hi?”
144. Choose the result of the following VBA expression : x = “Hi, “ + “how are you?”
A. “how are you, Hi?” B. “Hi: how are you” C. “Hi, how are you?” D. “Hi?”
145. In VBA, which operator is used for cancatenation results concatenation of Strings, irrespective of
numeric or alphanumeric value stored in the Strings?
A. & B. $ C. # D. +
146. The operators in VBA which combine the results of several comparisons are called
A. logical B. arithmetical C. mathematical D. concatenation
147. Which operator in VBA returns true only if both sides of the operator are true?
A. OR B. AND C. NOT D. XOR
148. Which operator in VBA returns true only if given comparison is false?
A. OR B. AND C. NOT D. XOR
149. Which operator in VBA returns true if at least one of the 2 expressions is true?
A. OR B. AND C. NOT D. XOR
150. Which operator in VBA returns true if only one of the 2 comparisons is true?
A. OR B. AND C. NOT D. XOR
151. What would be the result of the following expression? (5<3) AND (4>2)
A. true B. false C. neither true nor false D. both true and false
152. What would be the result of the following expression? (5<3) OR (4>2)
A. true B. false C. neither true nor false D. both true and false
153. What would be the result of the following expression? (5<3)XOR(4>2)
A. true B. false C. neither true nor false D. both true and false
154. What would be the result of the following expression? (5>3)XOR(4>2)
A. true B. false C. neither true nor false D. both true and false
155. What would be the result of the following expression? NOT (4>2)
A. true B. false C. neither true nor false D. both true and false
156. Wat would be the result of the following expression? NOT(4<2)
A. true B. false C. neither true nor false D. both true and false
157. Which function in VBA displays a message box?
A. MsgBox B. InputBox C. MBox D. Messge
158. What is the first and mandatory parameter in MsgBox function?
A. Double B. Integer C. String D. Message
159. In VBA „MsgBox‟ function, which option displays only the Ok button?
A. vbYesNoCancel B. vbAbortRetryIgnore C. vbOKCancel D. vbOKOnly
160. In VBA „MsgBox‟ function, which option displays only the Ok and cancel button?
A. vbYesNoCancel B. vbAbortRetryIgnore C. vbOKCancel D. vbOKOnly
161. In VBA „MsgBox‟ function, which option displays only the Yes, No and Cancel button?
A. vbYesNoCancel B. vbAbortRetryIgnore C. vbOKCancel D. vbOKOnly
162. In VBA „MsgBox‟ function, which option displays only the Abort,Retry and Ignore button?
A. vbYesNoCancel B. vbAbortRetryIgnore C. vbOKCancel D. vbOKOnly
163. In VBA „MsgBox‟ function, which option displays Critical error message?
A. vbYesNo B. vnRetryCancel C. vbCritical D. vbQuestion
164. In VBA „MsgBox‟ function, which option displays warning query?
A. vbYesNo B. vnRetryCancel C. vbCritical D. vbQuestion
165. In VBA „MsgBox‟ function, which option displays warning/Exclamation message?
A. vbExclamation B. vnInformation C. vbDefaultButton1 D. vbDefaultButton2
166. In VBA „MsgBox‟ function, which option displays Information message?
A. vbExclamation B. vnInformation C. vbDefaultButton1 D. vbDefaultButton2
167. In VBA „MsgBox‟ function, what value returns when OK button was clicked?
A. 1 B. OK C. vbOK D. vbOKOnly
168. In VBA „MsgBox‟ function, what value returns when Cancel button was clicked?
A. 1 B. 2 C. cancel D. vbcancel
169. In VBA „MsgBox‟ function, what value returns when Abort button was clicked?
A. 3 B. 2 C. Abort D. vbAbort
170. In VBA „MsgBox‟ function, what value returns when Retry button was clicked?
A. 1 B. 2 C. 3 D. 4
171. Which function is used to display the dialogue box for user input?
A. MsgBox B. InputBox C. box D. InBox
172. What is the first parameter of the Input Box?
A. prompt message B. title of dialog C. Input D. Input Type
173. Name the large window which supports placement of other components on its surface is called
A. CommandButton B. Label C. userForm D. TextBox
174. Which control is suitable to start computation after collecting required input data for processing?
A. CommandButton B. Label C. userForm D. TextBox
175. Which controls is suitable to collect text input from the user?
A. CommandButton B. Label C. userForm D. TextBox
176. Which control can be used to display an picture
A. SpinBox B. Image C. UserForm D. Label
177. Which one creates a control which remains pressed or released after each click?
A. ComboBox B. OptionBox C. List Box D. Toggle Button
178. Which one creates a box with a scrollable list containing a number of input values?
A. ComboBox B. OptionBox C. List Box D. Toggle Button
179. Which one creates a box with a triangular button, clicking which displays a number of input values?
A. ComboBox B. OptionBox C. List Box D. Toggle Button
180. Which one creates a box with a circular dot, which can be receives tick only if all related boxes
become switched off?
A. ComboBox B. Optionbutton C. List Box D. Toggle Button
181. Which of the following button is used to display descriptive text or brief instructions?
A. Label B. Image C. Frame D. Text Box
182. Which box has three states?
A. List box B. Group Box C. Check Box D. Combo Box
183. Which button has three states>?
A. Spin button B. Push button C. Option button D. Command button
184. Which list box enables only adjacent choice?
A. Drop down list box B. Single-selection list box
C. Multiple-selection list box D. Extended - selection list box
185. Which list box enables adjacent disjointed choice?
A. Drop down list box B. Single-selection list box
C. Multiple-selection list box D. Extended - selection list box
186. Which list box does not enables adjacent choices or disjointed choices?
A. Drop down list box B. Single-selection list box
C. Multiple-selection list box D. Extended - selection list box
186. Which box is a combination of a text box and list box?
A. Drop down list box B. Single-selection list box
C. Multiple-selection list box D. Extended - selection list box
188. Which box is used to enable a user to either type an entry or choose only one item from the list?
A. List box B. Group box C. Check box D. Combo box
189. Which button is used to increase or decreases a value, such as a number increment time or date?
A. spin button B. Push button C. Option button D. Command button
190. Which button runs a macro that performs an action when a user clicks it?
A. spin button B. Text button C. Option button D. Command button
191. Which button alternates between enabled and disabled state when it is clicked?
A. spin button B. Push button C. Toggle button D. Option button
192. A rectangular object with an optional label that groups related controls into one visual unit
A. label B. frame C. image D. text box
193. Triple state property is applicable to the
A. list box B. text box C. check box D. combo box
194. Min and Max properties is applicable to
A. Spin button B. Push button C. option button D. command button
195. What is the output of the following VBA code?
Sub wl ()
For n = 1 to 2 Step 2
Debug.print Format (left(a,3) + Right (a,4), “>”); Next
End sub
A. “Wel come B. WELCOME C. Welcome D. WELCOME WELCOME
196. In VBA, which is a series of items where all items share the same properties and methods?
A. Arrays B. Groups C. Methods D. Collections
197. Which of the following property returns the workbook where the Visual Basic code is running?
A. Book B. Work book C. Work book this D. ThisWorkBook
198. The VBA workbook property This Workbook.path gives the result..
A. E:\VBA B. Booki1.xlsm C. E:\VBA\Book1 D. E:\VBA\Book1.xlsm
199. The VBA workbook property Thisworkbook.full name gives the result
A. E:\VBA B. Booki1.xlsm C. E:\VBA\Book1 D. E:\VBA\Book1.xlsm
200. What is the alternate name of Subroutines?
A. procedures B. Satements C. Macros D. Select case
201. Which of the following is a control statement in VBA?
A. Redim B. Resume C. Function D. If-Then-Else
202. Which of the following is a control statement in VBA?
A. Redim B. Resume C. Function D. Select-case
203. In VBA, which of the following represents logical operator?
A. + B. - C. * D. And
204. In VBA, which of the following represents logial operator?
A+ B. - C. * D. Or
205. Which type of If statement is shown in the following syntax?
if (Expression 1)
{
//Executes when Expression 1 is true.
if (Expression 2)
{
//Executes when Expresion 2 in true
}
A. If-Then statement B. Simple if statement
C. Laddle if statement D. Nested if statement
206. In VBA, which of the following represents logical operator?
A. + B. - C. * D. Not
207. Which one of the following is a decision making statement?
A. Dim B. Redim C. Resume D. Select-case
208. Which of the following statement can be used for instead of multiple-if-else?
A. Nested if B. if-then-else C. select-case D. If-then-endif
209. Select-case statement of VBA is ened with
A. End B. End case C. End select D. End select case
210. Which of the following keyword is used with select statement?
A. Exit B. Next C. Until D. Case else
211. Which of the following is a valid VBA statement?
A. Sub greeter (x, y, z As Integer) B. Sub-greeter (x, y, z As Integer)
C. Sub greeter (x; y; z As Integer) D. Sub greeter (x: y: z As Integer)
212. What will be the output of the following VBA code if your input is 80?
Sub Grade (percent As Integer)
Select case percent
Case 0 to 49
MsgBox(“C grade”)
Case 50 to 79
MsgBox(“B grade”)
Case 80 to 100
MsgBox(“A grade”)
Case Else
MsgBox(“Invalid Mark”)
End select
End sub
A. A grade B. B Grade C. C grade D. D grade
213. Which one of the following are concatenation operators in VBA?
A. + and - B. & and - C. & and * D. + and &
214. What will be the output of the following VBA code?
Sub test_len()
Dim length A Integer
Dim str As string
Str = “Time is Money”
length = len (str)
Debug.Print : “The length is” & length
End sub
A. 13 B. The length is 11 C. The length is 13 D. THE LENGTH IS 13
215. Which of the following VBA function is used to convert the string from uppercase to lowercase?
A. Lcase ( ) B. Lower ( ) C. Ucase ( ) D. Upper ( )
216. Which of the following VBA function is used to convert the string from lowercase to uppercase?
A. Lcase ( ) B. Lower ( ) C. Ucase ( ) D. Upper ( )
217. The VBA string function Left (str,3) extracts the
A. no characters B. Last 3 characters C. first 3 characters D. 3 characters at middle
218. The VBA string function Right (str,3) extracts
A.no characters B. Last 3 characters C. first 3 characters D. 3 characters at middle
219. What will be the output of the following VBA string function?
Sub stg ()
Str = “Mathematics”
Debug.Print Mid (str,6)
End sub
A. matics B. Mathem C. Mathemat D. Mathematics
220. What will be the output of the following VBA code?
Sub A ()
A = “ComputerOperator”
Debug.PrintMid (A,10)
End sub
A. Operator B. Computer C. Computer O D. Computer Operator
221. The process of executing a task repeatedly a certain number of times is called
A. control B. looping C. declaration D. decision making
222. Which of the following is a looping statement in VBA?
A. If B. For C. Dim D. Select
223. Which the following is a looping statement in VBA?
A. If B. Dim C. Select D. Do-while
224 Which of the following is a looping statement is VBA?
A. If B. Dim C. Select D. Do-write
225. For loop in VBA is ended with
A. end B. else C. next D. then
226. Which of the following loop in VBA is executed atleast once before testing the condition?
A. for B. While C. Do while D. Do-loop until
227. What will be the output of the following VBA code?
Sub sam ()
For n = 10 To 1 sep - 1
debug.Print n
Next n
End sub
A. 1 3 5 7 9 B. 1 0 8 6 4 2 C. 1 2 3 4 5 6 7 8 9 10
D. 10 9 8 7 6 5 4 3 2 1
228. What will be output of the following VBA code?
Sub ssum ()
Sum = 0
For n = 1 to 5
Sum = sum + n
debug.Print sum
Next n
End sub
A. 0 B. 15 C. 12345 D. 1 3 6 1 0 1 5
229 What will be output following VBA code?
Sub sam ()
For n = 0 tp 10
Debug.Print n
If n = 5 Then Exit For
End sub
Next n
A. 012345 B. 0123456789 C. 12345678910 D. 012345678910
230. What will be the output of the following VB/A code?
Sub num()
Dim num As Integer
num - 0
Do while num<5
num = num + 1
Debug.Print num * num
Loop
End sub
A. 1 3 5 B. 1 4 9 16 C. 1 2 3 4 5 D. 1 4 9 16 25
231. What will be the output of the following VBA code?
Sub F()
F=1
For n = 1 To 5
F=F*n
Next n
Debug.Print F
End sub
A. 15 B. 24 C. 60 D. 120
232. What will be result of the following VBA code?
Sub Opt ()
A = “Computer Operator”
res = Replace (A, “Operator”, “Programmer”)
Debug.Print res
End sub
A. Programmer B. Computer Operator C. Operator Programmer D. Computer Programmer
233. What will be the output of the following VBA code?
Sub AA()
A = Computer Operator
N = Instr (A, “Ope”)
Debug.Print n
End sub
A. 2 B. 9 C. 10 D. 12
234. What will be the output of the following VBA code?
Sub str ()
A = “loops”
res = StrReverse(A)
Debug.Print “The reverse string” & res
End sub
A. Spool B. Loops C. The reverse string loops D. The reverse string spool
235. Which VBA date function is used to display data and time?
A. Now () B. Date () C. Time () D. Year ()
236. What will be the output of the following VBA code?
Sub short()
d1 = “Jan 1, 2017
Debug.Print Format (d1, “Short Date”)
End sub
A. 1/1/2017 B. 01/01/2017 C. 01-Jan-17 D. January01,2017
237. What will be the output of the following VBA code?
Sub format1()
d1 = “Jan 1, 2017”
D2 = Format (d1, “mmm, dd, yyy”)
Debug.Print d2
End sub
A. 1/1/2017 B. 1/01/2017 C. Jan 1, 2017 D. Jan, 01, 2017
238. What will be the output of the following VBA code?
Sub add ()
d1 = “Jan 1,2017”
d2 = Date Add (“d”, 10, d1)
d2 = Format (d2, mmm, dd, yyy”)
Debug.Print d3
End sub
A. Jan 1,2017 B. Jan9, 2017 C. Jan 10,2017 D. Jan11,2017
239. What will be the output of the following VBA code?
Sub d2()
d1 = “Jan 1,2017”
d2 = Date Add (“m”, 5, d1)
d3 = Format (d2, mmm dd,yyy”)
Debug.Printd3
End sub
A. Jan 06, 2017 B. Jun01, 2017 C. Jun 06, 2017 D. Jan 01, 2017
240. What will be the output of the following VBA code?
Sub diff ()
d1=#1/1/2000#
d2=#1/2/2018#
n= DateDiff (“yyy”,d1,d2)
Debug.Print n
End sub
A. 0 B. 1 C. 8 D. 18
241. Which of the following statement breaks a procedure or block in VBA?
A. Exit B. Loop C. Until D. Wend
242 Which is a group of variable of the same data type and with the same name?
A. Loop B. Array C. Function D. Data type
243. Which VBA staement is used to declare an array?
A. If B. For C. Dim D. Select
244. After declaring array, which VBA statement is used to define its size?
A. If B. For C. Dim D. ReDim
245. Which of the following is a valid array declaration in VBA?
A. Dim students (10) As String B. Dim students [10] as string
C. Dim students <10>as string D. Dim students [TEN] as string
246. In VBA, which one of the following returns lower bound of an array?
A. Lbound () B. Ubound () C. Lower bound () D. Upper bound ()
247. In VBA, which one of the following return upper bound of an array.
A. Lbound () B. Ubound () C. Lower bound () D. Upper bound ()
248. In VBA, which type of array is not sized in the Dim statement?
A. Static array B. Dynamic array
C. One dimensional array D. Multi-dimensional array
249. In VBA, which type of array is used when we don‟t known how many elements need to be stored in
the array?
A. Static array B. Dynamic array
C. One dimensional array D. Multi-dimensional array
250. In VBA, which array are alway allocated and never empty?
A. Static array B. Dynamic array
C. One dimensional array D. static, dynamic
251. In VBA, which array size can be changed?
A. Static array B. Dynamic array
C. One dimensional array D. Static & Dynamic
252. Name the type of array used in the following VBA code.
Sub Ar ()
Dim Arr() As string
Redim Arr (3) As string
End sub
A. Static array B. Dynamic array
C. One dimensional array D. Multi-dimensional array
253. What is the name of the array used in the following VBA code?
Sub Arr ()
Dim Arr () As string
ReDim Arr (3) As string
End sub
A. As B. Arr C. Dim D. Redim
254. Which of the following arrays are never unallocated on empty in VBa?
A. Static array B. Dynamic array
C. One dimensional array D. Multi-dimensional array
255. Name the VBA function which is used to check the given data is numeric or not?
A. Is Num () B. Numeric () C. Is Number () D. IsNumeric ()
256. What is the result of VBA function Clnt (3.89)?
A. 3 B. 4 C. 8 D. 9
257. What is the result of VBA function Fix (3.99)?
A. 3 B. 4 C. 8 D. 9
258. What is the output of the following VBA code?
Sub bound ()
Dim A As variant
A = Array (“10”, “20”, “30”, “40”)
for i = LBound (A) To UBound (A)
Debug.PrintA(i); Spc(i);
Next
End sub
A. 11 25 83 60 B. 10 20 30 40 C. 40 30 20 10 D. Array = 10,20,30,40
259. Which data type can be consist of alphanumeric characters?
A. Date B. Float C. String D. Integer
260. Which of the following data type is used to declare string data?
A. Float B. Integer C. Variant D. Boolean
261. What is the result of the following VBA code?
Sub internet ()
Dim A, B, C As string
A = “WWW”
B = “AND”
C = “THE INTERNET”
Debug.PrintA+B+C
End sub
A. WWW the Internet B. WWW THE INTERNET
C. WWW and the Internet D. WWW AND THE INTERNET
262. Which string function is used to find the length of a string in VBA?
A. Len () B. Long () C. Count () D. Length ()
263. What is the output of the following VBA code?
Sub S ()
Dim S As string
S = “Wholehearted”
debug.Print mid (S,6,4)
End sub
A. art B. hole C. hear D. whole
264. Which of the following vba string function trims all leading and trailing spaces?
A. Trim() B. Rtrim() C. Ltrim() D. LRTrim()
265. Which string function returns the character associated with the specified ASCII code?
A. Asc () B. Chr() C. Val () D. Instr ()
266. Which character place holder of format string displays a character or a space?
A. @ B. & C. > D. <
267. Which character place holder of format string displays a character or nothing?
A. @ B. & C. > D. <
268. Which character place holder of a format string displays all character in lower case format?
A. @ B. & C. > D. <
269. Which character place holder of a format string displays all characters in uppercase format?
A. @ B. & C. > D. <
270. What is the output of the following VBA code?
Sub format1 ()
X = “Institute”
Debug.Print Format (X, “>”)
End sub
A. Institute B. institute C. InstiTUTE D. INSTITUTE
271. What will be the output of the following VBA code?
Sub a ()
a = -40
Debug.Prin abs(a)
End sub
A. -40 B. 0 C. 40 D. +40
272. What will be the output of the following VBA code?
Sub sqrr ()
a=9
Debug.Print Sqr (a)
End sub
A. 3 B. 9 C. 18 D. 81
273. What will be the output of the following VBA code?
Sub a ()
a = 84.5
Debug.Print Int (a)
End sub
A. 84.0 B. 84 C. 84.5 D. 85
274. Which of the following VBA function returns TRUE if the expression is a valid date?
A. DATE () B. ISDATE () C. DATE ADD () D. DATE VALUE ()
275. Which of the following VBA function returns TRUE if the expression is a valid number?
A. VAL () B. IS DATE () C. IS ERROR () D. ISNUMERIC ()
276. What will be the output of the following VBA code?
Debug.Print Date Diff (“yyy”, “1/12/2016”, “31/1/2017”)
A. 0 B. 1 C. 11 D. 30
277. What will be the output of the following VBA code?
Debug.Print Date Diff (“m”, “1/12/2016”, “31/1/2017”)
A. 0 B. 1 C. 12 D. 30
278. What will be the output of the following VBA code?
Debug.Print format (#1/1/2017#/ “short date”)
A. 1/1/17 B. 1/1/2017 C. 01-Jan-17 D. 01 jan, 2017
279. What will be the output of the following VBA code?
Debug.Print Format (#1/1/2017#, “long date”)
A. 1/1/17 B. 2017/01/01
C. SUN, JAN 01,2017 D. Sunday, January 01, 2017
280. What will be the output of the following VBA code?
Debug.Print Format (#1/1/2017#, “yyy/mm/dd”)
A.1/1/17 B. 2017-01-01 C. SUN, JAN 01, 2017 D. Sunday, January 01, 2017
281. UDF stands for
A. User Defined Font B. User Defined Format
C. User Defined Formula D. User Defined Function
282. Name the VBA option which will return the result?
A. VBA Macro B. VBA Program C. VBA Function D. VBA Subroutines
283. Name the VBA option which does not returns the result, but just carry out a set of action?
A. VBA Macro B. VBA Program C. VBA Function D. VBA Subroutines
284. Name of the function that is created with VBA for a defined task?
A. User defined font B. User defined format
C. User Defined Formula D. User Defined Function
285. Which one of the following is known as “custom function”
A. User defined font B. User defined format
C. User Defined Formula D. User Defined Function
286. In VBA custom function uses
A. sub procedure B. user procedure
C. macro procedure D. function procedure
287. In VBA function starts with....
A. Function {} B. Function [] C. Function () D. Function funname ()
288. In VBA subroutine starts with
A. Sub { } B. Sub [ ] C. Sub ( ) D. Sub Subname ( )
289. Which method is used to pass the copy of the actual value to the arguments?
A. Val B. Ref C. ByVal D. ByRef
290. Which method is used to pass the reference to the arguments?
A. Val B. Ref C. ByVal D. ByRef
291. Which can accept an array as an input parameter in VBA?
A. Macro B. Program C. Function D. Subroutine
292. Arrays are always passed by....
A. Val B. Ref C. ByVal D. ByRef
293. Which term is used to describe how a variable may be accessed?
A. Array B. Macro C. Scope D. Function
294. Name the type of variable those declared using the public keyword?
A. Global scope B. Project scope C. Module scope D. Procedure scope
295. Which variable recognized only within the procedures in which it is declared?
A. Global scope B. Project scope C. Module scope D. Procedure scope
296. In procedure scope, when the procedure is finished running, the values of the procedure‟s local
variable as...
A. preserved B. not preserved C. partially preserved D. preserved for next procedure
297. Name the variable that is recognized among all of the procedure on a module sheet?
A. global scope B. project scope C. module scope D. Procedure scope
298. Which variable is available to all of the procedure in same module, but not available to procedures in
other module?
A. Global scope B. project scope C. Module scope D. Procedure scope
299. Module level variables can be declared at the top of module....
A. above the first procedure definition B. above the last procedure definition
C. below the first procedure definition D. below the last procedure definition
300. Which variable cannot be declared within a procedure?
A. Global scope B. Project scope C. Module scope D. Procedure scope
301. Name the variables that are accessible from anywhere in the project but not in other projects?
A. Global scope B. Project scope C. Module scope D. Procedure scope
302. In which scope does the variable declared with dim remains in the existence only as long as the
procedure in which it is declared is running?
A. Global scope B. Project scope C. Module scope D. Procedure scope
303. In procedure scope when a local variable is declared with dim statement the values of the local
variables are
A. preserved B. not preserved C. preserved partially D. stored permanently
304. In procedure scope when local variable is declared with static statement, the values of the local
variable will be
A. preserved B. not preserved C. preserved partially D. stored permanently
305. Which variable remains in existence while visual basic is running until the module in which it is
declared is edited?
A. Global scope B. Project scope C. Module scope D. Procedure scope
306. Where there is no difference between dim and private?
A. Global scope B. Project scope C. Module scope D. Procedure scope
307. Which variables cannot be declared within a procedure?
A. Global scope B. Project scope C. Module scope D. Procedure scope
308. Which variables are accessible from any procedure in any module in the object?
A. Global scope B. Project scope C. Module scope D. Procedure scope
309. Which option makes everything in the module accessible only from within the project?
A. Public module B. Private module C. Programme module D. Permanent module
310. Which procedure is accessible to all code inside the module and all code outside the module?
A. Public B. Private C. Program D. Permanent
311. Which variable can be accessed or used by subroutines in outside modules?
A. Public B. Private C. Program D. Permanent
312. Which type of variable is used which have one subroutine generating a value and to pass that value
on to another subroutine stored in a separate module?
A. Public B. Private C. Program D. Permanent
313. Which procedure is available only to the current module?
A. Public B. Private C. Program D. Permanent
314. Which variable cannot accessed or used by subroutines in other modules?
A. Public B. Private C. Program D. Permanent
315. Which VBA built-in function returns positive value of a number, irrespective of whether the input is
positive or negative?
A. ABS B. ATN C. COS D. EXP
316. Which VBA built-in function returns the cosine value of given number?
A. Cosin B. Cosign C. COS D. EXP
317. Which VBA built-in function returns arc tangent (tan ) of given input?
-1