TinyDB is a document-oriented database, which is purely written in Python, and it does not have any external dependencies. TinyDB is designed to be easy and fun to use by providing a simple and clean API.
TinyDB MCQs: This section contains multiple-choice questions and answers on the various topics of TinyDB. Practice these MCQs to test and enhance your skills on TinyDB.
List of TinyDB MCQs
1. TinyDB is based upon____?
- Java
- Python
- C
- C++
Answer: B) Python
Explanation:
TinyDB is based on Python.
2. Is TinyDB open-source?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, TinyDB is an open-source database.
3. TinyDB is designed for ____.
- Small-scale Projects
- Large-scale Projects
- Both
Answer: A) Small-scale Projects
Explanation:
TinyDB is designed for small-scale projects.
4. TinyDB is a ____.
- SQL
- Graph Database
- NoSQL
- None
Answer: C) NoSQL
Explanation:
TinyDB is a NoSQL database.
5. TinyDB stores data in which format?
- Vertex and Edges
- CSV
- JSON
Answer: C) JSON
Explanation:
TinyDB stores data in JSON format.
6. Is TinyDB designed for distributed systems?
- Yes
- No
Answer: B) No
Explanation:
TinyDB is not designed for the distributed system.
7. Does TinyDB has external dependencies?
- Yes
- No
Answer: B) No
Explanation:
TinyDB has no external dependencies.
8. TinyDB follows which kind of NoSQL database?
- Graph database
- Key-value pair database
- Document-oriented
Answer: C) Document-oriented
Explanation:
TinyDB is a document-oriented database.
9. Which of the following method is used to insert an item in TinyDB?
- Db.put()
- Db.input()
- Db.add()
- Db.insert()
Answer: D) Db.insert()
Explanation:
Db.insert() method is used to insert an item in TinyDB.
10. To insert an item, the data should be in the form of a ____?
- MAP
- LIST
- DICT
Answer: C) DICT
Explanation:
The data should be in the form of a Python dictionary.
11. Use the ____ function to verify the stored objects in the database?
- Full ()
- All()
- Complete ()
- List()
Answer: B) All()
Explanation:
Use the all() function to verify the stored objects in the database.
12. To insert many objects at once, which of the following method is used?
- Insert_several
- Insert_various
- Insert_multiple
Answer: C) Insert_multiple
Explanation:
To insert many objects at once, the Insert_multiple method is used.
13. The ____ function delivers just one document that matches.
- Get()
- Search()
- One()
Answer: A) Get()
Explanation:
The get() function delivers just one document that matches.
14. You may use the ____ command to delete all data from a database.
- Delete
- Remove
- Delete_all
- truncate
Answer: D) truncate
Explanation:
You may use the truncate command to delete all data from a database.
15. The ____ query checks the availability of a JSON file’s subfield data.
- Is()
- Present()
- exists()
Answer: C) exists()
Explanation:
The exists() query checks the availability of a JSON file’s subfield data.
16. Does The exists() query operates based on a Boolean condition?
- True
- False
Answer: A) True
Explanation:
True, The exists() query operates based on a Boolean condition.
17. Which of the following method finds at least one value in the database?
- One()
- Any()
- Some()
Answer: B) Any()
Explanation:
any() method finds at least one value in the database.
18. TinyDB’s ____ assures data consistency and avoids data redundancy by separating data into distinct tables.
- data normalisation
- data integration
- data sharding
- data modeling
Answer: A) data normalisation
Explanation:
TinyDB’s data normalization assures data consistency and avoids data redundancy by separating data into distinct tables.
19. Can TinyDB be used to store geographical data, such as maps?
- Yes
- No
Answer: B) No
Explanation:
TinyDB can store geospatial data by producing a JSON object.
20. Does TinyDB support indexing?
- Yes
- No
Answer: B) No
Explanation:
No, TinyDB does not support indexing.
21. The search method in TinyDB ____.
- Returns single document
- Returns multiple documents
- None
Answer: B) Returns multiple documents
Explanation:
The search method in TinyDB, returns multiple documents.
22. The get method in TinyDB ____.
- Returns single document
- Returns multiple documents
- None
Answer: A) Returns single document
Explanation:
The get method in TinyDB, returns a single document.
23. Can TinyDB store multimedia content?
- Yes
- No
Answer: A) Yes
Explanation:
TinyDB can store multimedia content such as photographs and movies by converting them to binary format.
24. To erase data from a TinyDB database, use the ____ function.
- Erase()
- Delete()
- Remove()
- Del()
Answer: C) Remove()
Explanation:
To erase data from a TinyDB database, use the remove() function.
25. Using which of the following method the first document that matches a specific criterion is updated?
- Update_all()
- Update()
Answer: B) Update()
Explanation:
The first document that matches a specific criterion is updated using the update() method.
26. All documents that match a specific criterion are updated, using which of the following method?
- Update_all()
- Update()
Answer: A) Update_all()
Explanation:
All documents that match a specific criterion are updated, using the update_all() method.
27. Does TinyDB support join operations?
- Yes
- No
Answer: B) No
Explanation:
TinyDB does not support join operations.
28. Does TinyDB allows you to use logical operators?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, TinyDB allows logical operator usage.
29. When you simply want to change one document, which of the following method is used?
- Change()
- Update_all
- Update_one()
- Update()
Answer: D) Update()
Explanation:
When you simply want to change one document, the update() method is used.
30. What will happen if you will Insert a Document with an already existing ID in TinyDB?
- It will insert the same record again
- It will show you the value error
Answer: B) It will show you the value error
Explanation:
Inserting a Document with an already existing ID will result in a ValueError.
31. To create a table which of the following method is used?
- Db.create()
- Db.table()
- Db.new_table()
Answer: B) Db.table()
Explanation:
To create a table, db.table() is used
32. When you wish to change numerous documents at the same time, which of the following function is used?
- Change()
- Update_all
- Update_one()
- Update()
Answer: B) Update_all
Explanation:
When you wish to change numerous documents at the same time, the update_all() function is used.
33. Which of the following method is used to remove a table from DB?
- Db.drop()
- Db.remove()
- Db.remove_table()
- Db.drop_table()
Answer: D) Db.drop_table()
Explanation:
Db.drop_table() is used to remove a table from DB.
34. TinyDB comes with how many storage types?
- 4
- 5
- 2
- 3
Answer: C) 2
Explanation:
TinyDB comes with two storage types: JSON and in-memory.
35. TinyDB saves its data as ____ by default?
- In memory
- JSON files
Answer: B) JSON files
Explanation:
TinyDB saves its data as JSON files by default.
36. The “____” operator combines two conditions and returns True if any of them is fulfilled.
- LOGICAL AND
- LOGICAL OR
Answer: B) LOGICAL OR
Explanation:
The “Logical OR” operator combines two conditions and returns True if any of them is fulfilled.
37. Which query enables us to enter and update data at the same time based on the criteria?
- Upsert()
- Insert_update()
- Enter_update()
- Indate()
Answer: A) Upsert()
Explanation:
upsert() query enables us to enter and update data at the same time based on the criteria.
38. The number of documents in a database can be obtained, using which of the following query?
- All()
- List()
- Len()
- Number()
Answer: C) Len()
Explanation:
The number of documents in a database can be obtained, using the len() query.
39. The ____ query determines whether or not the database contains a matching value.
- In
- Is
- Include
- contains
Answer: D) contains
Explanation:
The contains query determines whether or not the database contains a matching value.
40. The ____ query returns the number of matched documents in a database.
- Len
- Count
- total
Answer: B) Count
Explanation:
The count query returns the number of matched documents in a database.
41. Which of the following middleware, speeds up a database by decreasing disc I/O?
- Caching middleware
- Sharing middleware
- Application middleware
Answer: A) Caching middleware
Explanation:
Caching middleware, speeds up a database by decreasing disc I/O.
42. Removes all documents that meet a specific requirement?
- Purge()
- Remove()
Answer: A) Purge()
Explanation:
Purge() Removes all documents that meet a specific requirement.
43. which of the following operations returns documents matching both queries?
- (query1) & (query2)
- (query1) | (query2)
- ~(query1)
Answer: A) (query1) & (query2)
Explanation:
(query1) & (query2) operations, return documents matching both queries.
44. TinyDB internally attaches an ID with each document you input.
- True
- False
Answer: A) True
Explanation:
TinyDB internally attaches an ID with each document you input.
45. Is it possible to open the same table with different settings several times?
- Yes
- No
Answer: B) No
Explanation:
It is not possible to open the same table with different settings several times.