Wednesday, September 3, 2025

Cosmos DB storage - Practice Tests

You are planning to use the Azure Cosmos DB NoSQL API to store documents in a container. You need to create the container using .NET code. You run the code shown below, but no container is created.

Container container1 = await database.CreateContainerAsync( id: "", partitionKeyPath: "/pk", throughput: 200 );

You need to adjust the code to ensure that the container is created successfully.

What two actions should you perform? Each correct answer presents a part of the solution.

Choose the correct answers

  • [ ] Remove "/" from the partitionKeyPath.
  • [ ] Make the partitionKeyPath longer.
  • [ ] Decrease the throughput to 10.
  • [ ] Make the id non-empty.
  • [ ] Increase the throughput to 800.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You are using the Azure Cosmos DB .NET SDK to add a large number of items to a container. You would like to maximize the performance of the insertion operations. How should you configure each setting?

  • Connectivity Mode: [Gateway / Direct]
  • Call pattern: [Asynchronous / Synchronous]
  • AllowBulkExecution: [Keep default / Override default]
  • EnableContentResponseOnWrite: [True / False]

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You use Azure Cosmos DB to store data in Azure. The Cosmos DB account spans five regions. Data can be written only to the West US region at any given time and then replicated to the other regions.

You need to ensure that clients never receive a partial write of data when they retrieve data.

Which consistency level should you use?

Choose the correct answer

  • [ ] Consistent prefix
  • [ ] Strong
  • [ ] Session
  • [ ] Eventual

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You use the .NET SDK to create an Azure Cosmos DB account.

You need to create the database and container only if they are absent.

How should you complete the code?
To answer, select the appropriate code segments from the drop-down menus.


public static async Task Main(string[] args)

{

    Database database = await InitializeDatabase(_client, "EntertainmentDatabase");

    Container container = await InitializeContainer(database, "EntertainmentContainer");

}


private static async Task<Database> InitializeDatabase(CosmosClient client, string databaseId)

{

    Database database = await client. ____________ (databaseId);

    await Console.Out.WriteLineAsync($"Database Id:\t{database.Id}");

    return database;

}


private static async Task<Container> InitializeContainer(Database database, string containerId)

{

    ContainerProperties containerProperties =

        new ContainerProperties(containerId, "/type");


    Container container = await database. ____________ (containerProperties, 400);

    await Console.Out.WriteLineAsync($"Container Id:\t{container.Id}");

    return container;

}


For the first blank

A. CreateDatabaseAsync
B. CreateDatabaseIfNotExistsAsync
C. CreateDatabaseStreamAsync

For the second blank

A. CreateContainerAsync
B. CreateContainerIfNotExistsAsync
C. CreateContainerStreamAsync


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Your company is designing an application to manage manufacturing based on data collected by sensors throughout the factory. The data is unstructured and is well-suited to the graph data model. Data access must be supported across multiple regions.

You need to identify the most appropriate consistency level for the database solution. The solution should meet the following requirements:

  • Guarantee that data writes are returned in order with no gaps.
  • Process returned data by either the most current version or the prior version of the data.
  • Minimize latency and adverse impact on data availability.
  • Keep processing overhead to a minimum.

These requirements should be met when data is requested by any client session.

Which consistency level should you implement?

Choose the correct answer

  • Session
  • Eventual
  • Consistent prefix
  • Bounded staleness


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Your company uses Cosmos DB to store sales orders from its e-commerce platform. You want to build a solution that notifies inventory backend when an order is placed for certain products.

You need to use the change feed feature in Cosmos DB to enable the required business logic.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

StatementYesNo
Change feed is enabled in Cosmos DB by default.
Change feed captures deletes.
Change feed guarantees order across the partition key values.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You need to determine the results of a query against an Azure Cosmos DB that uses the SQL API. You execute the following query:

SELECT *
    FROM Invoices i
    WHERE i.id = 1

What should you expect the query to produce?

Choose the correct answer

  • JSON-formatted data
  • A table structured as rows and columns
  • XML-formatted data
  • A syntax error


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You use the Azure portal to create an Azure Cosmos DB account, as shown in the exhibit.

You need to access the first item in the Items container by using Query Explorer. The results must be formatted as JSON.

Which query should you use?

