c) Both Single-threaded and Multi-threaded
2. Which of the following functions are synchronous?
c) both load() and require()
a) User friendliness
b) Tie up event loops
c) Browser becomes unresponsive
d) All of the mentioned
4. The object that looks to the thread that creates it is _______________
5. Which of the following is a global object for a new worker?
6. Which will be invoked to create a new worker?
var loader = new Worker("utils/loader.js");
7. What will happen if you specify an absolute URL in the Worker constructor?
a) Resolves itself
b) Must have the same origin
c) Must not have the same origin
d) Specify the address
Explanation: If you specify an absolute URL, it must have the same origin (same protocol, host, and port) as that containing document. In Firefox, if you want to use workers in extensions and would like to have access to js-ctypes, you should use the ChromeWorker object instead.
8. How can you send data using a Worker object?
9. Which property is used to manage multiple event handlers?
c) both onmessage and onerror
Explanation: message event is fired when the worker’s parent receives a message from its worker which is also available via the onmessage property. You can use onmessage and onerror properties if you want to manage multiple event handlers.
10. Which is the function that allows a worker to terminate itself?
Explanation: Worker.terminate() Immediately terminates the worker. This does not offer the worker an opportunity to finish its operations. The close() function allows a worker to terminate itself, and it is similar in effect to the terminate() method of a Worker object.
Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!