Welcome to this comprehensive guide on Azure Cosmos DB MCQ questions and answers tailored for mastering its APIs. Azure Cosmos DB is a globally distributed, multi-model database service designed for modern application development. In this set of 30 multiple-choice questions, you will learn about the key concepts and usage of SQL API for document-oriented data, MongoDB API for NoSQL applications, Cassandra API for wide-column stores, Gremlin API for graph data, and Table API for key-value pairs. These questions are ideal for exam preparation or brushing up on your Azure Cosmos DB skills.
Chapter 4: Working with Azure Cosmos DB APIs – MCQs
Topic 1: Using SQL API for Document-Oriented Data
What is the default consistency level of Azure Cosmos DB when using the SQL API? a) Strong b) Eventual c) Session d) Bounded staleness
Which query language is used with the SQL API in Azure Cosmos DB? a) T-SQL b) ANSI SQL c) SQL-like syntax tailored for JSON d) SPARQL
What type of data does the SQL API in Azure Cosmos DB primarily handle? a) Key-value data b) Relational data c) JSON document-oriented data d) Graph data
How does Azure Cosmos DB index data when using the SQL API? a) Only primary keys are indexed b) All fields are indexed by default c) Indexing must be manually configured d) No indexing is supported
What function does the ARRAY_CONTAINS method perform in SQL API queries? a) Checks if a field contains an array b) Validates if a specific value exists within an array c) Joins two arrays d) Splits an array into multiple documents
Which of the following is a valid Azure Cosmos DB SQL API query? a) SELECT * FROM c WHERE c.id = '123' b) GET ALL FROM c WHERE c.id = '123' c) FIND c FROM id = '123' d) SELECT DOCUMENTS c WHERE id = '123'
Topic 2: Working with MongoDB API for NoSQL Applications
What does the MongoDB API in Azure Cosmos DB enable developers to do? a) Query relational data b) Use MongoDB drivers to interact with Cosmos DB c) Configure VMs for MongoDB deployment d) Perform transactions on graph data
Which command is supported by Azure Cosmos DB’s MongoDB API? a) db.collection.insertOne() b) SELECT FROM c) GRAPH MATCH d) GET TABLE ROWS
What is the maximum document size supported by the MongoDB API in Azure Cosmos DB? a) 2 MB b) 4 MB c) 8 MB d) 16 MB
How does the MongoDB API handle data partitioning in Azure Cosmos DB? a) By using collection-level sharding b) By assigning static storage quotas c) By creating secondary indexes d) By setting up primary keys only
Which tool can developers use to migrate data from MongoDB to Azure Cosmos DB? a) Azure Data Migration Service b) Cosmos DB CLI c) MongoDB Compass d) Azure File Sync
What happens if a MongoDB API query exceeds the RU limit in Azure Cosmos DB? a) The query fails with an error b) It executes with reduced consistency c) The query is throttled d) The RU limit is automatically increased
Topic 3: Using Cassandra API for Wide-Column Stores
What is the purpose of the Cassandra API in Azure Cosmos DB? a) To manage key-value pairs b) To support wide-column database models c) To store graph data d) To handle JSON documents
Which programming language can interact with Azure Cosmos DB using the Cassandra API? a) C# b) Java c) Python d) All of the above
How does the Cassandra API support querying data in Azure Cosmos DB? a) Through CQL (Cassandra Query Language) b) By using SQL queries c) Via Gremlin syntax d) By running Spark jobs
What is the primary unit of replication in the Cassandra API? a) Partition key b) Table c) Cluster d) Keyspace
Which Azure Cosmos DB feature ensures data consistency for the Cassandra API? a) Tunable consistency levels b) Data sharding c) Virtual networks d) Table triggers
How does the Cassandra API handle secondary indexes? a) Automatically indexes all columns b) Supports user-defined secondary indexes c) Requires no index configuration d) Limits to primary key indexing only
Topic 4: Graph Data with Gremlin API
What is the Gremlin API used for in Azure Cosmos DB? a) Managing relational data b) Querying graph-based data models c) Importing JSON documents d) Handling key-value pairs
Which language does the Gremlin API support for querying graph data? a) T-SQL b) Gremlin traversal language c) JSON Path d) SQL
What is a common use case for the Gremlin API in Azure Cosmos DB? a) Real-time analytics b) Social network graphs c) Document management systems d) Transactional processing
What does a “vertex” represent in the Gremlin API? a) A table schema b) A node in the graph c) A database partition d) A query execution plan
How does the Gremlin API ensure relationship consistency? a) By maintaining edges between vertices b) By using secondary indexes c) By implementing eventual consistency d) By reducing replication latency
Which Gremlin step retrieves all connected edges for a given vertex? a) outE() b) inV() c) hasLabel() d) count()
Topic 5: Table API for Key-Value Pairs
What is the Table API in Azure Cosmos DB used for? a) Handling key-value data pairs b) Managing graph-based queries c) Importing large-scale files d) Storing JSON documents
Which programming language supports Table API interactions in Cosmos DB? a) .NET b) Python c) JavaScript d) All of the above
What query method is supported by the Table API? a) OData queries b) CQL queries c) SQL-like joins d) Gremlin traversals
How is partitioning handled in the Table API? a) By defining a partition key per table b) By setting static table sizes c) By using multiple secondary indexes d) By enabling global sharding
Which property is mandatory when adding an entity in Table API? a) PartitionKey b) EntityId c) IndexKey d) RowKey
What is the maximum size for a single entity in the Table API? a) 64 KB b) 1 MB c) 5 MB d) 16 MB
Answer Key
Qno
Answer
1
b) Eventual
2
c) SQL-like syntax tailored for JSON
3
c) JSON document-oriented data
4
b) All fields are indexed by default
5
b) Validates if a specific value exists within an array