Choose the correct answer

  • [ ] SELECT TOP 1 {name, description} FROM Tasks/Items
  • [ ] SELECT TOP 1 name, description FROM Items
  • [ ] SELECT TOP 1 {name, description} FROM Items
  • [ ] SELECT TOP 1 i.name, i.description FROM items i


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You have the following code:

IDatabase database = ConnectionMultiplexer.Connect(connectionString).GetDatabase();
var result = database.Execute("PING").ToString();

You need to determine what happens when this code is run.

What happens when this code is run?

Choose the correct answer

  • [ ] It creates a connection to an Azure Cosmos DB account.
  • [ ] It verifies a connection to an Azure Cache for Redis
  • [ ] It determines whether an Azure virtual machine (VM) allows Internet Control Message Protocol (ICMP) connections.
  • [ ] It ensures that an Azure SQL database is available.



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You create an Azure Cosmos DB container named receipts that represents business receipts. The container is part of a Cosmos DB database named mup. No other databases or containers exist in the Cosmos DB account. A sample item is shown below:

{
    "id": "1001",
    "amount": 213.13,
    "vendor": "MeasureUp",
    "category": "Lodging",
    "date": "2022-08-06"
}

You need to write a query that returns all receipts where the category is Lodging.

Which two queries would meet your goal? Each correct answer presents a complete solution.

Choose the correct answers

  • [ ] SELECT * FROM root WHERE category = "Lodging"
  • [ ] SELECT * FROM receipts r WHERE r.category = "Lodging"
  • [ ] SELECT * FROM receipts WHERE category = "Lodging"
  • [ ] SELECT * FROM root r WHERE r.category = "Lodging"



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

A static resource database for a public multiplayer game site is hosted in a Cosmos DB that uses the SQL data model.

You need to guarantee the highest possible availability and lowest latency for data reads.

Which consistency level should you use?

Choose the correct answer

  • [ ] Bounded staleness
  • [ ] Consistent prefix
  • [ ] Eventual
  • [ ] Session
  • [ ] Strong



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You are updating an application that stores data on Azure and uses Azure Cosmos DB for storage. The application stores data in multiple documents associated with a single username.

The application requires the ability to update multiple documents for a username in a single ACID operation.

You need to configure Azure Cosmos DB.

Which two actions should you perform? Each correct answer presents part of the solution.

NOTE: Each correct selection is worth one point.

  • A) Configure Azure Cosmos DB to use the Azure Cosmos DB for Apache Gremlin API.
  • B) Configure Azure Cosmos DB to use the Azure Cosmos DB for MongoDB API.
  • C) Create a collection sharded on username to store documents.
  • D) Create an unsharded collection to store documents.


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

"DRAG DROP - You are creating an Azure Cosmos DB account that makes use of the SQL API. Data will be added to the account every day by a web application. You need to ensure that an email notification is sent when information is received from IoT devices, and that compute cost is reduced. You decide to deploy a function app. Which of the following should you configure the function app to use? Answer by dragging the correct options from the list to the answer area."

Opciones para arrastrar:

  • Azure Cosmos DB connector
  • SendGrid action
  • Consumption plan
  • Azure Event Hubs binding
  • SendGrid binding


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This question requires that you evaluate the underlined text to determine if it is correct. Your company has an on-premises deployment of MongoDB, and an Azure Cosmos DB account that makes use of the MongoDB API. You need to devise a strategy to migrate MongoDB to the Azure Cosmos DB account. You include the Data Management Gateway tool in your migration strategy.

Instructions: Review the underlined text. If it makes the statement correct, select "No change required." If the statement is incorrect, select the answer choice that makes the statement correct.

  • A) No change required
  • B) mongorestore
  • C) Azure Storage Explorer
  • D) AzCopy


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

You create an Azure Cosmos DB for NoSQL database. You plan to use the Azure Cosmos DB .NET SDK v3 API for NoSQL to upload the following files:

File NameFile Size
File11MB
File22MB
File33MB
File44MB
File55MB

You receive the following error message when uploading the files: "413 Entity too large". You need to determine which files you can upload to the Azure Cosmos DB for NoSQL database. Which files can you upload?

  1. A) File1, File2. File3. and File4 only
  2. B) File1 and File2 only
  3. C) File1, File2. and File3 only
  4. D) File1. File2. File3. File4, and File5





No comments:

Post a Comment