Do you know that? 62.9% freelancers are male, 37.1% - female next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for VBA 2020

(112, CL) Last updated: March 13
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

112 Answered Test Questions:

1. What does VBA mean?

Answers:

• Visual Basic for Applications

• Visual By Arithmetic

• Visual Basic Answers

• Visual By Algorithms

2. What is the shortcut keystroke to debug VBA code one line at a time?

Answers:

• Alt+F5

• F5

• F8

• Ctrl+F8

3. True or False? It is possible to name a Sub with a string containing a space.

Answers:

• True

• False

4. Which of these is not a Visual Basic object?

Answers:

• Range

• Selection

• FontSize

• Sheets

5. You've created a user form named 'Entry_Form'. To make the user form appear, use which of the following statements?

Answers:

• UserForm.Entry_Form.Run

• UserForm.Load

• Entry_Form.Show

• Entry_Form.Appear

6. On July 4, 2013, What will be displayed in the message box from the following statement: MsgBox(Format(Now,"mm-dd-yyyy"))

Answers:

• 7-4-2013

• 07-04-2013

• 7/4/2013

• 07/04/2013

7. Choose the VBA code that will allow you to obtain information about an error.

Answers:

• Err.Title

• Err.Name

• Err.Type

• Err.Description

8. To obtain the value of the number of characters used in a textbox field on a form, which snippet of VBA code would you use?

Answers:

• Length(CStr(Forms!DataEntryfrm.Text11.Value))

• Len(CStr(Forms!DataEntryfrm.Text11.Value))

• Char(Forms!DataEntryfrm.Text11.Value)

• Spaces(Forms!DataEntryfrm.Text11.Value)

9. To save a VBA project with an Excel workbook, the workbook must be saved as what type of file?

Answers:

• xlsx

• xlsv

• xlsm

• xlv

10. To continue to run code even if a line of code causes an error, choose the VBA code to continue to the next line of code.

Answers:

• Goto

• On Error Resume

• On Error Resume Next

• Next

11. Which of the following is not a VBA data type?

Answers:

• Date

• Long

• Integer

• String

• VarChar

12. True or False? Commenting at the end of a line of code is permissible.

Answers:

• True

• False

13. To force all variables is a VBA project to be declared, which must be stated in a module?

Answers:

• Option Declare

• Option Implicit

• Option Explicit

• Option Variables

14. Which of the following do not work on Excel on Mac

Answers:

• ActiveX Controls

• Form Controls

15. What do you need to select to set the developer mode?

Answers:

• Show macro code settings

• Show mini toolbar on selection

• Show visual basic options menu

• Show developer tab in the Ribbon

16. The tab order in a user form:

Answers:

• ________ is a way to control the order in which the controls are selected using the TAB key.

• Requireing the user to assign numbers to each control on the user form

• Allowing the controls to be sorted alphabetically within the user form

• Arranging the worksheets in an Excel workbook

17. The shortcut keystroke to open the VBA IDE is:

Answers:

• Alt+F11

• Alt+Ctrl+F8

• Alt+V

• F10

18. Which of the following would you begin a comment line with?

Answers:

• Equal sign

• Double quote

• Underscore

• Single quote

19. You can use VBA to connect to a database in SQL Server using:

Answers:

• Access as a go-between

• an ADODB.Connection

• an ethernet cable

• Just a simple SQL statement

20. What is difference between a sub routine and a function.

Answers:

• Sub routine can return a value.

• Function can return a value.

21. Which of the following snippets of VBA code is not a loop?

Answers:

• Do While... Loop

• Do Until... Loop

• For Each.. Next

• Select Case... Case... Case Else... End Select

22. The RowSource property of a Combo Box control allows the user to:

Answers:

• have only one item in the drop-down list

• restrict which row of cells can be the source of input items for the drop-down list

• control where the output of selected item should go

• define the list of items, from a range of cells, to appear in a drop-down list

23. What does VBA stand for

Answers:

• Visual Basic for Applications

• Very Basic Applications

• Visual Basic Applied

• Virtual Basic for Advanced programming

24. What is a macro used for?

Answers:

• To automatically complete a series of Excel steps

• To access programs in Excel

• To link Excel files together

• To create buttons and forms in Excel

25. What does a VBA macro consist of?

Answers:

• User instructions and Excel functions

• Macro instructions that direct the user application and provide help to the user

• Excel functions

• Computer code that performs some actions on or with objects

26. To comment a block of code, you must first:

Answers:

• Turn on Num Lock

• Turn on Caps Lock

• Activate the Edit toolbar in the Visual Basic Editor

• Restart Excel

