Microsoft Azure Developer Associate AZ-204 Practice Question
You are developing a C# app that updates the Balance property of a document in an Azure Cosmos DB SQL API container that uses /accountId as the partition key. The code must minimize request units by sending only the modified field and must fail if the item's ETag has changed. Which SDK approach should you use?
Call UpsertItemAsync() after changing the Balance property in memory and set EnableContentResponseOnWrite to false.
Call ReplaceItemAsync() and pass ItemRequestOptions with IfMatchEtag set to the current ETag.
Call PatchItemAsync() with a PatchOperations.Replace("/Balance", newBalance) operation and PatchItemRequestOptions that sets IfMatchEtag to the current ETag.
Use a transactional batch with a ReplaceItem operation for the item and set the ConsistencyLevel to Strong.
PatchItemAsync lets you submit one or more PatchOperation objects so that only the targeted paths are transmitted and modified. Because the SDK does not need to read or write the full JSON document, the operation typically consumes fewer request units than ReplaceItemAsync or UpsertItemAsync, which always send the entire document. By setting the IfMatchEtag property in PatchItemRequestOptions, the request is executed only if the current ETag on the server matches the value you provide, preventing accidental overwrites caused by concurrent updates. Other choices either transmit the full document (increasing RU costs) or do not supply an ETag condition, so they do not meet both requirements.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a partition key in Azure Cosmos DB?
Open an interactive chat with Bash
What is the role of ETag in Azure Cosmos DB operations?
Open an interactive chat with Bash
How does PatchItemAsync minimize request unit (RU) costs compared to ReplaceItemAsync?
Open an interactive chat with Bash
Microsoft Azure Developer Associate AZ-204
Develop for Azure storage
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .