JavaScript Questions & Answers – Client-Side Databases

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Client-Side Databases”.

1. The Client-Side Databases are stored in the ____________
a) The JavaScript code
b) User’s computer
c) Both JavaScript code and User’s computer
d) In the server
View Answer

Answer: b
Explanation: The actual client-side databases are stored on the user’s computer and are directly accessed by JavaScript code in the browser.

2. Which of the following use the Web SQL Database?
a) Chrome
b) Firefox
c) IE
d) Firefox & IE
View Answer

Answer: a
Explanation: Chrome, Safari, and Opera implemented the Web SQL Database API, but Firefox and IE have not, and likely never will.

3. Which of the following are objective database and not a relational database?
a) Web SQL Database
b) FileSystem API
c) IndexedDB
d) User data
View Answer

Answer: c
Explanation: IndexedDB is an object database, not a relational database, and it is much simpler than databases that support SQL queries. It is more powerful, efficient, and robust than the key/value storage provided by the Web Storage API, however.
advertisement
advertisement

4. In the IndexedDB database, database is defined as _____________
a) A collection of objects
b) A collection of named object stores
c) Objects collection
d) Data collection
View Answer

Answer: b
Explanation: In the IndexedDB API, a database is simply a collection of named object stores.

5. A key path is defined as ______________
a) A url that directs to the value
b) A value that is similar to hash table
c) A value that tells the database how to extract an object’s key from the object
d) A url that redirects
View Answer

Answer: c
Explanation: A key path is defined as a value that tells the database how to extract an object’s key from the object.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. How does IndexedDB provide atomicity?
a) Grouping among the data
b) Grouping within a transaction
c) Grouping the data
d) Interlinking data
View Answer

Answer: b
Explanation: IndexedDB provides atomicity guarantees: queries and updates to the database are grouped within a transaction so that they all succeed together or all fail together and never leave the database in an undefined partially updated state.

7. Which of the following is a feature of the IndexedDB API?
a) Simplifies the transaction management
b) Need not manage the transaction at all
c) Enhances the storage
d) Creates a link between data
View Answer

Answer: a
Explanation: One of the convenient feature of the IndexedDB API is that it simplifies the transaction management.
advertisement

8. What is the alternate way to search in an IndexedDB API?
a) Key
b) Address
c) Indexes
d) Values
View Answer

Answer: c
Explanation: In addition to retrieving objects from an object store by their primary key value, you may want to be able to search based on the value of other properties in the object. In order to be able to do this, you can define any number of indexes on the object store.

9. Which is the function used to look up an object?
a) put()
b) set()
c) get()
d) look()
View Answer

Answer: c
Explanation: You look up an object by calling the get() method of the object store or store a new object by calling put().
advertisement

10. Which is the method to look up the objects for a range of keys?
a) lookRange()
b) openCursor()
c) lookall()
d) look()
View Answer

Answer: b
Explanation: If you want to look up the objects for a range of keys, you create an IDBRange object and pass it to the openCursor() method of the object store.

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.