You are creating a webpage that will display short stories, and you want the stories to be shareable on other sites. Which element should each story be wrapped with?
A. <section>
B. <pre>
C. <aside>
D. <article>
Correct answer: D
A. Incorrect:The <section> element denotes a part of something.
B. Incorrect:The <pre> element displays preformatted content.
C. Incorrect:The <aside> element displays content that is related to the site.
D. Correct:An article wraps stand-alone items that can be shared.
Which of the following URLs can access data stored on http://www.example.com
/lesson1/page1.html?
A. http://www2.example.com/lesson1/page1.html
B. http://www.example.com:8081/lesson1/page1.html
C. https://www.example.com/lesson1/page1.html
Correct answer: D
A. Incorrect:The use of a different host (www2 instead of www) disallows this URL
from access.
B. Incorrect:The port number must match the origin port nmber.
C. Incorrect:Matching protocols must be used. In this answer, https is used rather
than http.
D. Correct:Because this example uses the same origin, it will have access to the same
data storage space.
E. Incorrect:This example does not have a matching host and would not be allowed
access
"Mention and describe the sections of a manifest file
A) _________
B) _________
C) _________"
"Correct answers
A) CACHE This section contains any items that you want to cache explicitly. T
B) NETWORK This section contains white-listed URLs that require a connection.
C) FALLBACK Use this section to specify substitutions for resources in offline mode."
When working with the WebSocket object, which event can be used to retrieve the
data that was received from the server?
A. onopen
B. onclose
C. onmessage
D. onerror
Correct answer: C
A. Incorrect: The onopen event is triggered when the connection is opened.
B. Incorrect: The onclose event is triggered when the connection is closed.
C. Correct: The onmessage event is triggered when data is received.
D. Incorrect: The onerror event is triggered when an error is thrown.
In the web worker code, you want the asynchronous code to update the DOM. Which
method can you use?
A. updateDom().
B. workerUpdate().
C. dom().
D. You cannot update the DOM from within the asynchronous code.
2.
Correct answer: D
A. Incorrect: There is no updateDom() method.
B. Incorrect: There is no workerUpdate() method.
C. Incorrect: There is no dom() method.
D. Correct: The web worker cannot modify the DOM.
You want to indicate an important item in your content text. Which element do you use?
A. <b>
B. <em>
C. <strong>
D. <i>
Correct answer: C
A. Incorrect:You should refrain from using the <b> element.
B. Incorrect:The <em> element indicates emphatic stress but not necessarily
importance.
C. Correct:The <strong> element indicates importance.
D. Incorrect:You should refrain from using the <i> element
What is the web storage limit currently recommended by the World Wide Web
Consortium (W3C)?
A. 4 KB
B. 5 MB
C. 500 MB
D. 10 MB
Correct answer: B
A. Incorrect:The cookie value limit is 4 KB.
B. Correct:The recommended limit is 5 MB, although the browser vendor can determine the respective limits.
C. Incorrect:If websites could store 500 MB of data on the client machine, drastic
performance degradation would result.
D. Incorrect:Internet Explorer supports 10 MB, but that’s not the recommended limit
After the browser caches resources listed in the manifest file, those files are held until :
A) _______
B) _______
C) _______
Correct answers
A) The manifest file is updated.
B) The user manually clears the cache.
C) The cache is updated through a developer-created script.
Which library would you use if you are creating a Node.js website and want to write
browser-independent code that uses WebSocket?
A. SignalR
B. Socket.IO
C. FarmSockets
D. AgnosticSocket
Correct answer: B
A. Incorrect: SignalR does not work with Node.js websites.
B. Correct: The Socket.IO library works with Node.js to provide a browser-independent library for WebSocket communications.
C. Incorrect: FarmSockets does not exist.
D. Incorrect: AgnosticSocket does not exist.
Which object can be used when the web worker and the creator need to reference the
same object?
A. Mutex.
B. Semaphore.
C. Closure.
D. The web worker and the creator cannot reference the same object.
Correct answer: D
A. Incorrect: There is no JavaScript Mutex object.
B. Incorrect: There is no JavaScript Semaphore object.
C. Incorrect: There is no JavaScript Closure object.
D. Correct: The web worker cannot access the same object, and objects passed to
the web worker from the creator are serialized to produce a copy of the object the
web worker will access.
You are creating a webpage that will be used to display a list of salespeople with their
sales statistics for the years of 2010, 2011, and 2012 in two categories: sales of products
and sales of services. You want to each of the years to be in the horizontal header, and
under each year, you will have a “Products” column and a “Services” column. How will
you define the element for year 2011?
A. <th>2 011</th>
B. <th colspan=”2”>2011</th>
C. <th span=”2”>2 011</th>
D. <th st yle=”2”>2 011</th>
Correct answer: B
A. Incorrect:The column needs to span two columns.
B. Correct: The column needs the colspan=”2” attribute to span the Products and
Services columns.
C. Incorrect: The span attribute is used with the <col> element but not with the <th>
element.
D. Incorrect: The style attribute cannot be used to cause spanning across two
columns.
What is the correct syntax for removing all values existing in localStorage?
A. localStorage.clear();
B. localStorage.removeAll();
C. localStorage.abandon();
D. localStorage.reset();
Correct answer: A
A. Correct:The clear() method removes all existing key/value pairs existing for the
origin.
B. Incorrect:The removeAll() method does not exist.
C. Incorrect:The abandon() method does not exist.
D. Incorrect:The reset() method does not exist
Which event is fired after an existing cache has been updated with new resources?
A. downloading
B. cached
C. updateReady
D. completed
Correct answer: C
A. Incorrect: The downloading event is fired as the browser is downloading new
content.
B. Incorrect: The cached event is fired for newly created caches only.
C. Correct: The updateReady event tells you when a cache is updated with new
resources.
D. Incorrect: The applicationCache object does not have an available completed
event.
You want to ensure that the WebSocket connection is not disconnected as a result of
inactivity. How can you accomplish this?
A. Add code to the onclose event to reopen the connection when it’s closed.
B. Add code to send an empty message periodically before the connection is closed.
C. Set the keepAlive property on the WebSocket object to true.
D. Create a new WebSocket object each time you send a message.
Correct answer: B
A. Incorrect: If you wait until the connection is closed, you will need to create a new
WebSocket object.
B. Correct: You can add code to send empty messages periodically.
C. Incorrect: There is no keepAlive property on the WebSocket object.
D. Incorrect: If you create a new WebSocket object each time you send a message,
the server will think that new browsers are communicating with it.
Workers do NOT have access to:
A) The DOM (it's not thread-safe)
B) The window object
C) The document object
D) The parent object
Correct answer ALL
Which of the following is not a valid parameter on the getCurrentPosition method?
A. Error callback function
B. Position options object
C. Success callback function
D. Use GPS only
Correct answer: D
A. Incorrect:The error callback function is a valid paramete.
B. Incorrect:The position options object is a valid parameter.
C. Incorrect:The success callback function is a valid parameter.
D. Correct:The use GPS only parameter is not valid.
Which of the following storage mechanisms has the highest level of cross-browser
support?
A. Web storage
B. Web SQL
C. IndexDB
D. FileSystem API
Correct answer: A
A. Correct:Nearly all modern browsers support web storage (localStorageand
sessionStorage).
B. Incorrect:Some popular browsers (namely Chrome and Safari) support Web SQL,
but neither Internet Explorer nor Firefox supports it yet.
C. Incorrect:Although IndexDB seems to be gaining support ahead of Web SQL, it is
yet to be adopted by Safari or some of the major mobile browsers.
D. Incorrect:With only Chrome as its strongest supporter, FileSystem API is the least
adoption option
What is the method that can be used to start the
caching process programmatically
A) window.applicationCache.update();
B) window.applicationCache.reset();
C) window.applicationCache.start();
Correct answer: A
A) window.applicationCache.update();
the other 2 dont exists
What is the difference between WebSocket and the long polling concept?
With long polling, the client sends a
request to the server, and if the server has information with which to respond, it responds.
If the server doesn’t have information with which to respond, the server keeps the connection open and doesn’t respond until it has data. One problem with this concept is
that connections can time out, which requires the creation of a new connection
The WebSocket protocol provides a standardized way for the server to send content to the
browser without being solicited by the client and to allow messages to be passed back and
forth while keeping the connection open.
Due to their multi-threaded behavior, web workers only has access to a subset of JavaScript's features:
A) The navigator object
B) The location object (read-only)
C) XMLHttpRequest
D) setTimeout()/clearTimeout() and
E) setInterval()/clearInterval()
F) The Application Cache
G) Importing external scripts using the importScripts() method
I) Spawning other web workers
Correct answer ALL
Which of the following formulas can you use to calculate the distance between two
samples?
A. haversine
B. Pythagorean theorem
C. quadratic
D. hyperbolic
Correct answer: A
A. Correct:The haversine formula calculates spherical distance.
B. Incorrect:You use the Pythagorean theorem to calculate the hypotenuse of a right
triangle.
C. Incorrect:You use the quadratic formula to solve ax
2
+ bx + c = 0 for x.
D. Incorrect:Hyperbolic functions are analogs of the ordinary trigonometric, or circular, functions.
Which of the following features does web storage support?
A. Indexing
B. Transactions
C. Asynchronous read/write
D. Simple key/value pair storage
Correct answer: D
A. Incorrect: Web storage does not support indexing.
B. Incorrect: Web storage does not support transactions.
C. Incorrect:Web storage does not support asynchronous processing.
D. Correct: The simple key/value pair storage’s easy-to-use interface is perhaps the
best feature of web storage
After the new cache has been downloaded and the updateReady event has fired, you can
call the ______ method to replace the old cache with the new
A) checking
B) swapCache
C) cached
D) updateReady
E) obsolete
Correct answers B
B) swapCache
window.applicationCache.addEventListener('updateready',
function(){ window.applicationCache.swapCache(); }, false );
Can you create a WebSocket object and call the open method when you want to
open a WebSocket connection?
No, there is no open method on the WebSocket object. When you instantiate the
WebSocket object, it automatically attempts to open asynchronously.
Mention and describe the 2 different kind of workers
A) ________
B) ________
A) A dedicated worker is only accessible by the script that called it.
B) A shared worker is accessible by multiple scripts — even if they are being accessed by different windows, iframes or even workers.