JavaScript Language | 10 Minute‐Test 1


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 development environment offers which standard construct for data validation

A.
Super controlled loop constructs
B.
Case sensitivity check
C.
Validation constructs
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

All these facilities are available in JavaScript. Additionally, all development environments provide syntax to create and use memory variables, constants, and functions.

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.

Consider the following snippet code

var string1 =123;

var intvalue = 123;

alert( string1 + intvalue );


The result would be

A.
123246
B.
246
C.
123123
D.
Exception

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

None.

4.

JavaScript is a _______________ language

A.
Object-Oriented
B.
High-level
C.
Assembly-language
D.
Object-Based

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

JavaScript is not a full-blown OOP (Object-Oriented Programming) language, such as Java or PHP, but it is an object-based language.

5.

Consider the following code snippet

x=[1,2,3,4,5]

printArray(x)

function printArray(a)

{

     var len = a.length, i = 0;

     if (len == 0)

        console.log("Empty Array");

     else

     {

         do

         {

             console.log(a[i]);

         }

while (++i < len);

     }

}


What does the above code result?

A.
Prints the numbers in the array in order
B.
Prints the numbers in the array in the reverse order
C.
Prints 0 to the length of the array
D.
Prints “Empty Array”

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The do/while loop is less commonly used when compared to the while loop. Here, it prints from the array in the given order.

6.

The unordered collection of properties, each of which has a name and a value is called

A.
String
B.
Object
C.
Serialized Object
D.
All of the above

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

An object is an unordered collection of properties, each of which has a name and a value. Property names are strings, so we can say that objects map strings to values.

7.

Consider the code snippet given below

var count = [1,,3];
What is the observation made?

A.
The omitted value takes “undefined”
B.
This results in an error
C.
This results in an exception
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

If you omit a value from an array literal, the omitted element is given the value.

8.

The function definitions in JavaScript begins with

A.
Identifier and Parantheses
B.
Return type and Identifier
C.
Return type, Function keyword, Identifier and Parantheses
D.
Identifier and Return type

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The function definitions begin with the keyword function followed by an identifier that names the function and a pair of parantheses around a comma-separated list of zero or more identifiers.

9.

Consider the following code snippet :

var grand_Total=eval("10*10+5");
The output for the above statement would be :

A.
10*10+5
B.
105 as a string
C.
105 as an integer value
D.
Exception is thrown

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Even if the string value passed as a parameter to eval does represent a numeric value the use of eval() results in an error being generated.

10.

What kind of scoping does JavaScript use?

A.
Literal
B.
Lexical
C.
Segmental
D.
Sequential

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Like most modern programming languages, JavaScript uses lexical scoping. This means that functions are executed using the variable scope that was in effect when they were defined, not the variable scope that is in effect when they are invoked.


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