JavaScript Language | 10 Minute‐Test 13


Instruction

  • Total number of questions : 10.
  • Time alloted : 10 minutes.
  • Each question carry 1 mark.
  • No Negative marks
  • DO NOT refresh the page.
  • All the best :-).

1.

The basic difference between JavaScript and Java is

A.
There is no difference
B.
Functions are considered as fields
C.
Variables are specific
D.
functions are values, and there is no hard distinction between methods and fields

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The basic difference between JavaScript and Java is that the functions are values, and there is no hard distinction between methods and fields.

2.

Which are usually variables that are used internally in object methods and also are globally visible variables?

A.
Object properties
B.
Variable properties
C.
Method properties
D.
Internal properties

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The variable properties are usually variables that are used internally in the objects methods, but can also be globally visible variables that are used through the page.

3.

The scope of a function is also called as

A.
The function’s scope
B.
Module function
C.
Modulated function
D.
Private function

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The scope of a function can be used as a private namespace for a module. Therefore, the scope of a function is called a module function.

4.

What does /[^(]* regular expression indicate ?

A.
Match one or more characters that are not open paranthesis
B.
Match zero or more characters that are open paranthesis
C.
Match zero or more characters that are not open paranthesis
D.
Match one or more characters that are open paranthesis

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

We should always be careful while using * and ? as repetition characters as they may match zero instances of whatever precedes them, they are allowed to match nothing.

5.

Why was “The Good Parts” designed as a language subset in JavaScript?

A.
To improve programmer flexibility
B.
To balance the work load of the programmer
C.
To create an in-built compiler and interpreter
D.
To improve programmer productivity

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The Good Parts is a language subset designed for aesthetic reasons and with a desire to improve programmer productivity. There is a larger class of subsets that have been designed for the purpose of safely running untrusted JavaScript in a secure container or “sandbox”.

6.

Consider the following code snippet

function oddsums(n)

{

     let total = 0, result=[];

     for(let x = 1; x <= n; x++)

     {

        let odd = 2*x-1;

        total += odd;

        result.push(total);

     }

     return result;

}


What would be the output if
oddsums(5);
is executed afted the above code snippet ?

A.
Returns [1,4,9,16,25]
B.
Returns [1,2,3,4,5]
C.
Returns [3,6,9,12,15]
D.
Returns [1,3,5,7,9]

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The above code returns 1,4,9,16,25 which is the square of the first five natural numbers. Notice the usage of let keyword in the above code snippet.

7.

When will the finally block be called?

A.
When there is no exception
B.
When the catch doesnot match
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

A finally block is called after try-catch execution.

8.

Which function is a synonym for on()?

A.
addListener()
B.
listeners()
C.
once()
D.
add()

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The on() method is used for registering handlers. addListener() is a synonym for on().

9.

Which Rhino command quits Rhino environment?

A.
terminate()
B.
exit()
C.
quit()
D.
close()

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The quit() command makes Rhino exit.

10.

What is the alternative command used in Node for load()?

A.
store()
B.
module()
C.
log()
D.
require()
Submit your test now to view the Results and Statistics with answer explanation.