JavaScript Language | 10 Minute‐Test 5


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.

JavaScript is ideal to

A.
make computations in HTML simpler
B.
minimize storage requirements on the web server
C.
increase the download time for the client
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

To minimise storage requirements, JavaScript is always a better say.

2.

When there is an indefinite or an infinity value during an arithmetic value computation, javascript

A.
Prints an exception error
B.
Prints an overflow error
C.
Displays “Infinity”
D.
Prints the value as such

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

When the result of a numeric operation is larger than the largest representable number (overflow), the result is a special infinity value, which JavaScript prints as Infinity. Similarly, when a negative value becomes larger than the largest representable negative number, the result is negative infinity, printed as -Infinity. The infinite values behave as you would expect: adding, subtracting, multiplying, or dividing them by anything results in an infinite value (possibly with the sign reversed).

3.

The JavaScript’s syntax calling ( or executing ) a function or method is called

A.
Primary expression
B.
Functional expression
C.
Invocation expression
D.
Property Access Expression

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

An invocation expression is JavaScript’s syntax for calling (or executing) a function or method. It starts with a function expression that identifies the function to be called.

4.

A statement block is a

A.
conditional block
B.
block that contains a single statement
C.
Both a and b
D.
block that combines multiple statements into a single compound statement

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

A statement block is a block that combines more than one statements into a single compound statement for ease.

5.

One of the special feature of an interpreter in reference with the for loop is that

A.
Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property
B.
The iterations can be infinite when an interpreter is used
C.
The body of the loop is executed only once
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property (a string value) to it.

6.

Consider the below given syntax

book[datatype]=assignment_value;
In the above syntax, the datatype within the square brackets must be

A.
An integer
B.
A String
C.
An object
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

When using square bracket notation, the expression inside the square brackets must evaluate to a sting or a value that can be converted to a string.

7.

What will happen if reverse() and join() methods are used simultaneously ?

A.
Reverses and stores in the same array
B.
Reverses and concatenates the elements of the array
C.
Reverses
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The reverse() followed by a join() will reverse the respective array and will store the reversed array in the memory.

8.

What will happen if a return statement does not have an associated expression?

A.
It returns the value 0
B.
It will throw an exception
C.
It returns the undefined value
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

If the return statement does not have an associated expression, it returns the undefined value.

9.

Consider the following code snippet :

function constfuncs()

{

    var funcs = [];

    for(var i = 0; i < 10; i++)

        funcs[i] = function() { return i; };

    return funcs;

}

var funcs = constfuncs();

funcs[5]()

What does the last statement return ?

A.
5
B.
0
C.
9
D.
10

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The code above creates 10 closures, and stores them in an array. The closures are all defined within the same invocation of the function, so they share access to the variable i. When constfuncs() returns, the value of the variable i is 10, and all 10 closures share this value. Therefore, all the functions in the returned array of functions return the same value.

10.

Which of the following uses a lot of CPU cycles?

A.
GUI
B.
Statically generated graphics
C.
Dynamically generated graphics
D.
All of the mentioned
Submit your test now to view the Results and Statistics with answer explanation.