27. Correct this statement to start a 5-iteration loop: For x = 1 to 10 Step -2

Answers:

• For x = 1 to 10 Step 2

• For x = 1 to 5 Step 5

• For x = 1 to 5 Step 2

• For x = 1 to 10 Step 5

28. Is it possible to create an array with the lowerbound being two?

Answers:

• No

• Yes

• Sometimes

29. How do you declare the variable myvar  as an  integer?

Answers:

• Document myvar as an Integer

• Dim myvar As Integer

• Declare myvar is an Integer

30. The 'not equal to' operator is:

Answers:

• >=

• <>

• <=

• ==

31. Declaring a public variable allows the user to..

Answers:

• Use the variable anywhere in the project in which the variable was declared

• Use the variable anywhere in Excel

• Use the variable as a named range in Excel

• Use the variable only within the module in which the variable was declared

32. Which worksheet event can be used to run a procedure upon deleting the contents of a cell?

Answers:

• Click

• Change

• Activate

• Calculate

33. How do you figure out the number of items in a collection?

Answers:

• Using Count property

• Using Items property

• Using Contains method

• Using Ubound property

• (none of these are correct)

34. In the statement x = "4" + "5"', x = ?

Answers:

• 1

• 9

• 45

• -1

35. Which of the following VBA windows shows the code of the active object?

Answers:

• Code window

• Properties window

• Explorer Window

• Immediate window

36. What is the property of a cell that allows you to set the font color of the contents?

Answers:

• Cell.Color

• FontColor

• CellColor

• Font.Color

37. Using the Select Case construct is ideal when:

Answers:

• Too many if-then statements have already been used

• A variable is a Boolean type

• A variable can take on multiple values

• An action is taken regardless of the value a variable

38. What does the DoEvents do?

Answers:

• Declare a new event that can be fired from code

• Runs all events (built-in or custom) in a vb project

• Allows operation system to process other events

• Runs all Excel events in a vb project

39. Which code will allow user to edit a password protected worksheet.

Answers:

• Sheets("Sheet1").DisableProtect Password:="Password"

• Sheets("Sheet1").Unlock Password:="Password"

• Sheets("Sheet1").Unprotect

• Sheets("Sheet1").Unprotect Password:="Password"

• Sheets("Sheet1").Edit Password:="Password"

40. The way to pass the latest values of variables between functions and procedures is identified as:

Answers:

• ByChange

• ByRef

• (none of these)

• ByUpdate

41. What is the difference between activating and initializing a user form?

Answers:

• There are no differences. Both are run whenever a user form is shown.

• Activate will always run when showing a user form whereas Initialize will only run when showing a user form that has not been stored in memory.

• Initialize will always run when showing a user form whereas Activate will only run when showing a user form that has not been stored in memory.

• There are differences only if Option Explicit is stated.

42. Choose the VBA code that switches control from the application to the OS.

Answers:

• Goto

• Continue

• Wait

• DoEvents

43. Choose the VBA code that will allow you to verify that an Item exists in??the Dictionary object??Dict1.??

Answers:

• If xDict1.Exists("Testing") Then

• If xDict1.Item("Testing") Then

• If xDict1.Exists "Testing" Then

• If xDict1.Key("Testing")

44. To change the text displayed in a label on a form, choose the VBA code that will allow you to update the property.

Answers:

• Me.Label3.Value = "Hello"

• Me.Label3.Text = "Hello"

• Me.Label3.Caption = "Hello"

• Me.Label3 = "Hello"

45. Combine into one line: If x > 5 Then y = x - 5 End If

Answers:

• y = x - 5 If x > 5

• If x > 5 Then y = x - 5

• If x > 5 Then y = x - 5 End If

• If x > 5, y = x - 5

46. Dim a,b as integer What is the type of a?

Answers:

• integer

• variant

47. Which of the following functions do not perform a calculation

Answers:

• Sqr

• Val

• IPmt

• Exp

48. The statement 'Dim a, b as Single' declares the variables a and b as what variable types?

Answers:

• a as Single; b as Single

• a as Double, b as Single

• a as Variant; b as Single

• a as Double; b as Double

49. What value is x holding after this statement is executed: x = Left("Apple",3) & Right("People", 3)

Answers:

• Apple

• AppPeo

• Appple

• ApplePeople

50. If you want to create a definition for a custom object in VBA, which of the following would be the best choice to insert into your project?

Answers:

• Class Module

• UserForm

• Procedure

• Module

51. Which of these statements will start a loop of exactly 20 iterations?

Answers:

• For i = 2 to 22

• For i = 2 to 40 Step 2

• For i = 2 to 40

