JavaScript Language | 10 Minute‐Test 14


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 meaning for Augmenting classes is that

A.
objects inherit prototype properties even in dynamic state
B.
objects inherit prototype properties only in dynamic state
C.
objects inherit prototype properties in static state
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

JavaScript’s prototype-based inheritance mechanism is dynamic: an object inherits properties from its prototype, even if the prototype changes after the object is created. This means that we can augment JavaScript classes simply by adding new methods to their prototype objects.

2.

JavaScript Code can be called by using

A.
RMI
B.
Triggering Event
C.
Preprocessor
D.
Function/Method

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

JavaScript code is as easy to be implemented and run. It can be called by using a function or a method.

3.

Modules that have more than one item in their API can

A.
Assign itself to a global variable
B.
Invoke another module of the same kind
C.
Return a namespace object
D.
Invoke another module of the same kind

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Modules that have more than one item in their API can return a namespace object.

4.

What will be the result when non greedy repetition is used on the pattern /a+?b/ ?

A.
Matches the letter b preceded by the fewest number of a’s possible
B.
Matches the letter b preceded by any number of a
C.
Matches letter a preceded by letter b, in the stack order
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Using non greedy repetition may not always produce the results you expect. /a+?b/ matches the letter b preceded by the fewest number of a’s possible.

5.

Which is the subset that is a secure container designed for the purpose of safely running untrusted JavaScript?

A.
Sandbox
B.
The Good Parts
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

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

console.log(p)
If p is not defined, what would be the result or type of error?

A.
Zero
B.
Null
C.
ReferenceError
D.
ValueNotFoundError

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

In the above code snippet, p is not defined. Hence, it gives a ReferenceError.

7.

What is the return type of typeof for standard JavaScript objects?

A.
xml
B.
object
C.
DOM
D.
html

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The typeof operator returns “object” for all standard JavaScript objects as functions are, and the typeof operator returns “xml”.

8.

Which of the following is an event emitter?

A.
once
B.
process
C.
listeners
D.
on

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The process object is an event emitter. The Node defines other important globals under the process namespaces that contain properties of that object like version, argv, env, pid,getuid(), cwd(), chdir() and exit().

9.

Which is a useful way to try out small and simple Rhino programs and one-liners?

A.
Starting an interative shell
B.
Starting a one to one shell
C.
Creating a thread to do simple programs
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Rhino is distributed as a JAR archieve. Start it with a command line like this :
java -jar rhino1_7R2/js.jar program.js If you omit program.js, Rhino starts an interactive shell, which is useful for trying out simple programs and one-liners.

10.

What is the command used for debugging output in Node?

A.
print();
B.
console.log(…);
C.
debug(…);
D.
execute(…);
Submit your test now to view the Results and Statistics with answer explanation.