JavaScript Language | 30 Minute Test 8


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 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.

11.

The keyword or the property that you use to refer to an object through which they were invoked is

A.
from
B.
to
C.
this
D.
object

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The ‘this’ keyword is used to refer to the object through which the properties or methods were invoked. This use of ‘this’ is a fundamental characteristic of the methods of any class.

12.

The properties of the objects act like different kinds of class members. They are

A.
Public object, Private object, Protected object
B.
Constructor object, Function object, Destructor object
C.
Constructor object, Prototype object, Instance object
D.
Instance method, Static object, Dynamic object

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

In JavaScript, there are three different objects involved inany class definition, and the properties of these three objects act like different kinds of class members namely, Constructor object, Prototype object, and Instance object.

13.

The maximum number of global symbols a module can define is

A.
2
B.
3
C.
1
D.
4

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

Generally, the various modules are allowed to run in the pristine (or near pristine) environment that it expects. The modules should minimize the number of global symbols they define – ideally, no module should define more than one.

14.

Consider the following statement containing regular expressions

var text = "testing: 1, 2, 3";
var pattern = /\d+/g;
In order to check if the pattern matches, the statement is

A.
text==pattern
B.
text.equals(pattern)
C.
text.test(pattern)
D.
pattern.test(text)

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The given pattern is applied on the text given in the paranthesis.

15.

Why does JavaScript subset disallow == and !=?

A.
It uses bitwise checking
B.
It uses === and !== instead
C.
It uses equals() and notequals() instead
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The subset does not include the comma operator, the bitwise operators, or the ++ and — operators. It also disallows == and != because of the type conversion they perform, requiring use of === and !== instead.

16.

The let keyword can be used

A.
in a for or for/in loop, as a substitute for var
B.
as a block statement, to define new variables
C.
to define variables that are scoped to a single expression
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The let keyword can be used in four ways :
1.as a variable declaration like var;
2.in a for or for/in loop, as a substitute for var;
3.as a block statement, to define new variables and explicitly delimit their scope; and
4.to define variables that are scoped to a single expression.

17.

Consider the following code snippet

data.sort(function(a,b),b-a);
What does the above code do?

A.
Sort in the alphabetical order
B.
Sort in the chronological order
C.
Sort in reverse alphabetical order
D.
Sort in reverse numerical order

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The above code snippet sorts an array in reverse numerical order.

18.

What is the function used to deregister event handler ‘f’?

A.
deleteAllListeners(name)
B.
deleteListener(name,f)
C.
removerListener(name,f)
D.
removeAllListeners(name)

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The removeListeners(name,f) is used to deregister event handler f represented as :
emitter.removeListener(name,f)

19.

Which of the following are global functions that are not part of core JavaScript?

A.
spawn(f);
B.
trim();
C.
exult();
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The spawn(f) runs f() or loads and executes file f in a new thread.

20.

Why does the Node rely on event handlers?

A.
APIs are synchronous
B.
APIs are asynchronous
C.
APIs are reusable
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Because the APIs are asynchronous, Node relies on event handlers, which are often implemented using nested functions and closures.

21.

Which is the storage that allows the caching of web pages and their associated resources?

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

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

HTML5 defines an “Offline Web Applications” API that allows the caching of web pages and their associated resources (scripts, CSS files, images, and so on). This is client-side storage for web applications themselves rather than just their data, and it allows web apps to install themselves so that they are available even when there is no connection to the Internet.

22.

When does JavaScript code appear inline within an HTML file?

A.
Between the “script” tag
B.
Outside the “script” tag
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

JavaScript code can appear inline within an HTML file between the “script” tags.

23.

Which object is the main entry point to all client-side JavaScript features and APIs?

A.
Standard
B.
Location
C.
Window
D.
Position

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The Window object is the main entry point to all client-side JavaScript features and APIs. It represents a web browser window or frame, and you can refer to it with the identifier window.

24.

What are the properties supporting CSS styles for a document element?

A.
style and font
B.
style and className
C.
size and style
D.
className and font

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

Each Element object has style and className properties that allow scripts to specify CSS styles for a document element or to alter the CSS class names that apply to the element.

25.

Which of the following is not a framework?

A.
jQuery
B.
.NET
C.
JavaScript
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

One of the most popular frameworks is jQuery. Here, JavaScript is a scripting language and not a framework.

26.

Which function among the following lets to register a function to be invoked repeatedly after a certain time?

A.
Timeoutset()
B.
setTotaltime()
C.
setInterval()
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

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.

What does the location property represent?

A.
Current DOM object
B.
Current URL
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The location property of a window is a reference to a Location object; it represents the current URL of the document being displayed in that window.

28.

If the window has child windows, how will the browsing histories be affected?

A.
Numerically interleaved
B.
Chronologically interleaved
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

If a window contains child windows, the browsing histories of the child windows are chronologically interleaved with the history of the main window.

29.

Nested documents in the HTML can be done using

A.
frame
B.
nest
C.
iframe
D.
into

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

HTML documents may contain nested documents using an iframe element. An iframe creates a nested browsing context represented by a Window object of its own.

30.

The paragraph “p” is a part of

A.
h1
B.
body
C.
html
D.
Both b and c

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The paragraph tag belongs to both html and body tags.

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