VBScript Mock Test


Advertisements

This section presents you various set of Mock Tests related to VBScript Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

VBScript Mock Test III

Q 1 - What StrComp(String1, String2) returns if String1 is greater than String2 in lexicographical order?

A - -1

B - 0

C - 1

D - None of the above.

Answer : C

Explaination

StrComp(String1, String2) returns 1 if String1 is greater than String2 in lexicographical order.

Q 2 - How will you get a string with the specified character the specified number of times in VBScript?

A - Using Replace function

B - Using Compare function

C - Using InStr function

D - Using String function

Answer : D

Explaination

Using String function, which returns a String with a specified character the specified number of times.

Answer : A

Explaination

Using StrReverse function, which returns a String after reversing the sequece of the characters of the given string.

Q 4 - Which of the following is a correct way to declare array in VBScript?

A - Dim arr1()

B - Dim arr2(5)

C - Dim arr3 = Array("apple","Orange","Grapes")

D - All of the above.

Answer : D

Explaination

All of the above options are correct.

Q 5 - Which of the following is a correct way to assign a value to an array element in VBScript?

A - arr(0) = "VBScript"

B - arr[0] = "VBScript"

C - arr.set(0,"VBScript")

D - None of the above.

Answer : A

Explaination

arr(0) = "VBScript" is the correct way.

Q 6 - How will you increase the size of an array in VBScript?

A - Using ReDim statement

B - Using LBound function

C - Using UBound function

D - Using Split function

Answer : A

Explaination

Using ReDim statement, we can declare dynamic-array variables and allocate or reallocate storage space.

Q 7 - How will you get the smallest subscript of an array in VBScript?

A - Using ReDim statement

B - Using LBound function

C - Using UBound function

D - Using Split function

Answer : B

Explaination

Using LBound function, which returns an integer that corresponds to the smallest subscript of the given arrays.

Q 8 - How will you get the largest subscript of an array in VBScript?

A - Using ReDim statement

B - Using LBound function

C - Using UBound function

D - Using Split function

Answer : C

Explaination

Using UBound function, which returns an integer that corresponds to the largest subscript of the given arrays.

Q 9 - How will you split a string into an array in VBScript?

A - Using ReDim statement

B - Using LBound function

C - Using UBound function

D - Using Split function

Answer : D

Explaination

Using Split function, which returns an array that contains a specified number of values. Split will be based on a Delimiter.

Q 10 - How will you get a combined string from array of string in VBScript?

A - Using Join function

B - Using Filter function

C - Using IsArray function

D - Using Erase Function

Answer : A

Explaination

Using Join function, which returns a String that contains a specified number of substrings in an array.

Answer : B

Explaination

Using Filter function, returns a zero based array that contains a subset of a string array based on a specific filter criteria.

Q 12 - How will you check that a variable is an array in VBScript?

A - Using Join function

B - Using Filter function

C - Using IsArray function

D - Using Erase Function

Answer : C

Explaination

Using IsArray function, which returns a boolean value that indicates whether or not the input variable is an array.

Q 13 - How will you release the memory acquired by an array variable in VBScript?

A - Using Join function

B - Using Filter function

C - Using IsArray function

D - Using Erase Function

Answer : D

Explaination

Using Erase Function, which recovers the allocated memory for the array variables.

Answer : A

Explaination

To invoke a function in the script, you would simple need to write the name of that function with the Call keyword.

Answer : B

Explaination

To return a value from a function, simply assign the value to the function name itself.

Q 16 - Can in VBScript, function return multiple values?

A - True

B - False

Answer : A

Explaination

Yes! A function can return multiple values separated by comma as an array assigned to the function name itself.

Q 18 - How to pass argument by value to a function in VBScript?

A - Using ByVal keyword

B - Using ByRef keyword

C - Both of the above.

D - None of the above.

Answer : A

Explaination

If ByVal is specified, then the arguments are sent as by value when the function or procedure is called.

Q 19 - How to pass argument by reference to a function in VBScript?

A - Using ByVal keyword

B - Using ByRef keyword

C - Both of the above.

D - None of the above.

Answer : B

Explaination

If ByRef is specified, then the arguments are sent as by reference when the function or procedure is called.

Answer : A

Explaination

Set obj = CreateObject("Scripting.Dictionary") creates an object.

Q 21 - Which of the following statements destroys an object in VBScript?

A - delete obj

B - Set obj = Nothing

C - Both of the above.

D - None of the above.

Answer : B

Explaination

Set obj = Nothing destroys an object.

Q 25 - Which of the following event is triggered when an object is instantiated in VBScript?

A - Class_Initialize

B - Class_Terminate

C - None of the above.

D - Both of the above.

Answer : A

Explaination

Class_Initialize is triggered whenever you instantiate an object based on the class.

Answer Sheet

Question Number Answer Key
1 C
2 D
3 A
4 D
5 A
6 A
7 B
8 C
9 D
10 A
11 B
12 C
13 D
14 A
15 B
16 A
17 D
18 A
19 B
20 A
21 B
22 D
23 D
24 D
25 A
vbscript_questions_answers.htm
Advertisements