JavaScript Language | 10 Minute‐Test 12


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.

Consider the following code snippet :

var o = new F();
o.constructor === F
The output would be :

A.
false
B.
true
C.
1
D.
0

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The result is true: the constructor property specifies the class.

2.

The object whose properties are inherited by all instances of the class, and properties whose values are functions behaving like instance methods of the class, is

A.
Instance object
B.
Constructor object
C.
Destructor object
D.
Prototype object

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The properties of the prototype object are inhertied by all instances of the class, and properties whose values are functions behave like instance methods of the class.

3.

Consider the following statement

var Set = sets.Set;
var s = new Set(1,2,3);
What could be the efficiency quotient of the above two statements ?

A.
The programmer imports at once the frequently used values into the global namespace.
B.
There is no efficiency quotient, the programmer tries to make it inefficient.
C.
The programmer needs to import the Sets everytime he wants to use it.
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

A programmer can import frequently used values into the global namespace. A programmer who was going to make frequent use of the Set class from the sets namespace might import the class like that.

4.

The regular expression to match any one character not between the brackets is

A.
[…]
B.
[^]
C.
[^…]
D.
[\D]

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The [^…] character class is used to match or draw any one character not between the brackets.

5.

What is being imposed on each subset to ensure that it conforms to the subset?

A.
A parser to parse the code
B.
A parser that parses and adds to the subset
C.
A static verifier that parses code
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Each subset is coupled with a static verifier that parses code to ensure that it conforms to the subset.

6.

The main difference between the variables declared with var and with let is

A.
var is confined to a particular function but let is not
B.
let is confined to a particular function but var is not
C.
var defines values based on conditions but let does not
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Variables declared with var are defined throughout the enclosing function. Variables declared with let are defined only within the closest enclosing block (and any blocks nested within it, of course).

7.

What will be the reaction when a catch clause has no conditionals ?

A.
Takes it to be 0
B.
Takes it to be 1
C.
Takes it to be true
D.
Takes it to be false

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

If a catch clause has no conditional, it behaves as if it has the conditional if true, and it is always triggered if no clause before it was triggered.

8.

What is the function used to remove all handlers for name events?

A.
deleteAllListeners(name)
B.
deleteListener(name,f)
C.
removerListener(name,f)
D.
removeAllListeners(name)

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The removeAllListeners(name) is used to remove all handlers from name events represented as :
emitter.removeAllListeners(name)

9.

Which of the following reads the textual contents of a URL and returns as a string?

A.
spawn(f);
B.
load(filename,…);
C.
readFile(file);
D.
readUrl(url);

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

Rhino defines a handful of important global functions that are not part of core JavaScript in which readUrl(url) reads the textual contents of a URL and return as a string.

10.

What is the command to run the node programs?

A.
node(program.js)
B.
program.js
C.
node program.js
D.
node.program.js
Submit your test now to view the Results and Statistics with answer explanation.