Unit 6 - Practice Quiz

INT306 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What 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

2 Which data format does MongoDB use internally to store documents?

Introduction of MongoDB Easy
A. XML
B. YAML
C. CSV
D. BSON

3 Amazon 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

4 Which 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

5 What 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.

6 How 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

7 In 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

8 In MongoDB, what corresponds to a row in a traditional relational database?

Structure of MongoDB Easy
A. Database
B. Index
C. Document
D. Collection

9 Which 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

10 How 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)

11 Which 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()

12 Which 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()

13 What 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

14 Which 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

15 In 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 [ ]

16 Which 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"

17 What 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

18 Which 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()

19 Vector databases are primarily designed to store and search which type of data?

Vector Databases Easy
A. Relational schemas
B. Key-value pairs only
C. High-dimensional vectors (embeddings)
D. Tabular financial data

20 Which 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

21 Which 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.

22 An 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.

23 In 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.

24 How 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.

25 When 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.

26 Which 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.
C. Serverless databases require upfront licensing fees.
D. Serverless databases charge based on reserved instance types and uptime.

27 In 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.

28 Which 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

29 An 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.
B. NoSQL databases offer flexible schemas, preventing sparse tables filled with NULL values.
C. SQL databases cannot store text strings longer than 255 characters.
D. SQL databases lack support for indexing entirely.

30 In 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.

31 Which 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" ] })
B. db.employees.find({ age: > 30, status: "Active" })
C. db.employees.search({ age: { $greater: 30 }, status: "Active" })
D. db.employees.find({ age: { $gt: 30 }, status: "Active" })

32 A 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 }

33 Why 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.

34 When querying a JSON database, how are fields within nested objects typically accessed?

JSON databases Medium
A. Using bracket notation exclusively, e.g., parent['child']
B. By writing a recursive function inside the query.
C. Using dot notation, e.g., "parent.child"
D. By flattening the document before querying.

35 Consider 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?

JSON representation of part of the dataset Medium
A. "phones": "1234567890, 0987654321"
B. "phone1": "1234567890", "phone2": "0987654321"
C. "phones": { "1": "1234567890", "2": "0987654321" }
D. "phones": ["1234567890", "0987654321"]

36 When 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.

37 When 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

38 A 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.

39 In 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.

40 Why 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.

41 In 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.

42 A 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.

43 A 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.

44 MongoDB 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.

45 When 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.

46 An 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

47 A 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.

48 In 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.

49 When 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.

50 Consider 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.

51 MongoDB 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.

52 JSON 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.

53 When 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.

54 To 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?

JSON representation of part of the dataset Hard
A. { "_id": "Dev1", "manager": "EngLead", "subordinates": [] }
B. { "_id": "Dev1", "left": 14, "right": 15 }
C. { "_id": "Dev1", "ancestors": ["EngLead", "CTO", "CEO"] }
D. { "_id": "Dev1", "path": ",CEO,CTO,EngLead,", "level": 4 }

55 When 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.

56 A 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
A. db.orders.find().sort({ status: 1, created_at: -1 })
B. db.orders.find().sort({ status: -1, created_at: 1 })
C. db.orders.find({ status: "A" }).sort({ created_at: -1 })
D. db.orders.find({ status: "A" }).sort({ created_at: 1 })

57 A 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
A. db.products.find().sort({ category: 1, price: -1 })
B. db.products.find().sort({ category: 1, price: 1 })
C. db.products.find({ category: "electronics" }).sort({ price: 1 })
D. db.products.find().sort({ category: -1, price: 1 })

58 When 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.

59 In 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.

60 When 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.