Free DP-420 Exam Braindumps
Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB Questions 56–60 (page: 13)

Updated On: 16-Nov-2026
View Related Case Study

You have an Azure Cosmos DB for NoSQL account that contains a database named DB1 and a container named Container1.
You need to manage the account by using the Azure Cosmos DB SDK.
What should you do?

  1. Create a container in DB1.
  2. List the physical partitions of Container1.
  3. Read a stored procedure in Container1.
  4. Create a user defined function (UDF) in Container1.

Answer(s): D

Explanation:

How to register and use stored procedures, triggers, and user-defined functions in Azure Cosmos DB
How to work with user-defined functions
The following examples show how to register a user-defined function by using the Azure Cosmos DB SDKs.
The following code shows how to register a user-defined function using the .NET SDK v2:
string udfId = "Tax";
var udfTax = new UserDefinedFunction
{
Id = udfId,
Body = File.ReadAllText($@"..\js\{udfId}.js")
};
Uri containerUri = UriFactory.CreateDocumentCollectionUri("myDatabase", "myContainer");
await client.CreateUserDefinedFunctionAsync(containerUri, udfTax);
Note: Azure Cosmos DB provides language-integrated, transactional execution of JavaScript.
When using the API for NoSQL in Azure Cosmos DB, you can write stored procedures, triggers, and user-defined functions (UDFs) in the JavaScript language. You can write your logic in JavaScript that executed inside the database engine. You can create and execute triggers, stored procedures, and UDFs by using Azure portal, the JavaScript language integrated query API in Azure Cosmos DB or the Azure Cosmos DB for NoSQL client SDKs.


Reference:

https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-use-stored-procedures-triggers-udfs



View Related Case Study

Note: This section contains one or more sets of questions with the same scenario and problem. Each question presents a unique solution to the problem. You must determine whether the solution meets the stated goals. More than one solution in the set might solve the problem. It is also possible that none of the solutions in the set solve the problem.
After you answer a question in this section, you will NOT be able to return. As a result, these questions do not appear on the Review Screen.
You have an Azure Cosmos DB for NoSQL database. The database hosts a container named families that stores data in the following format.

You need to return the following data:
● The ID of the family
● The family names of the children
● The name of any pets if the pet is a cat
Solution: You run the following query.

Does this meet the goal?

  1. Yes
  2. No

Answer(s): B

Explanation:

Correct:
Use two JOINS and one subquery, not three JOINS and a subquery.
* You run the following query.

The following Azure Cosmos DB NoSQL query fulfills the requirements by unnesting child array items and filtering the pet array:
To retrieve the family ID, the children's family names, and the rabbit's name, you can use the query below.
SELECT f.id, c.familyName AS FamilyName, p.givenName AS petName
FROM families f
JOIN f.children c
JOIN (SELECT VALUE p FROM p IN c.pets WHERE p.type = 'cat') AS p
1. Flatten the Children Array
To access individual properties within the children sub-array, use a JOIN statement. In Azure Cosmos DB, a JOIN performs an inner product between the document root (f) and the array (f.children). This filters out any family documents that contain no children.
2. Isolate Cat Pets
To inspect the properties of the pets array embedded inside each child, apply a secondary JOIN on c.pets. The WHERE clause then filters these projected items to only include cases where the property $p.type$ matches the string "cat".
3. Project Specific Attributes
The SELECT clause restricts the final JSON output schema to contain exactly three custom-aliased properties: familyId: Extracted from the root document
IDchildFamilyName: Extracted from the current child item iterationpetName: Extracted from the matching pet item iteration
Incorrect:
* You run the following query.

Use two JOINS and one subquery, not three JOINS and a subquery.
* You run the following query.

CROSS APPLY should not be used.


Reference:

https://learn.microsoft.com/en-us/cosmos-db/query/subquery



View Related Case Study

You have an Azure subscription that contains an Azure Cosmos DB for NoSQL database named DB1.
In DB1, you plan to create a container that will use a hierarchical partition key.
You need to identify which hierarchical partition key path to use when adding new items to the container.
Which SDK class should you use?

  1. CompositePath
  2. PartitionKeyDefinition
  3. PartitionKey
  4. PartitionKeyBuilder

