McGraw-Hill OnlineMcGraw-Hill Higher EducationLearning Center
Student Center | Instructor Center | Information Center | Home
Sample Code
Multiple Choice Quiz
True or False
E-Lectures
Feedback
Help Center


Programming the Web Using XHTML and JavaScript
Larry Randles Lagerstrom

Strings, Dates, and Cookies

Multiple Choice Quiz



1

Which statement immediately terminates execution of a loop?
A)exit
B)break
C)quit
D)kill
2

For simple cookies, which field is typically omitted?
A)name
B)expiration date
C)pathname of the web page writing the cookie
D)value
3

The cookie string is actually written to:
A)a hard drive on the server
B)the surfer's hard drive
C)both A and B
D)neither A nor B
4

Which statement can be used to examine the value of the cookie string associated with the current web page?
A)alert(cookie)
B)alert(document.cookie.value)
C)alert(this.cookie)
D)alert(document.cookie)
5

Given a Date object named expDate that is set to the current date and time, which of the following will change the date value to one week from now?
A)expDate = setWeek(1)
B)expDate.setTime(expDate.getTime() + 30*24*3600*1000)
C)expDate.setTime(expDate.getTime() + 7*24*60*60)
D)expDate.setTime(expDate.getTime() + 7*24*3600*1000)
6

Which of the following creates a cookie named userName and stores the value Rocky in it?
A)document.cookie = "userName=Rocky"
B)document.cookie("userName", "Rocky")
C)document.cookie.name = "userName", document.cookie.value = "Rocky"
D)cookiename = "userName", cookievalue = "Rocky"




McGraw-Hill/Irwin