JavaScript Questions & Answers – Blobs in JavaScript

«
»

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Blobs in JavaScript”.

1. BLOB stands for ______________
a) Binary Little Object
b) Binary Large Object
c) Broken Large Object
d) Binary Small object
View Answer

Answer: b
Explanation: A Blob is an opaque reference to, or handle for, a chunk of data. The name comes from SQL databases, where it means “Binary Large Object.” In JavaScript, Blobs often represent binary data, and they can be large, but neither is required: a Blob could also represent the contents of a small text file.
advertisement

2. The size of blobs are generally calculated in ____________
a) Meters
b) Kilometers
c) Bytes
d) Pixels
View Answer

Answer: c
Explanation: A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn’t necessarily in a JavaScript-native format. Blobs are opaque all you can do with them directly is determine their size in bytes, ask for their MIME type, and chop them up into smaller Blobs.

3. The blobs are generally stored in ____________
a) Memory
b) Disk
c) Both Memory and Disk
d) Temporary storage
View Answer

Answer: c
Explanation: A Blob object represents a file-like object of immutable, raw data. The web browser can store Blobs in memory or on disk, and Blobs can represent really enormous chunks of data (such as video files) that are too large to fit in main memory without first being broken into smaller pieces with slice().

4. The blobs are broken into smaller pieces using which of the following functions?
a) partition()
b) cut()
c) sliceall()
d) slice()
View Answer

Answer: d
Explanation: The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user’s system. The web browser can store Blobs in memory or on disk, and Blobs can represent really enormous chunks of data (such as video files) that are too large to fit in main memory without first being broken into smaller pieces with slice().
advertisement

5. Which algorithm supports blobs?
a) Structured clone algorithm
b) Double buffer algorithm
c) Chen’s algorithm
d) Retrieval algorithm
View Answer

Answer: a
Explanation: Blobs represent data that isn’t necessarily in a JavaScript-native format. Blobs are supported by the structured clone algorithm, which means that you can obtain one from another window or thread via the message event.

6. Which database can be used to retrieve blobs?
a) Server-side databases
b) Client-side databases
c) Both Server-side and Client-side databases
d) Temporary databases
View Answer

Answer: b
Explanation: A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn’t necessarily in a JavaScript-native format. Blobs can be retrieved from client-side databases.

7. Which object can be used to create your own blobs?
a) Creator
b) BlobCreator
c) BlobBuilder
d) BuilderBlob
View Answer

Answer: c
Explanation: Blobs represent data that isn’t necessarily in a JavaScript-native format. You can create your own blobs, using a BlobBuilder object to build them out of strings, ArrayBuffer objects, and other Blobs.
advertisement

8. Which of the following is a subtype of Blob?
a) Elemental Object
b) Create Object
c) Data Object
d) File Object
View Answer

Answer: d
Explanation: The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user’s system. The client-side JavaScript File object is a subtype of Blob: a File is just a Blob of data with a name and a modification date.

9. Which method facilitates in uploading a Blob to a server?
a) send()
b) pass()
c) upload()
d) store()
View Answer

Answer: a
Explanation: The Blob() constructor allows one to create blobs from other objects. You can upload a Blob to a server by passing it to the send() method of an XMLHttpRequest object.

10. A Blob URL can be created using which of the following function?
a) createURL()
b) createObjectURL()
c) designURL()
d) URLCreation()
View Answer

Answer: b
Explanation: The Blob() constructor allows one to create blobs from other objects. Create a Blob URL with the function createObjectURL(). At the time of this writing, the draft specification and Firefox 4 put this function in a global object named URL, and Chrome and Webkit prefix that new global, calling it webkitURL.
advertisement

Sanfoundry Global Education & Learning Series – Javascript Programming.

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn