JavaScript Language | 10 Minute‐Test 9


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.

Which of the following Attribute is used to include External JS code inside your HTML Document

A.
src
B.
ext
C.
script
D.
link

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

A ”src” attribute could be used to add any external code into the HTML document.

2.

The statement a===b refers to

A.
Both a and b are equal in value, type and reference address
B.
Both a and b are equal in value
C.
Both a and b are equal in value and type
D.
There is no such statement

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

a==b returns a true if a and b refer to the same objec ,so they are equal, else it returns a false.

3.

“An expression that can legally appear on the left side of an assignment expression.” is a well known explanation for variables, properties of objects, and elements of arrays. They are called

A.
Properties
B.
Prototypes
C.
lvalue
D.
Definition

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

lvalue is a historical term that means “an expression that can legally appear on the left side of an assignment expression.” In JavaScript, variables, properties of objects, and elements of arrays are lvalues.

4.

Consider the following statements

var count = 0;

while (count < 10)

{

     console.log(count);

     count++;

}


In the above code snippet, what happens?

A.
The values of count is logged or stored in a particular location or storage.
B.
The value of count from 0 to 9 is displayed in the console.
C.
An error is displayed
D.
An exception is thrown

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None.

5.

Consider the following code snippet

function f(o)

{

     if (o === undefined) debugger;

}


What could be the task of the statement debugger?

A.
It does nothing but a simple breakpoint
B.
It debugs the error in that statement and restarts the statement’s execution
C.
It is used as a keyword that debugs the entire program at once
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The debugger statement normally does nothing. If, however, a debugger program is available and is running, then an implementation may (but is not required to) perform some kind of debugging action. In practice, this statement acts like a breakpoint: execution of JavaScript code stops and you can use the debugger to print variable’s values.

6.

Identify the process done in the below code snippet

o = {x:1, y:{z:[false,null,""]}};

s = JSON.stringify(o);

p = JSON.parse(s);

A.
Object Encapsulation
B.
Object Serialization
C.
Object Abstraction
D.
Object Encoding

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Object serialization is the process of converting an object’s state to a string from which it can later be restored.

7.

The reduce and reduceRight methods follow a common operation called

A.
filter and fold
B.
inject and fold
C.
finger and fold
D.
fold

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

None

8.

Which is an equivalent code to invoke a function m of class o that expects two arguments x and y?

A.
o(x,y);
B.
o.m(x) && o.m(y);
C.
m(x,y);
D.
o.m(x,y);

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The code above is an invocation expression: it includes a function expression o.m and two argument expressions, x and y.

9.

Consider the following code snippet :

var c = counter(),d = counter();

c.count()

d.count()

c.reset()

c.count()

d.count()


The state stored in d is :

A.
1
B.
0
C.
Null
D.
Undefined

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The state stored in d is 1 because d was not reset.

10.

What is the purpose of the dynamic scoping?

A.
Variables can be declared outside the scope
B.
Variables must be declared outside the scope
C.
Variables cannot be declared outside the scope
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Dynamic scoping creates variables that can be called from outside the block of code in which they are defined. A variable declared in this fashion is sometimes called a public variable.


Submit your test now to view the Results and Statistics with answer explanation.