Javascript Mock Test


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

Javascript Mock Test I

Answer : D

Explanation

All of the above options are correct.

Answer : C

Explanation

Both of the above options are correct.

Answer : D

Explanation

All of the above options are correct.

Q 6 - Is JavaScript a case-sensitive language?

A - true

B - false

Answer : A

Explanation

Yes! JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.

Answer : C

Explanation

Both of the above options are correct.

Answer : C

Explanation

Both of the above options are correct.

Answer : C

Explanation

Both of the above options are correct.

Q 10 - Can you access Cookie using javascript?

A - true

B - false

Answer : A

Explanation

Yes! JavaScript can also manipulate cookies using the cookie property of the Document object.

Answer : A

Explanation

document.cookie = 'key1 = value1; key2 = value2; expires = date'; is the correct option.

Answer : D

Explanation

window.location='http://www.newlocation.com'; is the correct option.

Q 14 - Which of the following is the correct syntax to print a page using JavaScript?

A - window.print();

B - browser.print();

C - navigator.print();

D - document.print();

Answer : A

Explanation

window.print(); is the correct option.

Q 15 - 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

Explanation

A function in JavaScript can be either named or anonymous.

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

A - true

B - false

Answer : A

Explanation

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

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

A - true

B - false

Answer : A

Explanation

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

Q 18 - 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

Explanation

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

Q 19 - 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

Explanation

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

Q 20 - 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

Explanation

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

Q 21 - 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

Explanation

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 22 - 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

Explanation

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

Answer : C

Explanation

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 24 - Which built-in method returns the character at the specified index?

A - characterAt()

B - getCharAt()

C - charAt()

D - None of the above.

Answer : C

Explanation

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

Q 25 - 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

Explanation

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

Answer Sheet

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