• For i = 1 to 21

52. To change a comment in cell A1, which will do the job?

Answers:

• Range("A1").Text("My Comment")

• Range("A1").Comment("My Comment")

• Range("A1") = "My Comment"

• Range("A1").Comment.Text("My Comment")

53. Month(#12/25/02#) will output?

Answers:

• December

• #12#

• 12

• #December

• #12

54. Which of the following actions will NOT cause a macro to run in Excel?

Answers:

• Add a new worksheet

• Click on a picture

• Open a workbook

• (all of these will NOT cause a macro to run in Excel)

55. When stepping through code as a way to see how the values in variables change, use the:

Answers:

• Watch Window

• Locals Window

• Variables Window

• Immediate Window

56. You have written a function called Switch requiring the input string parameters a and b.  The function will concatenate the values assigned to b and a, in that order. What line of code is needed within the function?

Answers:

• Switch = b & a

• Switch = "b" & "a"

• Switch = ba

• Switch = b, a

57. What will  Format(2.36, ???#0.0???) output?

Answers:

• "#.36

• ???2.4???

• "#2.4"

• "#2.36"

• "2.3"

58. What is the right syntax to raise your custom error?

Answers:

• RaiseError Number:=999, Description:="My custom error"

• Cannot raise custom error

• Error.Raise Number:=999, Description:="My custom error"

• Err.Raise Number:=999, Description:="My custom error"

59. In the next statement:    "Dim bValue   as Boolean" What will be the default value for "bValue" variable?

Answers:

• Undefined

• True

• Null

• Blank

• False

60. What is BOF?

Answers:

• A property of the Recordset object.

• All answers are correct.

• A property of the Document object.

61. The library to make ADODB.connection work.

Answers:

• Microsoft Active X Data Objects Recordset Microsoft ADO for DDL and Security Microsoft Add-Inn Designer MIcrosoft OLAP Designer Server Driver

• Microsoft Active X Data Objects

62. 'Do While x < 5' is equivalent to:

Answers:

• Do While x > 5

• Do While x <= 5

• Do Until x >= 5

• Do Until x > 5

63. Under which menu option in the VBA IDE can you password protect a VBA project?

Answers:

• Tools>References

• Tools>Options

• Tools>VBAProject Properties

• Tools>Protection

64. What is the difference between these commands CreateObject("Word.Application") GetObject(, "Word.Application")

Answers:

• The difference is only in performance.

• CreateObject always creates a new object. GetObject takes an existing one or create a new one.

• GetObject always creates a new object. CreateObject throws an error if no object of the class exists.

• CreateObject always creates a new object. GetObject throws an error if no object of the class exists.

65. Choose the VBA code to execute a Word MailMerge in Access

Answers:

• objWord.Execute MailMerge

• objWord.MailMerge

• Docmd.MailMerge

• objWord.MailMerge.Execute

66. As an alternative to the If.. Then.. ElseIf..Else condition, how would you format the Choose function with variable x1 and the following conditions:?? "Red", "Blue", "Yellow", "White"

Answers:

• Choose(x1,"Red","Blue","Yellow","White")

• Choose x1, "Red", "Blue", "Yellow", "White"

• Choose(x1 = "Red", x1 = "Blue", x1??= "Yellow", x1 = "White")

• Choose x1("Red", "Blue", "Yellow", "White")

67. When integrating Excel, instead of adding a reference, which VBA code would you use to open Microsoft Excel.

Answers:

• Set xlapp = CreateObject("Windows.Excel")

• Set xlapp = CreateObject("Application.Excel")

• Set xlapp = Excel.Application

• Set xlapp = CreateObject("Excel.Application")

68. What stores Excel data?

Answers:

• Variable

• Field

• (all of these)

• Compartment

69. When integrating Excel, which VBA code will allow you transfer data from recordset??xRec??in Access directly onto a spreadsheet (xlws) in Excel.

Answers:

• xlws.range("A1").CopyFromRecordset xRec

• Docmd.TransferSpreadsheet xlws, xRec

• xlws.CopyFromRecordset xRec

• Docmd.TransferDatabase xlws, xRec

70. True or False? An 'If-Then' statement must always be paired with an 'End If'.

Answers:

• True

• False

71. Which of the following snippets of VBA code will allow you to return the first array index in the array xItems?

Answers:

• xItems.MoveFirst

• LBound(xItems)

• First(xItems)

• UBound(xItems)

72. Choose the VBA code used to add a new record to the recordset xRec.

Answers:

• xRec.AddNew

• xRec.AddItem

• xRec.Add

• xRec.Edit

73. Choose the VBA code to remove data from Row 2 in a multiple column listbox.

Answers:

• Me.List0.Remove 2

• Me.List0.Delete 2

• Me.List0.Remove 1

• Me.List0.RemoveItem 1

74. With out creating a reference to the Microsoft Scripting Runtime for the DLL to create a Dictionary object, choose the VBA code to allow you to do so.

Answers:

• CreateObject "Dictionary.Scripting"

• CreateObject("Dictionary.Scripting")

• CreateObject("Application.Dictionary")

• CreateObject("Scripting.Dictionary")

75. Choose the VBA code that you would use to obtain the user login on a computer using a Windows operating system.

Answers:

• CurrentDb.User

• Environ("Username")

• CurrentProject.UserLogin

• Environ("User")

76. The application property that will assign a shortcut key to run a macro is:

Answers:

• ShortKey

• OnKey

• Shortcut

• Keystoke

77. Which Will Not  display VBA code?

Answers:

• Alt-F11

• Right mouse click workbook sheet then select view code

• Click Developer option in the ribbon then click Visual Basic button

• VBA view

78. In Access, which VBA code will allow you to suppress alerts when deleting records from a table.

Answers:

• DoCmd.Alerts False

• DoCmd.SetWarnings False

• DoCmd.SetWarnings Off

• DoCmd.Alerts Off

79. Which function will allow you to convert a value to number?

Answers:

• CStr

• CVal

• CCurr

• CLng

80. Is it possible to expand storage space for dynamic Array variables with two or more dimensions, keeping the existing data?

Answers:

• Yes, without restrictions.

• Yes, by changing the size of only the last dimension.

• Yes, by changing the size of only the first dimension.

• No.

81. Where you can create you custom events?

Answers:

• Only in modules

• Only in classes

• Classes and userforms but not in modules

• Only in userforms

• You can't create custom events

82. You want to dump the values stored in a 12-element array named Rates into the cell range A1:A12. ??How can you get that done?

Answers:

• Range("A1:A12") = Rates

• Range("A1:A12") = Rates(1 to 12)

• Range("A1:A12") = Rates(12)

• Range("A1:A12") = Application.WorksheetFunction.Transpose(Rates)

83. Choose the VBA code to filter the rowsource in a??multiple column listbox??that will allow you to filter the records listed using the LIKE statement and the variable xCompany.

Answers:

• Me.List0.RowSource = "SELECT * FROM tblOrders WHERE Company LIKE '*" & xCompany & "*'"

• Me.List0.RowSource = ??SELECT * FROM tblOrders WHERE Company LIKE '?? & xCompany & ??'??

• Me.List0.RowSource = ??SELECT * FROM tblOrders WHERE Company LIKE *'?? & xCompany & ??'*??

• Me.List0.RowSource = "SELECT * FROM tblOrders WHERE Company LIKE *" & xCompany

84. What will  Format(???A123???, ???&&&&&&???) output?

Answers:

• None of the above

• ???&A&1&2&3&&???

• ???A123???

• ???&&&A123???

• ???A123&&&???

85. Which statement will assign a random integer from 1 to 5 to the variable x?

Answers:

• x = Int(Rnd * 5)

• x = Int(Rnd * 5 + 1)

• x = Int(Rnd * 5) + 1

• x =Rnd * 5

86. Without using SQL, choose the VBA code to allow you to delete the table Employees.

Answers:

• CurrentDb.TableDefs.Delete "Employees"

• Docmd.Execute "Employees", Delete

• Docmd.Delete "Employees"

• CurrentDb.Execute DeleteTable, "Employees"

87. Choose the VBA code that will allow you to check to see if the form MainMenufrm is loaded.

Answers:

• If IsObject("MainMenufrm").Open Then

• If CurrentProject.AllForms("MainMenufrm").IsLoaded Then

• If IsObject("MainMenufrm").IsLoaded Then

• If Forms!MainMenufrm.IsLoaded Then

88. When you have added a new linked table using VBA code and it does not appear in Navigation Pane that displays the list of tables, forms, macros, and queries in the database.?? Which VBA code would you use to update the list of database objects displayed in the Navigation Pane.

Answers:

• Application.Refresh

• CurrentDb.Refresh

• CurrentDb.RefreshDatabase

• Application.RefreshDatabaseWindow

89. Choose the VBA code that you would use to call a public function named VBAFunction from??a form called??FormA??while passing a variant x1 in??the module of FormB form.??

Answers:

• Forms!FormA.VBAFunction x1

• Forms!FormA.VBAFunction(x1)

• Call VBAFunction x1

• Call VBAFunction(x1)

90. The ____________ allow(s) for multiple controls in a user form, to execute the same sub.

Answers:

• option buttons

• single command button

• class module

• grouped controls

91. Output of below code:     Dim a As Integer     Dim b As Integer              a = 1000     b = 33          MsgBox a * b

Answers:

• Run-time error '6': Overflow

• 0

• 32767

• 33000

92. Which is NOT a method of the Workspace object:

Answers:

• Activate

• Close

93. Out put of below code:     Dim a As Single     Dim b As Single              a = 7     b = 2          MsgBox a / b & ", " & a \ b

Answers:

• 3.5, 3

• 3, 3.5

• 3.5, 3.5

• 3, 3

94. To remove the records listed in a subform, which property and value would you need to add to your VBA code.

Answers:

• RowSource = ""

• ControlSource = ""

• RowSource = Null

• RecordSource = ""

95. Choose the VBA code used to close database and the Microsoft Access instance.

Answers:

• Me.Close

• Docmd.Close

• CurrentProject.Quit

• Docmd.Quit

96. What is a result of this code? Sub Test()     Dim myNumber As Double     myNumber = -10.635     Debug.Print Fix(myNumber)     Debug.Print Int(myNumber) End Sub

Answers:

• -10 -10

• 11 11

• -10 -11

• -11 -11

• 10 11

97. Which tools should be used to compile the program?

Answers:

• Setup Creator

• MS Visual Compiler

• .Exe Generator

• Package & Deployment Wizard

• Data Object Viewer

98. What is the short cut to get Immediate Window

Answers:

• Ctrl + M

• Ctrl + G

• Ctrl + W

• Ctrl + I

99. To change the font color a textbox field, choose the VBA code that will allow you change the control's property.

Answers:

• Me.Text11.BackColor = vbRed

• Me.Text11.Font.Color = vbRed

• Me.Text11.FontColor = vbRed

• Me.Text11.ForeColor = vbRed

100. Which of the following would NOT be a good use for a macro?

Answers:

• Inserting a logo on all spreadsheets

• Computing statistical calculations on data

• Performing the same calculation on multiple workbooks

101. A VBA unit is called a _____.

Answers:

• Program

• Routine

• Event Procedure

• Subroutine

• Executor

102. What reference will you add  to add active x objects ,i.e. buttons, at runtime?

Answers:

• Microsoft Visual Basic for Applications Extensibility Library

• Microsoft Active X Data Objects Microsoft Add-In Designer OLE Automation

103. Choose the VBA code to allow you to obtain the value from Row 2 and Column 3 of a mutliple column listbox.

Answers:

• Me.List0.Column 3, 2

• Me.List0.Column 2, 1

• Me.List0.Column(2,1)

• Me.List0.Column(3,2)

104. Choose the function used to send an table's contents in Excel format by email from Access.

Answers:

• call SendObject(acSendTable, "tblEmployees", acFormatXLS, "Sally Moore;")

• Application.SendEmail(acSendTable, "tblEmployees", acFormatXLS, "Sally Moore;")

• Docmd.SendObject(acSendTable, "tblEmployees", acFormatXLS, "Sally Moore;")

• Docmd.SendEmail(acSendTable, "tblEmployees", acFormatXLS, "Sally Moore;")

105. To create one array variable to store monthly mortgage rates over the course of a year, the following is the best declaration statement.

Answers:

• Dim Rates(1..12) as Integer

• Dim Rates(1 to 12) as Single

• Dim Rates(1 to 12) as Decimal

• Dim Rates(12) as Single

106. To concatenate two lines of VBA code into one line, insert which character between the two joined lines?

Answers:

• :

• ;

• &

• ,

107. In order to prevent users from deleting database objects displayed in the Navigation Pane, what VBA code would be used?

Answers:

• Docmd.LockNavigationPane True

• Me.NavigationPane.Locked = True

• CurrentDb.NavigationPane.Locked = True

• Application.LockNavigationPane = True

108. To return the value of the Access database file's path, what VBA code will retrieve the value?

Answers:

• CurDir

• Application.FilePath

• ChDir

• CurrentDB.Directory

109. How can we declare a subroutine or function in VBA?

Answers:

• Public, Private, Friend

• Public, Private

• Private, Public, Internal

• Protected, Public, Private

110. What is a Collection object?

Answers:

• An ordered set of same type items

• An ordered set of data

• An ordered set of objects

• An ordered set of items

111. In the statement 'x = 400 * y', what is the maximum value that y can be if x has been declared as in Integer?

Answers:

• 800

• 81

• 82

• 81.5

112. What is PlainText ?

Answers:

• A method

• None of the above.

• A property

• An object