JavaScript Language | 10 Minute‐Test 17


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.

If A is the superclass and B is the subclass, then subclass inherting the superclass can be represented as

A.
B=inherit(A);
B.
B=A.inherit();
C.
B.prototype=inherit(A);
D.
B.prototype=inherit(A.prototype);

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The subclass B inherits the prototype of the class A.

2.

What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?

A.
HTMLElement.prototype(…)
B.
HTMLElement.prototype
C.
HTML.addmethods()
D.
HTML.elements(add)

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

It is implementation-dependent whether classes defined by the host environment (such as the web browser) can be augmented using Object.prototype. In many web browsers, for example, you can add methods to HTMLElement.prototype and those methods will be inherited by the objects that represent the HTML tags in the current document.

3.

The properties() method is a

A.
Enumerable method
B.
Non-enumerable method
C.
Operational method
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option B

Explanation:

The properties() method is a non-enumerable method.

4.

The method that performs the search-and-replace operation to strings for pattern matching is

A.
searchandreplace()
B.
add()
C.
edit()
D.
replace()

Your Answer: Option (Not Answered)

Correct Answer: Option D

Explanation:

The replace() method performs a search-and-replace operation. It takes a regular expression as its first argument and a replacement string as its second argument.

5.

Which is the object that defines methods that allow complete control over page content?

A.
The client-side document object
B.
The server-side document object
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The client-side document object defines methods that allow complete control over page content.

6.

Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?

A.
for loop
B.
while loop
C.
for/each loop
D.
All of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option C

Explanation:

The for/each loop is a new looping statement standardized by E4X. E4X (ECMAScript for XML) is a language extension that allows XML tags to appear literally in JavaScript programs and adds syntax and API for operating on XML data.

7.

Which of the following is an example to perform the most common XML manipulations using the XML objects invocation?

A.
insertChildBefore()
B.
insertChildAfter()
C.
appendChildAfter(…)
D.
appendChildBefore(…)

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

E4X is designed so that you can perform most common XML manipulations using language syntax. E4X also defines methods you can invoke on XML objects. Here, for example, is the insertChildBefore() method:

pt.insertChildBefore(pt.element[1],<element id="1"><name>Deuterium</name></element>);

8.

What is the method used to pause “data” events?

A.
s.pause();
B.
s.stop();
C.
s.halt();
D.
s.wait();

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

The above code snippet is used to pause data events, for throttling uploads, e.g.

9.

What does Rhino do when the getter and setter methods exist?

A.
It becomes JavaScript properties
B.
Java classes are used to avoid them
C.
Both a and b
D.
None of the mentioned

Your Answer: Option (Not Answered)

Correct Answer: Option A

Explanation:

Rhino allows JavaScript code to query and set the static fields of Java classes and the instance fields of Java objects. Java classes often avoid defining public fields in favor of getter and setter methods. When getter and setter methods exist, Rhino exposes them as JavaScript properties.

10.

Why does Node not block while waiting for operations to complete?

A.
Static
B.
Asynchronous
C.
Synchronous
D.
None of the mentioned
Submit your test now to view the Results and Statistics with answer explanation.