Answer(s): D

Explanation:

Manually specify the path
The PartitionKeyBuilder class in the SDK can construct a value for a previously defined hierarchical partition key path. Use this class when you add a new item to a container that has subpartitioning enabled.


Reference:

https://learn.microsoft.com/en-us/azure/cosmos-db/hierarchical-partition-keys



View Related Case Study

HOTSPOT (Drag and Drop is not supported)
You have a container in an Azure Cosmos DB for NoSQL account. The database that has a manual throughput of 30,000 request units per second (RU/s).
The current consumption details are shown in the following chart.

Use the drop-down menus to select the answer choice that answers each question based on the information presented in the graphic.
Note: Each correct selection is worth one point.
Hot Area:

  1. See Explanation section for answer.

Answer(s): A

Explanation:



Box 1: 5, 0000
From the exhibit we see that there are 6 partitions.
30,000 / 6 = 5,000
Note: For example, if you assign a throughput of 18,000 request units per second (RU/s), then each of say three physical partitions can utilize 1/3 of the total provisioned throughput.
Box 2: 60,000
6 x 10,000 = 60,000 is the max.
Note: Physical partitions
A container is scaled by distributing data and throughput across physical partitions. Internally, one or more logical partitions are mapped to a single physical partition. Typically, smaller containers have many logical partitions but they only require a single physical partition. Unlike logical partitions, physical partitions are an internal implementation of the system and Azure Cosmos DB entirely manages physical partitions.
The number of physical partitions in your container depends on the following characteristics:
* The amount of throughput provisioned (each individual physical partition can provide a throughput of up to 10,000 request units per second). The 10,000 RU/s limit for physical partitions implies that logical partitions also have a 10,000 RU/s limit, as each logical partition is only mapped to one physical partition.
* The total data storage (each individual physical partition can store up to 50 GBs of data).


Reference:

https://learn.microsoft.com/en-us/azure/cosmos-db/partitioning-overview



View Related Case Study

You have an Azure Cosmos DB for NoSQL account named account1.
In account1, you plan to create a container named container1 that will contain data continuously collected from self-driving cars. The items in container1 will be accessed mostly by using queries that target data collected from a specific car during a given day. Each car is identifiable by using a property named Vehicle-Identification-Number.
You need to identify a partition strategy for container1. The strategy must meet the following requirements:
-Maximize read and write performance.
-Minimize the costs of data reads and writes.
What should you identify?

  1. Use a partition key based on the Vehicle-Identification-Number property.
  2. Construct a synthetic key by concatenating the current date and a random suffix.
  3. Use a partition key based on the current date.
  4. Construct a synthetic key by concatenating the current date and a hash of the Vehicle-Identification-Number property value.

Answer(s): D

Explanation:

For an Azure Cosmos DB for NoSQL container storing continuous self-driving car data, the optimal partition strategy is to use the requested synthetic partition key constructed by concatenating the current date and a hash of the Vehicle-Identification-Number (VIN).
Why this strategy is optimal:
Maximizes Read Performance:
Since your primary access pattern targets a specific car on a given day, this synthetic key ensures that all relevant data for that query resides in a single logical partition.
This allows the database to perform efficient in-partition queries rather than expensive and slow cross-partition scans.
Maximizes Write Performance:
Including a hash of the VIN ensures high cardinality, which prevents "hot partitions".
Even if many cars are reporting data simultaneously, the hash-based distribution spreads these writes across multiple physical partitions.
Minimizes Costs:
By avoiding cross-partition queries, you significantly reduce Request Unit (RU) consumption, as each physical partition scan adds overhead (typically 2-3 RUs per partition).
The 20-GB logical partition limit is less likely to be exceeded because data for a single car is scoped to a single day rather than its entire history.


Reference:

https://www.dclessons.com/azure-cosmos-db



Viewing page 13 of 61
Viewing questions 61 - 65 out of 296 questions


Post your Comments and Discuss Microsoft DP-420 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!