WorksheetsuCertify JavaScript Chapter 6 Test
Total questions: 15
Worksheet time: 8mins
What is the one property associated with the history object? (Remember a property is different than an object)
forward
length
go
back
Which line of code will allow you to redirect the browser to the page which he was previously viewing?
history.forward();
history.back();
history.backward();
history.go(1);
What is the purpose of the location object? (This is different than geolocation.)
To get the geographical location of a user
To get the location of a user in the network
To specify URLs in the script
To identify an area in a Web page
Which JavaScript object allows you to access previously visited Web page URLs?
Location
Document
Navigator
History
What is the purpose of the navigator object? (this is different than navigating the web-site)
To allow navigation in the Web page
To allow navigation to some other page
To relay information about the web server being accessed
To relay information about the web browser being used
What is the default object in JavaScript? (contains scroll bars, navigation bars, menu bars, and so forth)
Document
Location
Navigator
Window
You have opened a window to http://www.myweb.com/faq/answers.htm?protocol=email.
Consider the following alert:
alert(location.protocol);
What will this alert display if added to the code of your document?
**Remember what the location object does**
protocol=email
www
http:
Which JavaScript object represents the frame of the browser and the mechanisms associated with it?
Navigator
Window
Document
Image
Which of the following is the container of the form object?
Window
Document
Array
Navigator
How many arguments does the generic syntax for the window.open() method use?
One
Five
Seven
Three
Which code will display an alert if the variable timerMinutes has a value 10?
if (timerMinutes == 10) alert("Time Expired!");
if ("timerMinutes" = 10) {
alert("Time Expired!");
}
if ("timerMinutes" == 10); {
alert("Time Expired!");
}
if ("timerMinutes" = 10) alert("Time Expired!");
What is the purpose of the switch statement?
To force the flow of control back to the top of a loop
To exit a loop that would otherwise continue to execute
To repeat a group of statements for some particular range of values
To compare a value against other values, to search for a match
Which JavaScript statement should you use to test for a single condition and branch to a process?
if
for
if...else
while
What is the purpose of the while statement?
To execute a block of code for as long as a condition is true
To delay execution of a block of code for as long as a condition is true
To delay execution of a block of code until a condition is true
To execute a block of code until a condition is true
Consider the following code snippet:
var x = 100;
while (x > 5) {
x--;
}
What will be the value of x after the execution of the given code snippet?
5
4
6
100
