1What type of NoSQL database is MongoDB primarily classified as?
Introduction of MongoDB
Easy
A.Document-oriented database
B.Key-value store
C.Column-family store
D.Graph database
Correct Answer: Document-oriented database
Explanation:
MongoDB is a document-oriented NoSQL database, meaning it stores data in flexible, JSON-like documents rather than in tables and rows.
Incorrect! Try again.
2Which data format does MongoDB use internally to store documents?
Introduction of MongoDB
Easy
A.XML
B.YAML
C.CSV
D.BSON
Correct Answer: BSON
Explanation:
MongoDB uses BSON (Binary JSON) internally, which extends the JSON model to provide additional data types and efficient encoding/decoding.
Incorrect! Try again.
3Amazon DynamoDB is a managed NoSQL database service provided by which cloud platform?
DynamoDB
Easy
A.Microsoft Azure
B.Google Cloud Platform (GCP)
C.Amazon Web Services (AWS)
D.IBM Cloud
Correct Answer: Amazon Web Services (AWS)
Explanation:
DynamoDB is a fully managed, serverless, key-value NoSQL database designed to run high-performance applications at any scale, provided by AWS.
Incorrect! Try again.
4Which of the following describes the primary data models supported by DynamoDB?
DynamoDB
Easy
A.Time-series and Spatial
B.Relational and Graph
C.Key-value and Document
D.Columnar and Relational
Correct Answer: Key-value and Document
Explanation:
DynamoDB supports both key-value and document data models, making it flexible for various NoSQL use cases.
Incorrect! Try again.
5What is the main advantage of using a serverless cloud database?
Serverless cloud database
Easy
A.It automatically scales compute and storage based on demand.
B.It requires manual provisioning of servers.
C.You have full root access to the underlying hardware.
D.It only supports SQL queries.
Correct Answer: It automatically scales compute and storage based on demand.
Explanation:
Serverless databases abstract away infrastructure management, allowing automatic scaling up or down based on application workload without manual intervention.
Incorrect! Try again.
6How are costs typically calculated for a serverless cloud database?
Serverless cloud database
Easy
A.Fixed monthly fee regardless of usage
B.Pay-as-you-go based on actual consumption (reads, writes, storage)
C.Yearly licensing per CPU core
D.One-time perpetual license
Correct Answer: Pay-as-you-go based on actual consumption (reads, writes, storage)
Explanation:
In a serverless model, billing is typically tied directly to the resources you consume, such as storage used and the number of database operations performed.
Incorrect! Try again.
7In the structure of MongoDB, what is the equivalent of a relational database table?
Structure of MongoDB
Easy
A.Cluster
B.Collection
C.Document
D.Field
Correct Answer: Collection
Explanation:
In MongoDB, a Collection is a grouping of MongoDB documents, serving a similar purpose to a table in a relational database.
Incorrect! Try again.
8In MongoDB, what corresponds to a row in a traditional relational database?
Structure of MongoDB
Easy
A.Database
B.Index
C.Document
D.Collection
Correct Answer: Document
Explanation:
A Document in MongoDB is a single record of data, which is conceptually equivalent to a row in a traditional SQL database.
Incorrect! Try again.
9Which of the following is a primary characteristic of NoSQL databases compared to SQL databases?
SQL vs NoSql
Easy
A.Flexible schema design
B.Always requires ACID compliance for all operations
C.Rigid, predefined schema
D.Use of foreign keys for strict referential integrity
Correct Answer: Flexible schema design
Explanation:
NoSQL databases generally offer a flexible or dynamic schema, allowing you to store unstructured or semi-structured data without defining the structure beforehand.
Incorrect! Try again.
10How do NoSQL databases typically scale to handle massive amounts of data?
SQL vs NoSql
Easy
A.Horizontally (adding more servers to a distributed system)
B.They cannot scale.
C.Vertically (adding more CPU/RAM to a single server)
D.Diagonally (only upgrading network speed)
Correct Answer: Horizontally (adding more servers to a distributed system)
Explanation:
NoSQL databases are typically designed to scale out (horizontally) across many commodity servers, whereas SQL databases traditionally scale up (vertically).
Incorrect! Try again.
11Which MongoDB command is used to retrieve data from a collection?
Working with MongoDB
Easy
A.db.collection.get()
B.db.collection.find()
C.db.collection.select()
D.db.collection.fetch()
Correct Answer: db.collection.find()
Explanation:
The find() method is used in MongoDB to query a collection and retrieve documents that match specified criteria.
Incorrect! Try again.
12Which command inserts a single new document into a MongoDB collection?
Working with MongoDB
Easy
A.db.collection.put()
B.db.collection.create()
C.db.collection.addOne()
D.db.collection.insertOne()
Correct Answer: db.collection.insertOne()
Explanation:
The insertOne() method is the standard way to insert a single document into a MongoDB collection.
Incorrect! Try again.
13What does JSON stand for?
JSON databases
Easy
A.Just Some Object Notation
B.Java Standard Object Notation
C.JavaScript Object Notation
D.Java Serialized Object Network
Correct Answer: JavaScript Object Notation
Explanation:
JSON stands for JavaScript Object Notation. It is a lightweight, text-based data interchange format.
Incorrect! Try again.
14Which two basic structures make up JSON data?
JSON databases
Easy
A.Tables and Columns
B.Graphs and Nodes
C.Tuples and Relations
D.Key-value pairs and Arrays
Correct Answer: Key-value pairs and Arrays
Explanation:
JSON is built on two structures: a collection of name/value (key-value) pairs (often called an object) and an ordered list of values (an array).
Incorrect! Try again.
15In a JSON document, how is an array of items enclosed?
JSON representation of part of the dataset
Easy
A.Curly braces { }
B.Angle brackets < >
C.Parentheses ( )
D.Square brackets [ ]
Correct Answer: Square brackets [ ]
Explanation:
In JSON, an array is an ordered collection of values and is enclosed within square brackets [ ].
Incorrect! Try again.
16Which of the following is the correct syntax for a key-value pair in JSON?
JSON representation of part of the dataset
Easy
A.<name>Alice</name>
B.name -> "Alice"
C."name" : "Alice"
D."name" = "Alice"
Correct Answer: "name" : "Alice"
Explanation:
In JSON, a key-value pair is separated by a colon, with the key being a string enclosed in double quotes. E.g., "key" : "value".
Incorrect! Try again.
17What is the primary reason for creating an index in MongoDB?
Index creation & performance comparison using EXPLAIN
Easy
A.To convert data to SQL format
B.To compress the storage size
C.To encrypt the data
D.To improve query execution speed
Correct Answer: To improve query execution speed
Explanation:
Indexes support the efficient execution of queries in MongoDB by preventing the database from scanning every document in a collection.
Incorrect! Try again.
18Which method is appended to a MongoDB query to return statistics about the query's execution plan?
Index creation & performance comparison using EXPLAIN
Easy
A..plan()
B..profile()
C..explain()
D..analyze()
Correct Answer: .explain()
Explanation:
The .explain() method provides information on how MongoDB executes a query, including whether it used an index, making it useful for performance comparison.
Incorrect! Try again.
19Vector databases are primarily designed to store and search which type of data?
Vector databases are specialized to store, index, and query high-dimensional mathematical vectors, typically generated by machine learning models.
Incorrect! Try again.
20Which modern technology relies heavily on vector databases to perform similarity searches?
Vector Databases
Easy
A.Traditional Web Hosting
B.Operating System Kernels
C.Blockchain
D.Generative AI and Machine Learning
Correct Answer: Generative AI and Machine Learning
Explanation:
AI and ML applications, such as Large Language Models (LLMs), use vector databases to find semantic similarities between data points (like text, images, or audio).
Incorrect! Try again.
21Which of the following best describes how MongoDB natively handles horizontal scaling and high availability?
Introduction of MongoDB
Medium
A.It relies on vertical scaling by adding more RAM and CPU to a single master node.
B.It uses sharding for high availability and replica sets for horizontal scaling.
C.It uses consistent hashing across peer-to-peer nodes without designated primaries.
D.It uses replica sets for high availability and sharding for horizontal scaling.
Correct Answer: It uses replica sets for high availability and sharding for horizontal scaling.
Explanation:
MongoDB utilizes replica sets (a group of MongoDB processes that maintain the same data set) to ensure high availability and redundancy. For horizontal scaling, it uses sharding to distribute data across multiple machines.
Incorrect! Try again.
22An application requires strict ACID properties across multiple documents and collections. How does modern MongoDB (version 4.0 and later) address this requirement?
Introduction of MongoDB
Medium
A.It supports multi-document transactions using a two-phase commit protocol internally.
B.It enforces ACID only within a single document using the $isolated operator.
C.It uses external transaction managers like Apache Kafka to ensure ACID properties.
D.It does not support ACID properties; it only provides eventual consistency.
Correct Answer: It supports multi-document transactions using a two-phase commit protocol internally.
Explanation:
Since version 4.0, MongoDB supports multi-document ACID transactions, allowing developers to execute operations across multiple documents, collections, and shards with strict transactional guarantees.
Incorrect! Try again.
23In Amazon DynamoDB, when selecting a partition key for a high-traffic table, which strategy is most effective to avoid "hot partitions"?
DynamoDB
Medium
A.Choosing a partition key with a small number of distinct values.
B.Choosing a partition key with high cardinality to ensure uniform request distribution.
C.Using a sequential auto-incrementing integer as the partition key.
D.Choosing a boolean attribute as the partition key.
Correct Answer: Choosing a partition key with high cardinality to ensure uniform request distribution.
Explanation:
A high-cardinality partition key (like a UserID or UUID) distributes read and write requests evenly across partitions, preventing any single partition from becoming a bottleneck (a "hot partition").
Incorrect! Try again.
24How does DynamoDB allow efficient querying of attributes that are not part of the primary table's partition or sort key?
DynamoDB
Medium
A.By executing full table scans in the background.
B.By using Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI).
C.By writing complex SQL JOIN statements across partitions.
D.By automatically creating B-tree indexes on all attributes.
Correct Answer: By using Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI).
Explanation:
DynamoDB supports Global Secondary Indexes (GSIs) and Local Secondary Indexes (LSIs) to allow efficient queries on non-primary key attributes without requiring a costly table scan.
Incorrect! Try again.
25When migrating a sporadically used application to a serverless cloud database like Amazon Aurora Serverless, what is the primary architectural advantage?
Serverless cloud database
Medium
A.It automatically translates NoSQL queries into standard SQL.
B.It provides dedicated hardware for predictable, constant latency regardless of cost.
C.The compute capacity scales automatically based on load and can pause during inactivity, reducing costs.
D.It completely eliminates the need for database backups and disaster recovery.
Correct Answer: The compute capacity scales automatically based on load and can pause during inactivity, reducing costs.
Explanation:
Serverless databases decouple compute and storage. Compute capacity automatically scales up or down based on application demand, and can even scale to zero (pause), meaning you only pay for what you use.
Incorrect! Try again.
26Which of the following best differentiates a serverless database pricing model from a traditional provisioned cloud database pricing model?
Serverless cloud database
Medium
A.Serverless databases are entirely free because they run on shared infrastructure.
B.Serverless databases charge primarily based on the volume of operations and storage consumed.
D.Serverless databases charge based on reserved instance types and uptime.
Correct Answer: Serverless databases charge primarily based on the volume of operations and storage consumed.
Explanation:
In a serverless database model, billing is typically based on actual consumption (e.g., Read/Write Capacity Units, compute seconds) and storage, rather than pre-provisioning specific server sizes.
Incorrect! Try again.
27In MongoDB, how can a database administrator enforce specific data types and required fields despite the database being fundamentally schema-less?
Structure of MongoDB
Medium
A.By writing triggers that execute before every INSERT statement.
B.By using JSON Schema validation rules applied at the collection level.
C.By configuring the strict_schema parameter in the mongod.conf file.
D.By defining primary and foreign keys in the collection settings.
Correct Answer: By using JSON Schema validation rules applied at the collection level.
Explanation:
MongoDB allows schema enforcement through Schema Validation, which uses the JSON Schema standard to define rules for document structures, required fields, and data types during inserts and updates.
Incorrect! Try again.
28Which of the following correctly maps the structural components of a traditional RDBMS to MongoDB?
Structure of MongoDB
Medium
A.Table Document, Row Collection, Column Field
B.Table Collection, Row Document, Column Field
C.Database Collection, Table Field, Row Document
D.Table Field, Row Document, Column BSON
Correct Answer: Table Collection, Row Document, Column Field
Explanation:
In MongoDB, collections are analogous to tables in RDBMS, documents are analogous to rows, and fields (key-value pairs) are analogous to columns.
Incorrect! Try again.
29An application handles a dynamic product catalog where each category of items has completely different attributes. Why might a NoSQL document database be preferred over a traditional SQL database in this scenario?
SQL vs NoSql
Medium
A.NoSQL databases support complex JOIN operations natively, which simplifies catalog querying.
Document-based NoSQL databases allow each document to have a different structure. In SQL, storing highly variable attributes often results in sparse tables (many NULLs) or requires complex EAV (Entity-Attribute-Value) anti-patterns.
Incorrect! Try again.
30In which of the following scenarios is a traditional SQL database generally a better choice than a NoSQL database?
SQL vs NoSql
Medium
A.An IoT application capturing unstructured sensor data logs.
B.A mobile app requiring offline synchronization of JSON documents.
C.A financial ledger system requiring strict referential integrity and complex ad-hoc multi-table reporting.
D.A real-time bidding platform requiring microsecond writes at a massive scale.
Correct Answer: A financial ledger system requiring strict referential integrity and complex ad-hoc multi-table reporting.
Explanation:
SQL databases excel in scenarios requiring strict ACID compliance out-of-the-box, strong referential integrity (foreign keys), and complex queries involving multiple table joins, which are typical in financial applications.
Incorrect! Try again.
31Which of the following MongoDB queries correctly finds all documents in the employees collection where age is greater than 30 and status is "Active"?
Working with MongoDB
Medium
A.db.employees.query({ $and: [ age > 30, status = "Active" ] })
In MongoDB, the $gt operator is used for "greater than" comparisons. Multiple conditions passed in the same document implicitly act as an AND operation.
Incorrect! Try again.
32A developer wants to update a document in MongoDB, but if no document matches the query filter, a new document should be created. Which option must be used with the updateOne() method?
Working with MongoDB
Medium
A.{ upsert: true }
B.{ createIfMissing: true }
C.{ merge: true }
D.{ insertNode: true }
Correct Answer: { upsert: true }
Explanation:
The { upsert: true } option in MongoDB update operations specifies that if no document matches the filter, a new document should be inserted based on the filter and update parameters.
Incorrect! Try again.
33Why do JSON databases like MongoDB use internal binary representations (like BSON) instead of storing data purely as plain text JSON?
JSON databases
Medium
A.Because BSON compresses data using advanced lossy algorithms.
B.Because JSON strings cannot be transmitted over HTTP.
C.Because BSON allows for complex joins using SQL syntax.
D.Because BSON provides faster traversability, efficient encoding, and supports additional data types like Date and BinData.
Correct Answer: Because BSON provides faster traversability, efficient encoding, and supports additional data types like Date and BinData.
Explanation:
BSON (Binary JSON) extends the JSON model to provide additional data types (such as dates and binary data), efficient storage, and optimized parsing and traversal speeds.
Incorrect! Try again.
34When querying a JSON database, how are fields within nested objects typically accessed?
B.By writing a recursive function inside the query.
C.Using dot notation, e.g., "parent.child"
D.By flattening the document before querying.
Correct Answer: Using dot notation, e.g., "parent.child"
Explanation:
In document databases like MongoDB, dot notation is the standard way to access elements of an array or fields within a nested (embedded) document directly in the query filter.
Incorrect! Try again.
35Consider a scenario where a user has multiple phone numbers. What is the most efficient and standard JSON representation for this one-to-many relationship within a single document?
Using a JSON array [...] is the standard and most efficient way to represent a list of items (a one-to-many relationship) embedded within a single document, allowing for easy indexing and querying.
Incorrect! Try again.
36When deciding whether to embed a dataset or reference it in a JSON document, which of the following is a primary drawback of the embedding approach?
JSON representation of part of the dataset
Medium
A.It increases the number of database queries required to fetch the data.
B.It can lead to duplicated data and unbound document growth exceeding the database's document size limit.
C.It forces the database to convert the data into a relational table format.
D.It makes it impossible to query the embedded fields.
Correct Answer: It can lead to duplicated data and unbound document growth exceeding the database's document size limit.
Explanation:
While embedding improves read performance by keeping related data together, it can lead to data duplication and large documents that may exceed size limits (e.g., MongoDB's 16MB BSON limit) if the embedded array grows infinitely.
Incorrect! Try again.
37When analyzing a query using MongoDB's explain("executionStats"), which combination of metrics strongly suggests that an index is NOT being utilized effectively?
Index creation & performance comparison using EXPLAIN
Medium
A.totalDocsExamined is equal to nReturned
B.executionTimeMillis is close to zero
C.totalDocsExamined is much larger than nReturned
D.totalKeysExamined is equal to nReturned
Correct Answer: totalDocsExamined is much larger than nReturned
Explanation:
If totalDocsExamined is significantly larger than nReturned, it means the database had to scan many documents to find the matching ones, indicating a collection scan (COLLSCAN) or an ineffective index.
Incorrect! Try again.
38A developer creates a compound index on a collection: { department: 1, salary: -1 }. Which of the following queries will be optimally supported by this index?
Index creation & performance comparison using EXPLAIN
Medium
A.Filtering by department and sorting by salary descending.
B.Sorting by department descending and salary ascending.
C.Filtering by salary and sorting by department ascending.
D.Sorting by salary descending, without filtering by department.
Correct Answer: Filtering by department and sorting by salary descending.
Explanation:
Compound indexes support queries that match the prefix of the index. An index on { department: 1, salary: -1 } optimally supports queries filtering by department and sorting by salary in descending order.
Incorrect! Try again.
39In Vector Databases used for AI applications, what is the mathematical purpose of calculating Cosine Similarity between two high-dimensional vectors?
Vector Databases
Medium
A.To compress the vector data into a lower-dimensional space.
B.To exact-match strings based on ASCII values.
C.To measure the orientation/angle difference between two vectors to determine their semantic similarity.
D.To encrypt the vector embeddings before storage.
Correct Answer: To measure the orientation/angle difference between two vectors to determine their semantic similarity.
Explanation:
Cosine similarity measures the cosine of the angle between two vectors in a multi-dimensional space, which determines how closely related or similar two pieces of data (like text embeddings) are semantically.
Incorrect! Try again.
40Why do standard relational databases struggle with fast similarity searches on Large Language Model (LLM) embeddings (vectors in ) compared to purpose-built Vector Databases?
Vector Databases
Medium
A.RDBMS lack specialized Approximate Nearest Neighbor (ANN) algorithms like HNSW required for high-dimensional searches.
B.Relational databases cannot store floating-point numbers.
C.LLM embeddings are strictly formatted as XML, which RDBMS cannot parse.
D.Vector Databases use B-Tree indexing which RDBMS lack.
Correct Answer: RDBMS lack specialized Approximate Nearest Neighbor (ANN) algorithms like HNSW required for high-dimensional searches.
Explanation:
Traditional databases use indexes like B-trees that degrade in performance in high-dimensional spaces (the "curse of dimensionality"). Vector databases implement specific Approximate Nearest Neighbor (ANN) indexes, such as HNSW or IVF, to query high-dimensional vectors efficiently.
Incorrect! Try again.
41In a distributed database architecture evaluated under the PACELC theorem, a system is configured to prioritize Availability over Consistency during a partition, but prioritizes Consistency over Latency during normal operations. Which of the following database configurations most accurately reflects this behavior?
SQL vs NoSql
Hard
A.A NoSQL database prioritizing AP during partitions and returning stale data, while using strongly consistent reads by default when the network is healthy.
B.A NoSQL database like Cassandra configured with replication factor 3, read quorum 1, and write quorum 3.
C.A standard relational SQL database with synchronous master-slave replication.
D.A NoSQL database like DynamoDB configured with eventual consistency for reads, but strongly consistent conditional writes.
Correct Answer: A NoSQL database prioritizing AP during partitions and returning stale data, while using strongly consistent reads by default when the network is healthy.
Explanation:
PACELC extends CAP by stating that in normal operation (E), a system trades off latency (L) and consistency (C). An AP/EC system chooses Availability during a partition (P->A) and Consistency during normal operations (E->C). Returning stale data during a partition satisfies A, while defaulting to strong consistency satisfies C during normal state.
Incorrect! Try again.
42A developer migrates a highly normalized SQL schema containing an Order table and an OrderItems table to a NoSQL document database. They decide to embed OrderItems as an array inside the Order document. Under which condition does this NoSQL data model become a critical anti-pattern?
SQL vs NoSql
Hard
A.When there are frequent concurrent reads to the same Order document.
B.When the OrderItems array grows unboundedly, exceeding the hard document size limit (e.g., 16MB in MongoDB), leading to write failures.
C.When the application frequently requires querying the sum of all OrderItems prices for a specific order.
D.When the application needs to retrieve the Order details without the OrderItems.
Correct Answer: When the OrderItems array grows unboundedly, exceeding the hard document size limit (e.g., 16MB in MongoDB), leading to write failures.
Explanation:
In document databases, embedding 1:N relationships is standard unless the 'N' is unbounded. Unbounded arrays cause document size to balloon past engine limits (like MongoDB's 16MB limit) and lead to severe performance degradation during document reallocation.
Incorrect! Try again.
43A MongoDB replica set consists of a Primary, two Secondary nodes, and an Arbiter. A client executes a write operation with writeConcern: { w: "majority" }. If one Secondary node goes down, what will be the outcome of the write operation?
Introduction of MongoDB
Hard
A.The write will succeed because the Primary and the remaining Secondary form a majority of the 3 data-bearing nodes.
B.The write will block indefinitely or until a timeout occurs, because 'majority' requires acknowledgment from 2 data-bearing nodes, but only 1 Secondary is available.
C.The write will succeed because the Arbiter acts as an acknowledging node for the write concern.
D.The write will fail immediately because a majority of data-bearing nodes (3 nodes) cannot acknowledge it.
Correct Answer: The write will succeed because the Primary and the remaining Secondary form a majority of the 3 data-bearing nodes.
Explanation:
In a 4-node replica set with an Arbiter, there are 3 data-bearing nodes. The 'majority' of data-bearing nodes is 2. Since the Primary and one Secondary are still up, they can acknowledge the write, satisfying w: "majority".
Incorrect! Try again.
44MongoDB uses BSON to store documents. Which of the following best describes the structural advantage of BSON over standard JSON when querying deeply nested numeric data?
Structure of MongoDB
Hard
A.BSON natively supports indexing on string representations of numbers, making text searches faster.
B.BSON automatically compresses redundant JSON keys into a shared dictionary, reducing disk I/O significantly during collection scans.
C.BSON stores length prefixes for elements and specific numeric types (e.g., 32-bit integer, 64-bit float), allowing the query engine to skip unneeded fields without parsing the entire document.
D.BSON translates all numbers into IEEE 754 strings internally, ensuring no precision loss during cross-platform schema validation.
Correct Answer: BSON stores length prefixes for elements and specific numeric types (e.g., 32-bit integer, 64-bit float), allowing the query engine to skip unneeded fields without parsing the entire document.
Explanation:
BSON (Binary JSON) includes length prefixes for documents and arrays, as well as distinct data types (like Int32, Double). This allows the MongoDB BSON parser to quickly skip over nested documents or fields without reading them byte-by-byte, dramatically speeding up query execution compared to parsing raw text JSON.
Incorrect! Try again.
45When storing a 10MB file in MongoDB using GridFS with a default chunk size of 255KB, how is the file structurally represented and maintained transactionally during upload?
Structure of MongoDB
Hard
A.It is stored in a single BSON document in the fs.files collection, chunked internally in a multi-key array.
B.It is split into documents in fs.chunks. GridFS does not inherently guarantee atomicity for the whole file upload; if the upload is interrupted, orphaned chunks may remain.
C.It is split into exactly 40 documents in the fs.chunks collection and 1 document in fs.files. The operation requires a multi-document transaction to ensure atomicity.
D.It is stored as a binary BLOB in the fs.files collection, with GridFS mapping byte-ranges in memory to bypass the 16MB limit.
Correct Answer: It is split into documents in fs.chunks. GridFS does not inherently guarantee atomicity for the whole file upload; if the upload is interrupted, orphaned chunks may remain.
Explanation:
GridFS divides files into chunks (default 255KB) stored in fs.chunks and metadata in fs.files. By default, GridFS operations are not atomic at the file level. If an upload fails midway, the chunks uploaded so far remain as orphans until manually cleaned up.
Incorrect! Try again.
46An application writes objects of 3.5 KB to a DynamoDB table at a rate of 150 items per second using strongly consistent reads. How many Write Capacity Units (WCUs) must be provisioned to sustain this workload without throttling, assuming no adaptive capacity burst is available?
DynamoDB
Hard
A.525 WCUs
B.150 WCUs
C.600 WCUs
D.300 WCUs
Correct Answer: 600 WCUs
Explanation:
In DynamoDB, 1 WCU represents one write per second for an item up to 1 KB in size. A 3.5 KB item rounds up to 4 KB. Therefore, each write consumes 4 WCUs. For 150 items per second: 150 * 4 = 600 WCUs.
Incorrect! Try again.
47A developer needs to query a DynamoDB table by a different partition key than the base table, and requires strong consistency for these queries. Which secondary index type should they choose and why?
DynamoDB
Hard
A.Global Secondary Index (GSI), because it allows a different partition key and supports strong consistency.
B.Local Secondary Index (LSI), because it supports strong consistency, even though it shares the same partition key as the base table.
C.Global Secondary Index (GSI), because it can project all base table attributes, effectively synchronizing strong reads.
D.Neither index supports this requirement natively; strong consistency with a different partition key is impossible in DynamoDB without application-level workarounds.
Correct Answer: Neither index supports this requirement natively; strong consistency with a different partition key is impossible in DynamoDB without application-level workarounds.
Explanation:
A Global Secondary Index (GSI) allows a different partition key but only supports eventual consistency. A Local Secondary Index (LSI) supports strong consistency but MUST use the same partition key as the base table. Therefore, native strong consistency on a different partition key is not possible.
Incorrect! Try again.
48In a Serverless Cloud Database architecture utilizing stateless compute functions (like AWS Lambda) that connect directly to a traditional relational database (without a proxy), which of the following failure modes is most likely to occur under a sudden traffic spike?
Serverless cloud database
Hard
A.Connection exhaustion at the database layer due to the compute instances failing to reuse TCP connections across concurrent function invocations.
B.Compute layer OOM (Out of Memory) due to caching large query result sets.
C.Database engine deadlock caused by distributed transactions across multiple ephemeral compute instances.
D.Storage I/O throttling because serverless databases scale compute independently of storage.
Correct Answer: Connection exhaustion at the database layer due to the compute instances failing to reuse TCP connections across concurrent function invocations.
Explanation:
Stateless serverless functions scale out horizontally under load, creating a new environment (and a new database connection) for each concurrent execution. Without a connection proxy (like AWS RDS Proxy), a rapid spike will rapidly exhaust the database's maximum connection limit.
Incorrect! Try again.
49When contrasting Aurora Serverless v2 with DynamoDB On-Demand pricing and scaling, which statement accurately reflects a key architectural difference in how they handle capacity scaling?
Serverless cloud database
Hard
A.DynamoDB On-Demand limits scaling based on the number of underlying table partitions, whereas Aurora Serverless can scale table partitions infinitely without compute impact.
B.DynamoDB scales read/write capacity units instantly on a per-request basis, whereas Aurora Serverless scales compute capacity (ACUs) up and down based on resource utilization metrics over time.
C.Both scale instantly per request, but Aurora Serverless billing is calculated per gigabyte scanned, whereas DynamoDB is billed per compute hour.
D.Aurora Serverless pauses compute entirely (scaling to zero) instantly when idle, whereas DynamoDB On-Demand always maintains a warm connection pool.
Correct Answer: DynamoDB scales read/write capacity units instantly on a per-request basis, whereas Aurora Serverless scales compute capacity (ACUs) up and down based on resource utilization metrics over time.
Explanation:
DynamoDB On-Demand is a true per-request serverless model (scaling RRUs/WRUs instantly). Aurora Serverless v2 scales CPU and memory (measured in ACUs - Aurora Capacity Units) in response to database load metrics, not strictly instantly per individual query.
Incorrect! Try again.
50Consider an Aggregation Pipeline in MongoDB: [ { tags" }, { sort: { score: -1 } } ]. To optimize this pipeline for a collection with millions of documents, what structural change is strictly necessary to utilize indexes effectively?
Working with MongoDB
Hard
A.Replace lookup to avoid index fragmentation on array fields.
B.Move match so the index on score can be used to order documents prior to unwinding.
C.Move $match to be the first stage in the pipeline to filter documents using an index on tags before unwinding arrays.
D.The pipeline is already optimal because $unwind operates in memory before filtering.
Correct Answer: Move $match to be the first stage in the pipeline to filter documents using an index on tags before unwinding arrays.
Explanation:
In MongoDB, indexes can only be utilized if the sort stages appear at the beginning of the pipeline. If $unwind comes first, the entire collection is processed in memory/temp storage, and subsequent stages cannot use indexes.
Incorrect! Try again.
51MongoDB provides multi-document ACID transactions. If a transaction spans multiple shards, how does the MongoDB routing service (mongos) ensure atomicity?
Working with MongoDB
Hard
A.By utilizing a two-phase commit (2PC) protocol managed by the transaction coordinator on the primary node of the shard that received the first write.
B.By locking all collections on all shards globally until the transaction commits.
C.By falling back to eventual consistency across shards, ensuring atomicity only within a single replica set.
D.By writing a unified oplog entry to the config server, which is then broadcasted synchronously to all participating shards.
Correct Answer: By utilizing a two-phase commit (2PC) protocol managed by the transaction coordinator on the primary node of the shard that received the first write.
Explanation:
For distributed transactions across multiple shards, MongoDB uses a two-phase commit protocol. The shard that receives the first statement of the transaction acts as the coordinator to ensure all participating shards either commit or abort atomically.
Incorrect! Try again.
52JSON lacks a native Date datatype, often storing dates as ISO 8601 strings. In a JSON database, what is the primary consequence of querying a date range directly on these string fields without casting?
JSON databases
Hard
A.The query will work efficiently using lexicographical sorting, but will return incorrect results if the strings include varying timezone offsets (e.g., +00:00 vs -07:00) instead of being normalized to UTC.
B.The query evaluates the strings based on their byte-length rather than chronological order.
C.The query will fail due to strict type enforcement in JSON schema parsers.
D.The database must perform a full collection scan because strings cannot be indexed for range queries.
Correct Answer: The query will work efficiently using lexicographical sorting, but will return incorrect results if the strings include varying timezone offsets (e.g., +00:00 vs -07:00) instead of being normalized to UTC.
Explanation:
ISO 8601 strings naturally sort lexicographically (alphabetically) in chronological order IF they are in the same timezone (usually UTC, 'Z'). If timezones vary, lexicographical sorting fails to represent true chronological order.
Incorrect! Try again.
53When storing highly polymorphic JSON documents in a database utilizing Schema-on-Read, a user writes a query filtering on an attribute that exists in only 1% of the documents. What is the most significant performance limitation if no sparse index is present?
JSON databases
Hard
A.The query optimizer will ignore the filter condition and return all documents, leaving filtering to the application layer.
B.The database will throw a schema violation error for the 99% of documents missing the field.
C.The database automatically creates an ephemeral index in memory, delaying the first query execution but optimizing subsequent ones.
D.The query engine must retrieve and parse the JSON structure of every document to check for the field's existence, resulting in high CPU and I/O overhead.
Correct Answer: The query engine must retrieve and parse the JSON structure of every document to check for the field's existence, resulting in high CPU and I/O overhead.
Explanation:
In schema-on-read JSON databases, the structure is evaluated at query time. Without an index (specifically a sparse index for rare fields), the engine must perform a full scan, parsing every document to determine if the queried field exists, which is extremely resource-intensive.
Incorrect! Try again.
54To represent a hierarchical 'Employee-Manager' organizational chart in a JSON dataset, a developer implements the Materialized Paths pattern. Which of the following is an accurate representation of a node in this design?
The Materialized Paths pattern stores the full lineage of a node as a string (or array of strings) in a single attribute (e.g., path: ",CEO,CTO,EngLead,"). This allows for efficient querying of subtrees using regular expressions or string prefixes. Option A is Parent/Child referencing, Option C is Nested Sets, Option D is Array of Ancestors.
Incorrect! Try again.
55When modeling a Many-to-Many (M:N) relationship between Students and Courses strictly using JSON document structures, embedding Students within Courses leads to data duplication. If we instead use an 'Array of References' (storing course IDs in the student document), what is the primary query complexity introduced?
JSON representation of part of the dataset
Hard
A.The references will automatically enforce referential integrity, locking the Courses collection during student updates.
B.To retrieve a course and all its enrolled students, the application must execute an application-level join, making two separate database queries or using a complex $lookup pipeline.
C.The maximum array size limit will be reached rapidly, as a course usually has thousands of students.
D.It completely prevents the use of secondary indexes on course IDs.
Correct Answer: To retrieve a course and all its enrolled students, the application must execute an application-level join, making two separate database queries or using a complex $lookup pipeline.
Explanation:
NoSQL document databases generally do not natively execute relational JOINs efficiently. Storing references means retrieving related data requires an application-level join (querying students, then mapping course IDs to query courses) or a database $lookup, which is slower than retrieving embedded data.
Incorrect! Try again.
56A MongoDB collection has a compound index { "status": 1, "created_at": -1 }. Which of the following query/sort combinations will result in an in-memory sort, bypassing the sort optimization of the index?
Index creation & performance comparison using EXPLAIN
Hard
C.db.orders.find({ status: "A" }).sort({ created_at: -1 })
D.db.orders.find({ status: "A" }).sort({ created_at: 1 })
Correct Answer: db.orders.find({ status: "A" }).sort({ created_at: 1 })
Explanation:
For an index { a: 1, b: -1 }, sorting by { a: 1, b: -1 } or { a: -1, b: 1 } (inverse) uses the index. If status is an equality match (status: "A"), sorting by created_at: -1 or created_at: 1 can both use the index. Wait, this is a tricky edge case. Actually, if there's an equality match on the prefix, the index can traverse the suffix in either direction! Let me re-evaluate Option D: { status: -1, created_at: 1 } matches the inverse exactly, so it uses the index. The actual case that fails is sorting on a mismatched direction without equality on the prefix, but since status is not filtered in C or D, C is exact match, D is inverse. What if we sort by { status: 1, created_at: 1 }? That would fail. Since that's not an option, wait, equality match allows forward and backward traversal of the suffix. Therefore A and B both use index. D uses index. None of these? Wait, db.orders.find().sort({ status: 1, created_at: 1 }) fails. Let's fix the correct option to reflect a true in-memory sort scenario: sorting by { status: 1, created_at: 1 }.
Incorrect! Try again.
57A MongoDB collection has a compound index { "category": 1, "price": -1 }. Which of the following operations will trigger an in-memory sort (represented as SORT stage in EXPLAIN) rather than using the index for sorting?
Index creation & performance comparison using EXPLAIN
Hard
MongoDB can traverse a compound index in its defined direction or its exact inverse. The index is { category: 1, price: -1 }. The exact inverse is { category: -1, price: 1 }. However, { category: 1, price: 1 } matches neither the prefix direction nor the inverse, meaning the index cannot provide the sorted order, forcing a blocking in-memory sort.
Incorrect! Try again.
58When analyzing the output of an explain("executionStats") command in MongoDB, you observe that totalKeysExamined is 10,000, but totalDocsExamined is 0. What is the most accurate conclusion?
Index creation & performance comparison using EXPLAIN
Hard
A.The collection is empty, but the index tree still contains 10,000 orphaned leaf nodes.
B.The query failed to find any documents matching the criteria, resulting in a null set.
C.The query was completely covered by the index, meaning all queried and projected fields were satisfied by the index keys alone.
D.The query used an index, but the index was highly unselective, resulting in poor performance.
Correct Answer: The query was completely covered by the index, meaning all queried and projected fields were satisfied by the index keys alone.
Explanation:
A 'Covered Query' occurs when the index contains all the fields required by the query's conditions and its projection. The database reads the index keys (totalKeysExamined) but never needs to fetch the actual documents from disk (totalDocsExamined = 0).
Incorrect! Try again.
59In Vector Databases, indexing high-dimensional data for exact k-Nearest Neighbors (k-NN) has time complexity. To improve latency, systems use Approximate Nearest Neighbor (ANN) algorithms. Which of the following describes the HNSW (Hierarchical Navigable Small World) index structure used to achieve sub-linear time?
Vector Databases
Hard
A.It uses clustering (like K-Means) to divide the vector space into Voronoi cells, assigning vectors to the nearest centroid.
B.It quantizes vectors into 8-bit integers, mathematically compressing the matrix multiplication space to fit into GPU L1 cache.
C.It constructs a multi-layered graph where upper layers have fewer connections for long-distance traversals, and lower layers are dense for localized greedy search.
D.It projects high-dimensional vectors onto random lower-dimensional hyperplanes to generate binary hash codes for Hamming distance comparison.
Correct Answer: It constructs a multi-layered graph where upper layers have fewer connections for long-distance traversals, and lower layers are dense for localized greedy search.
Explanation:
HNSW builds a hierarchical graph (similar to skip-lists). The search starts at the top (sparsest) layer to quickly navigate to the general neighborhood of the query vector, then drops down to denser lower layers to find the nearest neighbors accurately.
Incorrect! Try again.
60When computing vector similarity, Cosine Similarity calculates the angle between two vectors, while Euclidean Distance () measures geometric straight-line distance. If all vectors in a database are strictly normalized (magnitude of 1), what is the mathematical relationship between Euclidean distance squared () and Cosine Similarity ()?
Vector Databases
Hard
A.
B.
C.
D.There is no deterministic relationship; they must be computed independently even if normalized.
Correct Answer:
Explanation:
For two vectors and , the Euclidean distance squared is . If vectors are normalized, and , and is the Cosine Similarity . Thus, .