JavaScript Practice Test

0%

Which standard construct for data validation is available in the development environment?

Correct! Wrong!

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

In NetScape, the main purpose of a "Live Wire" is to

Correct! Wrong!

Explanation:
A Live Wire database driver also supports a number of non-relational databases.

When the page has finished parsing, which attribute is utilized to specify that the script be executed? (only for external scripts)

Correct! Wrong!

Explanation:
In order to load a page, the browser must parse the contents of all script tags, which adds additional time to the page load. By minimizing the amount of JavaScript needed to render the page, and deferring parsig of uneeded JavaScript until it needs to be executed, you can reduce the intial load time of your page.

The script tag must be included in

Correct! Wrong!

Explanation :
If the script tag is placed after tag, then, it ill not be evaluated at all. Also, it is always recommened and effective to use the script sinppet in the tag.

To add external JS code in your HTML document, which of the following attributes is used?

Correct! Wrong!

Explanation:
A "src" attribute could be used to add any external code into HTML document.

The keyword or property you use to refer to an object that was used to invoke them is

Correct! Wrong!

Explanation:
The 'this' keyword is used to refer to the object through which the properties or methods were invoked. This used of 'this' is a fundamental characteristics of the methods of any class.

What is the basic difference between JavaScript and Java?

Correct! Wrong!

Explanation:
The basic difference between JavaScript and Java is that the functions are values, and there is no hard distinction between methods and fields.

The definition of augmenting classes is.

Correct! Wrong!

Explanation:
JavaScript prototype-based inheritance mechanism is dynamic: an object inherits properties from its prototype, even if the prototype changes after the object is created. This means that we can augment JavaScript classes simply by adding new methods to their proptotype objects.

The JSON() method's property is

Correct! Wrong!

Explanation:
The JSON format is intended for serialization of data structures and can handle JavaScript primative values, arrays, and plain objects. It does not know about classese, and when serializing an object, it ignores the object's prototype and constructor. If you cal JSON.stringify() on a Range or Complex object, for example, it returns a string like {"from":1, "to":3} or {"r":1,"i":-1}.

We state that a class B can extend another class A when it can.

Correct! Wrong!

Explanation:
Instances of B inherit all the instance methods of A. The class B can define its own instance methods, some of which may override methods of the same name defined by class A.

Which of the following functions allows you to register a function that will only be invoked once?

Correct! Wrong!

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

When uncaught JavaScript exceptions occur, which handler method is used?

Correct! Wrong!

Explanation:
The onerror handler method can be registered to be invoked when uncaught JavaScript exceptions occur.

Which property is utilized to get information about the browser's vendor and version?

Correct! Wrong!

Explanation:
The navigator property is used to obtain browser vendor and version information.

The location property belongs to which object?

Correct! Wrong!

Explanation:
The location prooperty of the Window obect refers to Location object, which represents the current URL of the document displayed in the window, and which also defines methods for making the window load a new document.

Which of the following objects has the URL property?

Correct! Wrong!

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

Which of the following protocols is stateless?

Correct! Wrong!

Explanation:
HTTP is a stateless prorocol. A stateless protocol does not require the server to retain information or status about each user for the duration of multiple request.

What does the WebSocket attribute Socket.readyState with a value of 2 mean?

Correct! Wrong!

Explanation:
The readonly attribute readyState represents the state of the connection. It can have the following values:
1. A value of 0 indicates that the connection has not yet been established.
2. A value of 1 indicates that the connection is established and communication is possible.
3. A value of 2 indicates that the connection is going through the closing handshake.
4. A value of 3 indicates that the connection has been closed or could not be opened.

What is the total number of WebSocket events?

Correct! Wrong!

Explanation:
There are four WebSocket events namely: 1. open
2. close
3. message
4. error

Which of the following isn't a property of a socket?

Correct! Wrong!

Explanation:
There is no Socket property called ready.

What is the content of a History object?

Correct! Wrong!

Explanation:
The history object contains URLs visited by the user (within a browser window).

What do you call the events that the Node object generates?

Correct! Wrong!

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

What function was used to remove all name event handlers?

Correct! Wrong!

Explanation:
The removeAllListeners(name) is used to remove all handlers from name events represented as
:
emitter.removeAllListeners(name)

An event emitter is which of the following?

Correct! Wrong!

Explanation:
The process object is an event emitter. The Node defines other important globals under the process namespaces that contain properties of the object like version, argv, env, pid, getuid(), cwd(), chdir() and exit().

Which of the following POSIX signals causes events to occur?

Correct! Wrong!

Explanation:
The SIGINT is a POSIX signal that generates event.

When the getter and setter methods are available, what does RHINO do?

Correct! Wrong!

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.