JavaScript Language | 30 Minute Test 7


Instruction

  • Total number of questions : 30.
  • Time alloted : 30 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.

11.

The behaviour of the instances present of a class inside a method is defined by

A.
Method
B.
Classes
C.
Interfaces
D.
Classes and Interfaces

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The behaviour of the instance of a class is defined by the class and is shared by all instances

12.

The four kinds of class members are

A.
Instance methods, Instance fields, Static method, Dynamic method
B.
Instance fields, Instance methods, Class fields, Class methods
C.
Instance fields, Non-instance fields, Dynamic methods, Global methods
D.
Global methods, Local methods, Dynamic methods, Static methods

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The four kinds of class members are Instance fields, Instance methods, Class fields, Class methods.

13.

The functions provide() and require() of Dojo toolkit and Google’s Closure library are used for

A.
declaring and loading modules
B.
loading and declaring modules
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Both the Dojo toolkit and Google’s Closure library define provide() and require() functions for declaring and loading modules.

14.

The ‘$’ present in the RegExp object is called a

A.
character
B.
matcher
C.
metacharacter
D.
metadata

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The ‘S’ is a special metacharacter that matches the end of a string.

15.

The Crockford’s subset doesnot include which function in JavaScript?

A.
eval()
B.
coeval()
C.
equal()
D.
equivalent()

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The Crockford’s subset does not include the with and continue statements or the eval() function. It defines functions using function definition expressions only and does not include the function definition statement.

16.

Consider the following code snippet

const pi=3.14;

var pi=4;

console.log(pi);


What will be the output for the above code snippet?

A.
This will flash an error
B.
Prints 4
C.
Prints 3.14
D.
Ambiguity

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The above code snippet will flash an error. Attempts to alter the value or re-declaration causes errors.

17.

Consider the following code snippet

let succ = function(x) x+1, yes = function() true, no = function() false;


What convenience does the above code snippet provide?

A.
Functional behaviour
B.
Modular behaviour
C.
No convenience
D.
Shorthand expression

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The functions defined in this way behave exactly like functions defined with curly braces and the return keyword.

18.

What are the events generated by the Node objects called?

A.
generators
B.
emitters
C.
dispatchers
D.
highevents

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Node objects that generate events (known as event emitters) define an on() method for registering handlers.

19.

Rhino is originated by

A.
Microsoft
B.
Mozilla
C.
Apple
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Rhino is free software from Mozilla. You can download a copy from http://www.mozilla.org/rhino/.

20.

Which is a fast C++ based JavaScript interpreter?

A.
Node
B.
Sockets
C.
Processors
D.
Closures

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Node is a fast C++-based JavaScript interpreter with bindings to the low-level Unix APIs for working with processes, files, network sockets, etc., and also to HTTP client and server APIs.

21.

Which are the forms of client-side storage?

A.
Web Databases
B.
FileSystem API
C.
Offline Web Applications
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The various forms of client-side storage are web databases, filesystem API, Offline web applications and cookies.

22.

Which of the following is a way of embedding Client-side JavaScript code within HTML documents?

A.
From javascript:encoding
B.
External file specified by the src attribute of a “script” tag
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The Client-side JavaScript code is embedded within HTML documents in four ways :
1.Inline, between a pair of “script” tags
2.From an external file specified by the src attribute of a “script” tag
3.In an HTML event handler attribute, such as onclick or onmouseover
4.In a URL that uses the special javascript: protocol.

23.

The word “document” mainly refers to

A.
Dynamic Information
B.
Static Information
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Some pages present static information and can be called documents.

24.

What is the property to access the first child of a node?

A.
timestamp.Child1
B.
timestamp.Child(1)
C.
timestamp.Child(0)
D.
timestamp.firstChild

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The first child of a node can be accessed using the firstChild property.

25.

The libraries that build a new higher-level API for client-side programming is

A.
Library
B.
Framework
C.
APIs
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Many web developers find it useful to build their web applications on top of a clientside framework library. These libraries are “frameworks” in the sense that they build a new higher-level API for client-side programming on top of the standard and proprietary APIs offered by web browsers: once you adopt a framework, your code needs to be written to use the APIs defined by that framework.

26.

Which function among the following lets to register a function to be invoked once?

A.
setTimeout()
B.
setTotaltime()
C.
Intervalset()
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

setTimeout() and setInterval() allow you to register a function to be invoked once or repeatedly after a specified amount of time has elapsed.

27.

The URL property belongs to which of the following object?

A.
Document
B.
Element
C.
Location
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The Document object has a URL property, which is a static string that holds the URL of the document when it was first loaded.

28.

What is the code snippet to go back to a history twice?

A.
history(2);
B.
history(-2);
C.
history.go(-2);
D.
history.go(2);

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The above code snippet goes back 2, like clicking the Back button twice.

29.

Each tab in the single web browser window is called as

A.
Browser Information
B.
Browsing context
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

A single web browser window on your desktop may contain several tabs. Each tab is an independent browsing context.

30.

The central object in a larger API is known as

A.
Document Object Material
B.
Document Object Model
C.
Binary Object Model
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The Document object does not stand alone, however. It is the central object in a larger API, known as the Document Object Model, or DOM, for representing and manipulating document content.

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