JavaScript Language | 10 Minute‐Test 11


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 keyword or the property that you use to refer to an object through which they were invoked is

A.
from
B.
to
C.
this
D.
object

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The ‘this’ keyword is used to refer to the object through which the properties or methods were invoked. This use of ‘this’ is a fundamental characteristic of the methods of any class.

2.

The properties of the objects act like different kinds of class members. They are

A.
Public object, Private object, Protected object
B.
Constructor object, Function object, Destructor object
C.
Constructor object, Prototype object, Instance object
D.
Instance method, Static object, Dynamic object

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

In JavaScript, there are three different objects involved inany class definition, and the properties of these three objects act like different kinds of class members namely, Constructor object, Prototype object, and Instance object.

3.

The maximum number of global symbols a module can define is

A.
2
B.
3
C.
1
D.
4

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Generally, the various modules are allowed to run in the pristine (or near pristine) environment that it expects. The modules should minimize the number of global symbols they define – ideally, no module should define more than one.

4.

Consider the following statement containing regular expressions

var text = "testing: 1, 2, 3";
var pattern = /\d+/g;
In order to check if the pattern matches, the statement is

A.
text==pattern
B.
text.equals(pattern)
C.
text.test(pattern)
D.
pattern.test(text)

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The given pattern is applied on the text given in the paranthesis.

5.

Why does JavaScript subset disallow == and !=?

A.
It uses bitwise checking
B.
It uses === and !== instead
C.
It uses equals() and notequals() instead
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The subset does not include the comma operator, the bitwise operators, or the ++ and — operators. It also disallows == and != because of the type conversion they perform, requiring use of === and !== instead.

6.

The let keyword can be used

A.
in a for or for/in loop, as a substitute for var
B.
as a block statement, to define new variables
C.
to define variables that are scoped to a single expression
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The let keyword can be used in four ways :
1.as a variable declaration like var;
2.in a for or for/in loop, as a substitute for var;
3.as a block statement, to define new variables and explicitly delimit their scope; and
4.to define variables that are scoped to a single expression.

7.

Consider the following code snippet

data.sort(function(a,b),b-a);
What does the above code do?

A.
Sort in the alphabetical order
B.
Sort in the chronological order
C.
Sort in reverse alphabetical order
D.
Sort in reverse numerical order

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The above code snippet sorts an array in reverse numerical order.

8.

What is the function used to deregister event handler ‘f’?

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

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The removeListeners(name,f) is used to deregister event handler f represented as :
emitter.removeListener(name,f)

9.

Which of the following are global functions that are not part of core JavaScript?

A.
spawn(f);
B.
trim();
C.
exult();
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The spawn(f) runs f() or loads and executes file f in a new thread.

10.

Why does the Node rely on event handlers?

A.
APIs are synchronous
B.
APIs are asynchronous
C.
APIs are reusable
D.
None of the mentioned
Submit your test now to view the Results and Statistics with answer explanation.