386). 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);
Show Answer
Correct Answer: history.go(-2);
Notes:
Answer: c
Explanation: The go() method loads a specific URL from the history list. The above code snippet goes back 2, like clicking the Back button twice.
387). If the window has child windows, how will the browsing histories be affected?
[A]Numerically interleaved
[B]Chronologically interleaved
[C]Both Numerically and Chronologically interleaved
[D]Numerically or Chronologically interleaved
Show Answer
Correct Answer: Chronologically interleaved
Notes:
Answer: 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. The opener property returns a reference to the window that created the window.
388). The length property belongs to which of the following objects?
[A]Window
[B]Element
[C]History
[D]Document
Show Answer
Correct Answer: History
Notes:
Answer: c
Explanation: The length property of the History object specifies the number of elements in the browsing history list. The property returns at least 1, because the list includes the currently loaded page.
389). What is the datatype of the go() method’s parameter?
[A]String
[B]Integer
[C]Double
[D]Float
Show Answer
Correct Answer: Integer
Notes:
Answer: b
Explanation: The go() method takes an integer argument and can skip any number of pages forward and backward in the history list.
390). What is the special feature of modern web applications?
[A]Can alter contents without loading document
[B]Must load the document to manipulate
[C] Remains static
[D]Can’t be altered at all
Show Answer
Correct Answer: Can alter contents without loading document
Notes:
Answer: a
Explanation: Modern web applications can dynamically alter their own content without loading a new document.
391). The navigator property belongs to which of the following object?
[A]Document
[B]Window
[C]Navigator
[D]Location
Show Answer
Correct Answer: Navigator
Notes:
Answer: c
Explanation: The navigator property of a Window object refers to a Navigator object that contains browser vendor and version number information. Navigator object property includes appCodeName, appVersion, appName etc.
392). What is the vendor-neutral synonym for navigator?
[A]staticData
[B]purposeInformation
[C]dataInformation
[D]clientInformation
Show Answer
Correct Answer: clientInformation
Notes:
Answer: d
Explanation: IE supports clientInformation as a vendor-neutral synonym for a navigator. The navigator property of a Window object refers to a Navigator object that contains browser vendor and version number information.
393). Which is the preferred testing nowadays for scripting?
[A]Software testing
[B]Feature testing
[C]Blackbox testing
[D]Whitebox testing
Show Answer
Correct Answer: Feature testing
Notes:
Answer: b
Explanation: The “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.
394). Which of the below properties can be used for browser sniffing?
[A]platform
[B]appVersion
[C]both platform and appVersion
[D]appName
Show Answer
Correct Answer: both platform and appVersion
Notes:
Answer: c
Explanation: The platform and appVersion can be found out in the navigator object properties.
395). Where is the information of the userAgent property located?
[A]appId
[B]appName
[C]platform
[D]appVersion
Show Answer
Correct Answer: appVersion
Notes:
Answer: d
Explanation: The string that the browser sends in its USER-AGENT HTTP header. This property typically contains all the information in appVersion and may contain additional details as well.
396). What will be the output of the following JavaScript code?
function myFunction()
{
document.getElementById("demo").innerHTML = Boolean(10 > 9);
}
[A]true
[B]false
[C]error
[D]0
Show Answer
Correct Answer: true
Notes:
Answer: a
Explanation: The boolean function returns the boolean values. Since 10 is greater than 9 the boolean function returns true.
397). What will be the output of the following JavaScript code?
var b5 = Boolean('false');
document.getElementById("demo").innerHTML =b5;
[A]False
[B]True
[C]Error
[D]Undefined
Show Answer
Correct Answer: True
Notes:
Answer: b
Explanation: The boolean function returns the boolean values. The boolean function returns true for any non empty string even if the string is false.
398). What will be the output of the following JavaScript code?
function myFunction()
{
var x = "";
document.getElementById("demo").innerHTML = Boolean(x);
}
[A]true
[B]false
[C]0
[D]1
Show Answer
Correct Answer: false
Notes:
Answer: b
Explanation: When an empty string is passed to the boolean function then the function returns false. The boolean function returns true or false according to the input passed to it.
399). What will be the output of the following JavaScript code?
function myFunction()
{
var x = 10 / "H";
document.getElementById("demo").innerHTML = Boolean(x);
}
[A]True
[B]False
[C]Error
[D]Undefined
Show Answer
Correct Answer: False
Notes:
Answer: b
Explanation: The value return by the boolean method depends on the input passed to it. The NaN value when passed to the boolean function returns false.
400). What will be the output of the following JavaScript code?
function myFunction()
{
var x = null;
document.getElementById("demo").innerHTML = Boolean(x);
}
[A]True
[B]False
[C]Error
[D]Undefined
Show Answer
Correct Answer: False
Notes:
Answer: b
Explanation: The value return by the boolean method depends on the input passed to it. The NULL value when passed to the boolean function returns false.