JavaScript Language | 10 Minute‐Test 26


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.

What is the lifetime of the data stored through localStorage?

A.
Permanant
B.
Temporary
C.
Both a and b at times
D.
Cannot store

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Data stored through localStorage is permanent: it does not expire and remains stored on the user’s computer until a web app deletes it or the user asks the browser (through some browser-specific UI) to delete it.

2.

What will be done if more than one page requires a file of JavaScript code?

A.
Downloads that many times
B.
Retrives from the browser cache
C.
Must be re executed
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

If a file of JavaScript code is shared by more than one page, it only needs to be downloaded once, by the first page that uses it—subsequent pages can retrieve it from the browser cache.

3.

When will the window property come into play?

A.
Representation convenience
B.
Use as an extension of other objects
C.
Use objects in the Window object
D.
Refer to window object itself

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The Window object has a property named window that always refers to itself. You can use this property if you need to refer to the window object itself, but it is not usually necessary to use window if you just want to refer to access properties of the global window object.

4.

What is the code snippet to change the class and let the stylesheet specify the details?

A.
timestamp.className = "highlight";
B.
timestamp.className = "change";
C.
timestamp.className = "specify";
D.
timestamp.className = "move";

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The above code snippet changes the class and lets the stylesheet specify the details.

5.

Which of the following framework was used by Google for Gmail?

A.
Dojo
B.
GWT
C.
YUI
D.
Closure

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The Closure library is the client-side library that Google uses for Gmail, Google Docs, and other web applications. This library is intended to be used with the Closure compiler, which strips out unused library functions.

6.

What will happen if we call setTimeout() with a time of 0 ms?

A.
Placed in stack
B.
Placed in queue
C.
Will run continuously
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

If you call setTimeout() with a time of 0 ms, the function you specify is not invoked right away. Instead, it is placed on a queue to be invoked “as soon as possible” after any currently pending event handlers finish running.

7.

Why is the replace() method better than the assign() method?

A.
Reliable
B.
Highly managable
C.
More efficient
D.
Handles unconditional loading

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The replace() method is similar, but it removes the current document from the browsing history before loading the new document. When a script unconditionally loads a new document, the replace() method is often a better choice than assign().

8.

Which is the preferred testing nowadays for scripting?

A.
Software testing
B.
Feature testing
C.
Blackbox testing
D.
Whitebox testing

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

In the past, the Navigator object was commonly used by scripts to determine if they were running in Internet Explorer or Netscape. This “browser-sniffing” approach is problematic because it requires constant tweaking as new browsers and new versions of existing browsers are introduced. Today, feature testing is preferred: rather than making assumptions about particular browser versions and their features, you simply test for the feature (i.e., the method or property) you need.

9.

Which is the property of a Window object that holids the name of the frame?

A.
name
B.
title
C.
description
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The name property of a Window object holds the name of the frame, if it has one. This property is writable, and scripts can set it as desired.

10.

Which of the following can be used to select HTML elements based on the value of their name attributes?

A.
getElementByName()
B.
getElementsByName()
C.
getElementsName()
D.
getElementName()

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

To select HTML elements based on the value of their name attributes, you can use the getElementsByName() method of the Document object:

var radiobuttons = document.getElementsByName("favorite_color");


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