jQuery - Mock Test



This section presents you various set of Mock Tests related to jQuery 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

jQuery Mock Test I

Q 4 - Which of the following is a valid type of function javascript supports?

A - named function

B - anonymous function

C - Both of the above.

D - None of the above.

Answer : C

Explaination

A function in JavaScript can be either named or anonymous.

Q 5 - Can you assign a anonymous function to a variable?

A - true

B - false

Answer : A

Explaination

Yes! An anonymous function can be assigned to a variable.

Q 6 - Can you pass a anonymous function as an argument to another function?

A - true

B - false

Answer : A

Explaination

Yes! An anonymous function can be passed as an argument to another function.

Q 7 - How can you get the type of arguments passed to a function?

A - using typeof operator

B - using getType function

C - Both of the above.

D - None of the above.

Answer : A

Explaination

Using typeof operator, we can get the type of arguments passed to a function.

Q 8 - How can you get the total number of arguments passed to a function?

A - Using args.length property

B - Using arguments.length property

C - Both of the above.

D - None of the above.

Answer : B

Explaination

Using arguments.length property, we can get the total number of arguments passed to a function.

Q 9 - Which of the following type of variable is visible everywhere in your JavaScript code?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

Answer : A

Explaination

Global Variables: A global variable has global scope which means it is visible everywhere in your JavaScript code.

Q 10 - Which of the following type of variable is visible only within a function where it is defined?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

Answer : B

Explaination

Local Variables: A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.

Q 11 - Which of the following type of variable takes precedence over other if names are same?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

Answer : B

Explaination

A local variable takes precedence over a global variable with the same name.

Answer : C

Explaination

A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered.

Q 13 - Which built-in method returns the character at the specified index?

A - characterAt()

B - getCharAt()

C - charAt()

D - None of the above.

Answer : C

Explaination

charAt() method returns the character at the specified index.

Q 14 - Which built-in method combines the text of two strings and returns a new string?

A - append()

B - concat()

C - attach()

D - None of the above.

Answer : B

Explaination

concat() method returns the character at the specified index.

Q 15 - Which built-in method calls a function for each element in the array?

A - while()

B - loop()

C - forEach()

D - None of the above.

Answer : C

Explaination

forEach() method calls a function for each element in the array.

Q 16 - Which built-in method returns the index within the calling String object of the first occurrence of the specified value?

A - getIndex()

B - location()

C - indexOf()

D - None of the above.

Answer : C

Explaination

indexOf() method returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.

Q 17 - Which built-in method returns the length of the string?

A - length()

B - size()

C - index()

D - None of the above.

Answer : A

Explaination

length() method returns the length of the string.

Q 18 - Which built-in method removes the last element from an array and returns that element?

A - last()

B - get()

C - pop()

D - None of the above.

Answer : C

Explaination

pop() method removes the last element from an array and returns that element.

Q 19 - Which built-in method adds one or more elements to the end of an array and returns the new length of the array?

A - last()

B - put()

C - push()

D - None of the above.

Answer : C

Explaination

push() method adds one or more elements to the end of an array and returns the new length of the array.

Q 20 - Which built-in method reverses the order of the elements of an array?

A - changeOrder(order)

B - reverse()

C - sort(order)

D - None of the above.

Answer : B

Explaination

reverse() method reverses the order of the elements of an array -- the first becomes the last, and the last becomes the first.

Q 21 - Which built-in method sorts the elements of an array?

A - changeOrder(order)

B - order()

C - sort()

D - None of the above.

Answer : C

Explaination

sort() method sorts the elements of an array.

Q 22 - Which built-in method returns the characters in a string beginning at the specified location?

A - substr()

B - getSubstring()

C - slice()

D - None of the above.

Answer : A

Explaination

substr() method returns the characters in a string beginning at the specified location through the specified number of characters.

Q 23 - Which built-in method returns the calling string value converted to lower case?

A - toLowerCase()

B - toLower()

C - changeCase(case)

D - None of the above.

Answer : A

Explaination

toLowerCase() method returns the calling string value converted to lower case.

Q 24 - Which built-in method returns the calling string value converted to upper case?

A - toUpperCase()

B - toUpper()

C - changeCase(case)

D - None of the above.

Answer : A

Explaination

toUpperCase() method returns the calling string value converted to upper case.

Q 25 - Which built-in method returns the string representation of the number's value?

A - toValue()

B - toNumber()

C - toString()

D - None of the above.

Answer : C

Explaination

toString() method returns the string representation of the number's value.

Answer Sheet

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