Skip to content

Instantly share code, notes, and snippets.

@kaniket7209
Created November 25, 2021 05:13
Show Gist options
  • Save kaniket7209/c1efe8e3943e4d1058df97767cb05d28 to your computer and use it in GitHub Desktop.
Save kaniket7209/c1efe8e3943e4d1058df97767cb05d28 to your computer and use it in GitHub Desktop.
IndexedDB Storage | Web Storage API | Interview Prep | Browser Module
1. Is IndexedDB any good?
Answer: ndexedDB is a good fit if your client-side data needs are more complex than what Local/SessionStorage can provide (i.e. you're looking for more than a simple Key/Value store in your application)
2. Can we use JavaScript fucntions in IndexDB?
Answer: Yes
3. When should I use IndexedDB?
Answer: IndexedDB is a newer facility for storing large amounts of data in the browser. You can use it to store data of any JavaScript type, such as an object or array, without having to serialize it.
4. Is all requests against the database are Asynchronous/synchronous ?
Amswer: All requests against the database are asynchronous, so you get a callback when the request is completed.
5. What is stored in IndexedDB?
Answer: IndexedDB uses object stores rather than tables, and a single database can contain any number of object stores. ... This object store can only hold JavaScript objects. Usually a key is generated and the value of the generated key is stored in the object in a property with the same name as the key path.
6.Is IndexedDB faster?
Answer: In both Firefox and Chrome, IndexedDB is slower than LocalStorage for basic key-value insertions, and it still blocks the DOM. In Chrome, it's also slower than WebSQL, which does blocks the DOM, but not nearly as much.
7. What is the difference between Localstorage and IndexedDB?
Answer: IndexedDB is not a key-value store in the same way that Local Storage is. Local storage just stores strings, so to put an object in local storage the usual approach is to JSON.
8. Can we accesss data across different domains from IndexedDB ?
Answer: You can access stored data within a domain, you cannot access data across different domains.
9. Is indexedDB secure ?
Answer: Its not totally secure but It's better than many options because cryptography is done outside the browser execution environment
1. Operations performed using IndexedDB are done
a) synchronously
b) asynchronously
c) unpredictable
d) None of the above
Answer: b) asynchronously
2. Amonsst local storage and IndexDB which is more powerful
a) local Storage
b) IndexDB
c) Same storage
d) None
Answer: b) IndexDB
3. Data stored in IndexDB is in the form of
a) buffer
b) string
c) Objects(key value pair)
d) array
Answer: c) Objects(key value pair)
4. 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) None of the mentioned
Answer: b) User's computer
5. In the IndexedDB database, database is defined as
a) A collection of objects
b) A collection of named object stores
c) Objects collection
d) None of the mentioned
Answer: b) A collection of named object stores
6. 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) None of the mentioned
Answer: a) Simplifies the transaction management
7. What is the alternate way to search in an IndexedDB API?
a) Key
b) Address
c) Indexes
d) All of the mentioned
Answer: c) Indexes
8. Which is the function used to look up an object?
a) put()
b) set()
c) get()
d) look()
Answer: c) get()
9. What is the default version of the datbase created in IndexedDB ?
a) 0
b) 1
c) 2
d) undefined
Answer: b) 1
10. To delete data in an object store, we use
a) store.delete(key)
b) store.remove(key)
c) store.deleteAll(key)
d) store.removeAll(key)
Answer: a) store.delete(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment