JavaScript 6e – Test Review Questions
Chapter 11: Updating Web Pages with AJAX
True / False	

1. The XMLHttpRequest object can be used to request and receive data without reloading a web page.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
742	

2. You can use a server-side script as a proxy to access data from another domain​.
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
747	

3. The first line of an HTTP message specifies the date.​
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
755	

4. An HTTP response code of 200 indicates that the request was successful.​
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
761	

5. CORS is supported by all browsers in use today.​
 	
a. 	
True	

b. 	
False	

REFERENCES:  	
790	

Multiple Choice	
7. The XMLHttpRequest object uses ____ to exchange data between a client computer and a web server.
 	
a. 	
HTTP	
b. 	
FTP	

c. 	
HTTPS	
d. 	
SSL	

REFERENCES:  	
742	

8. By combining the ____ object with DHTML techniques, you can update and modify individual portions of your web page with data received from a web server.
 	
a. 	
AjaxRequest	
b. 	
XMLHttpRequest	

c. 	
HttpRequest	
d. 	
XMLRequest	

REFERENCES:  	
742	

9. You can use a server-side script as a ____ to access data from another domain.
 	
a. 	
proxy	
b. 	
switch	

c. 	
router	
d. 	
firewall	

REFERENCES:  	
747	

10. The purpose of the ____ policy is to prevent malicious scripts from modifying the content of other windows, tabs, and frames and prevent the theft of private browser information and information displayed on secure web pages.
 	
a. 	
privacy	
b. 	
proxy	

c. 	
delegation	
d. 	
same-origin	

REFERENCES:  	
747	

11. A(n) ____ is a data source made available on one domain for use on other domains across the web.
 	
a. 	
AJAX request	
b. 	
web service	

c. 	
HTTP service	
d. 	
DHTML service	

REFERENCES:  	
748	

12. Every web page is identified by a unique address called the ____.
 	
a. 	
host string	
b. 	
host	

c. 	
URL	
d. 	
HTTP	

REFERENCES:  	
753	

13. The term ____ refers to the application, usually a web browser, that makes the request.
 	
a. 	
HTTP server	
b. 	
host	

c. 	
HTTP URL	
d. 	
HTTP client	

REFERENCES:  	
754	

14. The term ____ is another name for a web server and refers to a computer that receives HTTP requests and returns responses to HTTP clients.
 	
a. 	
URL	
b. 	
HTTP client	

c. 	
HTTP server	
d. 	
host	

REFERENCES:  	
754	

15. The term ____ refers to a computer system that is being accessed by a remote computer.
 	
a. 	
protocol	
b. 	
host	

c. 	
client	
d. 	
URL	

REFERENCES:  	
754	

16. HTTP client requests and server responses are both known as HTTP ____.
 	
a. 	
messages	
b. 	
scripts	

c. 	
strings	
d. 	
queries	

REFERENCES:  	
754	

17. ____ define information about the request or response message and about the contents of the message body.
 	
a. 	
Queries	
b. 	
Tags	

c. 	
Headers	
d. 	
Labels	

REFERENCES:  	
755	

18. ____ refers to the temporary storage of data for faster access.
 	
a. 	
Caching	
b. 	
Salting	

c. 	
Shadowing	
d. 	
Hashing	

REFERENCES:  	
755	

19. The ____ header specifies how a web browser should cache any server content it receives.
 	
a. 	
Caching	
b. 	
Cache-Control	

c. 	
Cache-Level	
d. 	
Cached	

REFERENCES:  	
755	

20. After you instantiate an XMLHttpRequest object, you use the ____ method with the instantiated XMLHttpRequest object to specify the request method (such as GET or POST) and URL.
 	
a. 	
alive()	
b. 	
create()	

c. 	
instantiate()	
d. 	
open()	

REFERENCES:  	
769	

21. To improve performance, you should call the ____ method of the XMLHttpRequest object to cancel any existing HTTP requests before beginning a new one.
 	
a. 	
exit()	
b. 	
abort()	

c. 	
cancel()	
d. 	
delete()	

REFERENCES:  	
770	

22. After you have defined the basic request criteria, you use the ____ method with the instantiated XMLHttpRequest object to submit the request to the server.
 	
a. 	
pass()	
b. 	
request()	

c. 	
send()	
d. 	
call()	

REFERENCES:  	
771	

23. A(n) ____ request stops the processing of the JavaScript code until a response is returned from the server.
 	
a. 	
asynchronous	
b. 	
global	

c. 	
domain	
d. 	
synchronous	

REFERENCES:  	
776, 777	

24. The value of the responseText property is almost always a(n) ____ string.​
 	
a. 	
​XML	
b. 	
​XHTML	

c. 	
​JSON	
d. 	
​HTML	

REFERENCES:  	
776	

25. ____ requests JSON content using a script element rather than an XMLHttpRequest object.​
 	
a. 	
​JSON-P	
b. 	
​CORS	

c. 	
​proxy	
d. 	
​XDomainRequest	

REFERENCES:  	
784	

Completion	

26. Unlike standard HTTP requests, which usually replace the entire page in a web browser, the ____________________ object can be used to request and receive data without reloading a web page.
REFERENCES:  	
742	

27. A web server’s reply to a request is known as the ____________________.
REFERENCES:  	
753	

28. ____________________ is a set of rules that defines how requests are made by an HTTP client to an HTTP server, and how responses are returned from an HTTP server to an HTTP client.
REFERENCES:  	
754	

29. A(n) ____________________ request allows JavaScript to continue processing while it waits for a server response.​
REFERENCES:  	
778	

30. All the information needed to create a JSON-P request is packaged into the URL specified for the ____________________ attribute of the script element.​
REFERENCES:  	
786	

Subjective Short Answer	

31. How can a proxy be useful with Ajax?
REFERENCES:  	
747	

32. Why do you need access to a web server when developing an Ajax application?
REFERENCES:  	
750	

33. What are the four steps in using Ajax to update data?
REFERENCES:  	
752	

34. How can you create an asynchronous request with JavaScript?
REFERENCES:  	
778	

35. Why is the Cache-Control header important for Ajax applications?​
REFERENCES:  	
755	

36. Why is it generally a good practice to reuse an instantiated XMLHttpRequest object?​
REFERENCES:  	
767	

37. Why should you not include an API key in public JavaScript code?​
REFERENCES:  	
770	

38. Are synchronous or asynchronous responses more resistant to server problems? Why?​
REFERENCES:  	
777, 778	

39. Why is it important to use JSON-P only with a web service that you trust?​
REFERENCES:  	
790	

40. ​How does CORS work?
REFERENCES:  	
790