Sample questions
Question 1Easy
In MongoDB, a row of a relational table most closely corresponds to a:
- Collection of documents
- Database instance
- Cursor over results
- Document
Answer: D. Document
Explanation
Each record is a document made of field-value pairs.
Step-by-step solution
- A row in a relational table is a single record.
- In MongoDB, a single record is called a document.
- Documents contain field-value pairs like rows in tables.
- Collections hold multiple documents similar to tables holding rows.
- So, a row corresponds to a document.
Why the other options are wrong
- A. A collection is a group of documents, so it is closer to a table than to one row.
- B. A database instance holds many collections; it is larger than a single row.
- C. A cursor is the result of a query being iterated, not a stored record in a table.
Question 2Easy
What format does MongoDB use internally to store documents?
- XML
- BSON
- CSV
- YAML
Answer: B. BSON
Explanation
BSON is a binary-encoded serialization of JSON-like documents with extra types such as Date and ObjectId.
Step-by-step solution
- MongoDB stores data in a format similar to JSON.
- This format is called Binary JSON or BSON.
- BSON includes additional data types like Date and ObjectId.
- So, MongoDB uses BSON internally.
- Final answer: B (BSON).
Why the other options are wrong
- A. XML is a text markup format, not the binary format MongoDB stores documents in.
- C. CSV has no nested fields, so it cannot be MongoDB's internal document format.
- D. YAML is a text format for config files, not MongoDB's internal storage format.
Tip: Remember BSON is the internal format for MongoDB.
Question 3Easy
MongoDB stores documents on disk in which binary format?
- JSON text
- XML
- BSON
- CSV
Answer: C. BSON
Explanation
MongoDB stores documents in BSON, a binary superset of JSON that adds types such as Date and ObjectId.
Step-by-step solution
- Documents are written by clients as JSON-like objects.
- The server serialises them to BSON.
Why the other options are wrong
- A. BSON is binary, not plain JSON text.
- B. XML is not used for storage.
- D. CSV cannot hold nested documents.
Question 4Easy
Which of these is a typical use case for a graph database such as Neo4j?
- Finding friends-of-friends in a social network
- Storing simple session tokens
- Bulk numeric aggregation over billions of rows
- Storing large video files
Answer: A. Finding friends-of-friends in a social network
Explanation
Graph databases store relationships as first-class data, making multi-hop traversals efficient.
Step-by-step solution
- Graph databases excel at storing and querying relationships.
- Finding friends-of-friends requires checking connections between users.
- This is a natural fit for graph traversal queries.
- Storing session tokens needs key-value storage, not graphs.
- Bulk numeric aggregation uses columnar databases, not graphs.
- Storing video files needs object storage, not graphs.
Why the other options are wrong
- B. Simple session tokens are key lookups, so they do not need a graph's relationship traversal.
- C. Bulk numeric aggregation over huge tables is a column-store or warehouse job, not a graph's.
- D. Video files are large binary blobs and belong in object storage, not a graph database.
Tip: Use graph databases when your data is relationship-rich and requires efficient traversal.
Question 5Medium
A schema validator with $jsonSchema in MongoDB does what?
- Rejects or warns on documents that do not match defined rules
- Creates new tables for each document type found in the collection
- Locks field types forever so they can never change
- Replicates the data to other members
Answer: A. Rejects or warns on documents that do not match defined rules
Explanation
validationAction can error or warn.
Step-by-step solution
- Define rules on the collection.
Why the other options are wrong
- B. MongoDB has no tables; $jsonSchema validates documents in a collection.
- C. $jsonSchema does not lock field types forever.
- D. Validation rules do not replicate data to other members.
Question 6Medium
A wide-column store such as Cassandra organises data primarily by which structure?
- Foreign keys between tables, joined at read time by the storage engine
- A single global B-tree of all rows
- Nested JSON documents
- Partition key then clustering columns within a row group
Answer: D. Partition key then clustering columns within a row group
Explanation
Rows are placed on nodes by the partition key and sorted inside the partition by clustering columns.
Step-by-step solution
- Hash the partition key to find the node.
- Within the partition, order by clustering columns.
Why the other options are wrong
- A. Cassandra has no foreign keys.
- B. Data is distributed, not one global tree.
- C. Documents are the MongoDB model.
Question 7Medium
In MongoDB document modelling, when is embedding a sub-document usually preferred over referencing?
- When the child array can grow without limit
- When many parents share one huge child
- When child data is read with the parent and is bounded
- When the child must be updated independently by many documents
Answer: C. When child data is read with the parent and is bounded
Explanation
Embedding gives one-read access for data that belongs together, but unbounded growth or heavy sharing favours references.
Step-by-step solution
- Embedding is used when child data is accessed with the parent.
- Bounded child data fits well in embedded documents.
- Reading child data with parent reduces database queries.
- Unbounded growth or shared data needs references instead.
- Final answer: When child data is read with the parent and is bounded.
Why the other options are wrong
- A. An array that grows without limit should be referenced, since embedded arrays cannot grow unbounded.
- B. When many parents share one large child, referencing avoids duplicating that child in each parent.
- D. A child updated independently by many documents is better kept in its own collection.
Tip: Use embedding for small, related data; use references for big or shared data.
Question 8Medium
Which type of NoSQL store is best suited to model friend-of-friend relationships with variable depth?
- Graph database
- Key-value store
- Wide-column store
- Document store
Answer: A. Graph database
Explanation
Graph databases store relationships as first-class edges so multi-hop traversals are cheap.
Step-by-step solution
- Relationships with variable depth need traversal.
- Graph stores traverse edges natively.
Why the other options are wrong
- B. Key-value lookups cannot traverse.
- C. Wide-column suits time-series and big writes.
- D. Documents need repeated lookups for hops.
Question 9Medium
What is the difference between embedding and referencing?
- Embedding uses foreign key constraints enforced by the server, while referencing stores copies of the data
- Referencing nests the related data inside the parent document
- They are the same technique with different names
- Embedding nests data in one document; referencing stores an id pointing to another document
Answer: D. Embedding nests data in one document; referencing stores an id pointing to another document
Explanation
References require a second query or $lookup.
Step-by-step solution
- Embed = same doc.
- Reference = id link.
Why the other options are wrong
- A. No constraints in MongoDB.
- B. Referencing stores ids; embedding is what nests related data.
- C. Embedding and referencing are different designs, not the same.
Question 10Medium
Why are NoSQL databases often described as schema-flexible?
- They cannot store any structured data at all
- Documents in one collection may differ in fields
- They forbid any validation
- They always require a fixed column list
Answer: B. Documents in one collection may differ in fields
Explanation
Many NoSQL stores do not force every record to share one structure, though optional validation is possible.
Step-by-step solution
- NoSQL databases do not require one fixed schema for all records.
- Documents in the same collection can have different fields.
- So the answer is option B.
Why the other options are wrong
- A. NoSQL databases can store structured data, usually as documents.
- C. Many NoSQL databases support validation rules, so validation is not forbidden.
- D. A fixed column list is the relational model, not the flexible NoSQL model.
Tip: Schema-flexible does not mean no structure; the application still needs to keep fields consistent.
Practise all 27 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →