JavaScript Language | 10 Minute‐Test 2


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 main purpose of a “Live Wire” in NetScape is to

A.
Create linkage between client side and server side
B.
Permit server side, JavaScript code, to connect to RDBMS
C.
Support only non relational database
D.
To interpret JavaScript code

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

A Live Wire database driver also supports a number of non-relational databases.

2.

The type of a variable that is volatile is

A.
Volatile variable
B.
Mutable variable
C.
Immutable variable
D.
Dynamic variable

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The variables whose values can be changed are called mutable variable types.

3.

A function definition expression can be called

A.
Function prototype
B.
Function literal
C.
Function definition
D.
Function declaration

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

a function definition expression is a “function literal” in the same way that an object initializer is an “object literal.” A Function definition expression typically consists of the keyword function followed by a comma-separated list of zero or more identifiers (the parameter names) in parentheses and a block of JavaScript code (the function body) in curly braces.

4.

The output for the following code snippet would most appropriately be

var a=5 , b=1

var obj = { a : 10 }

with(obj)

{

      alert(b)

}

A.
10
B.
Error
C.
1
D.
5

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The interpreter checks obj for property b, fails and takes it from outside of with.

5.

What are the three important manipulations done in a for loop on a loop variable?

A.
Updation, Incrementation, Initialization
B.
Initialization,Testing, Updation
C.
Testing, Updation, Testing
D.
Initialization,Testing, Incrementation

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

In a for loop, the initialization, the test, and the update are the three crucial manipulations of a loop variable.

6.

The object has three object attributes namely

A.
Class, parameters, object’s extensible flag
B.
Prototype, class, objects’ parameters
C.
Prototype, class, object’s extensible flag
D.
Native object, Classes and Interfacces and Object’s extensible flag

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Every object has three associated object attributes :
An object’s prototype is a reference to another object from which properties are inherited.
An object’s class is a string that caegorizes the type of an object.
An object’s extensible flag specifies whether new properties may be added to the object.

7.

Consider the following code snippet

var a1 = [,,,];

var a2 = new Array(3);

0 in a1

0 in a2


The result would be

A.
true false
B.
false true
C.
true true
D.
false true

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

a1 has an element with index 0 and a2 has no element with index 0.

8.

Consider the following code snippet

function printprops(o)

{

    for(var p in o)

      console.log(p + ": " + o[p] + "\n");

}


What will the above code snippet result ?

A.
Prints the contents of each property of o
B.
Returns undefined
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The above code snippet returns undefined.

9.

Do functions in JavaScript necessarily return a value ?

A.
It is mandatory
B.
Not necessary
C.
Few functions return values by default
D.
All of the above

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

10.

What must be done in order to implement Lexical Scoping?

A.
Get the object
B.
Dereference the current scope chain
C.
Reference the current scope chain
D.
one of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

In order to implement lexical scoping, the internal state of a JavaScript function object must include not only the code of the function but also a reference to the current scope chain.


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