Exams > Microsoft > DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB
DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB
Page 3 out of 10 pages Questions 21-30 out of 91 questions
Question#21

You have the following query.

You need to recommend a composite index strategy that will minimize the request units (RUs) consumed by the query.
What should you recommend?

  • A. a composite index for (sensor ASC, value ASC) and a composite index for (sensor ASC, timestamp ASC)
  • B. a composite index for (sensor ASC, value ASC, timestamp ASC) and a composite index for (sensor DESC, value DESC, timestamp DESC)
  • C. a composite index for (value ASC, sensor ASC) and a composite index for (timestamp ASC, sensor ASC)
  • D. a composite index for (sensor ASC, value ASC, timestamp ASC)
Discover Answer Hide Answer

Answer: A
If a query has a filter with two or more properties, adding a composite index will improve performance.
Consider the following query:
SELECT * FROM c WHERE c.name = ג€Timג€ and c.age > 18
In the absence of a composite index on (name ASC, and age ASC), we will utilize a range index for this query. We can improve the efficiency of this query by creating a composite index for name and age.
Queries with multiple equality filters and a maximum of one range filter (such as >,<, <=, >=, !=) will utilize the composite index.
Reference:
https://azure.microsoft.com/en-us/blog/three-ways-to-leverage-composite-indexes-in-azure-cosmos-db/

Question#22

You have a database in an Azure Cosmos DB Core (SQL API) account. The database contains a container named container1. The indexing mode of container1 is set to none.
You configure Azure Cognitive Search to extract data from container1 and make the data searchable.
You discover that the Cognitive Search index is missing all the data from the Azure Cosmos DB index.
What should you do to resolve the issue?

  • A. Modify the index attributes in Cognitive Search to Searchable
  • B. Modify the index attributes in Cognitive Search to Retrievable
  • C. Modify the indexing policy of container1 to exclude the /* path
  • D. Change the indexing mode of container1 to consistent
Discover Answer Hide Answer

Answer: D
Azure Cognitive Search needs an index.
Azure Cosmos DB supports two indexing modes:
Consistent: The index is updated synchronously as you create, update or delete items.
None: Indexing is disabled on the container. This is commonly used when a container is used as a pure key-value store without the need for secondary indexes. It can also be used to improve the performance of bulk operations.
Note: In Azure Cognitive Search, a search index is your searchable content, available to the search engine for indexing, full text search, and filtered queries.
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/index-policy https://docs.microsoft.com/en-us/azure/search/search-what-is-an-index

Question#23

HOTSPOT -
You have an Azure Cosmos DB Core (SQL) API account that frequently receives the same three queries.
You need to configure indexing to minimize RUs consumed by the queries.
Which type of index should you use for each query? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Discover Answer Hide Answer

Answer:
Box 1: Range -
Range index is based on an ordered tree-like structure. The range index type is used for:
Equality queries:
SELECT * FROM container c WHERE c.property = 'value'
SELECT * FROM c WHERE c.property IN ("value1", "value2", "value3")

Box 2: Composite -
Composite indexes increase the efficiency when you are performing operations on multiple fields. The composite index type is used for:
Queries with a filter on two or more properties where at least one property is an equality filter
SELECT * FROM container c WHERE c.property1 = 'value' AND c.property2 > 'value'

Box 3: Composite -
Incorrect:
Spatial indices enable efficient queries on geospatial objects such as - points, lines, polygons, and multipolygon. These queries use ST_DISTANCE, ST_WITHIN,
ST_INTERSECTS keywords.
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/index-overview

Question#24

You have a container named container1 in an Azure Cosmos DB Core (SQL) API account named account1 that is set to the session default consistency level. The average size of an item in contained is 20 KB.
You have an application named App1 that uses the Azure Cosmos DB SDK and performs a point read on the same set of items in container1 every minute.
You need to minimize the consumption of the request units (RUs) associated to the reads by App1.
What should you do?

  • A. In App1, modify the connection policy settings
  • B. In App1, change the consistency level of read requests to consistent prefix
  • C. In account1, provision a dedicated gateway and integrated cache
  • D. In account1, change the default consistency level to bounded staleness
Discover Answer Hide Answer

Answer: C
The main goal of the integrated cache is to reduce costs for read-heavy workloads. Low latency, while helpful, is not the main benefit of the integrated cache because Azure Cosmos DB is already fast without caching.
Point reads and queries that hit the integrated cache won't use any RUs. In other words, any cache hits will have an RU charge of 0. Cache hits will have a much lower per-operation cost than reads from the backend database.
Workloads that fit the following characteristics should evaluate if the integrated cache will help lower costs:

Read-heavy workloads -
Many repeated point reads on large items

Many repeated high RU queries -

Hot partition key for reads -
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/integrated-cache

Question#25

You have an application that queries an Azure Cosmos DB Core (SQL) API account.
You discover that the following two queries run frequently.

You need to minimize the request units (RUs) consumed by reads and writes.
What should you create?

  • A. a composite index for (name DESC, timestamp ASC)
  • B. a composite index for (name ASC, timestamp ASC) and a composite index for (name DESC, timestamp DESC)
  • C. a composite index for (name ASC, timestamp ASC)
  • D. a composite index for (name ASC, timestamp DESC)
Discover Answer Hide Answer

Answer: C
You should customize your indexing policy so you can serve all necessary ORDER BY queries.
ORDER BY queries on multiple properties:
The following considerations are used when using composite indexes for queries with an ORDER BY clause with two or more properties:
* The composite index also supports an ORDER BY clause with the opposite order on all paths.
* If the composite index paths do not match the sequence of the properties in the ORDER BY clause, then the composite index can't support the query.
* The order of composite index paths (ascending or descending) should also match the order in the ORDER BY clause.
Consider the following example where a composite index is defined on properties name, age, and _ts:

Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/index-overview

Question#26

You have a container in an Azure Cosmos DB Core (SQL) API account.
Data update volumes are unpredictable.
You need to process the change feed of the container by using a web app that has multiple instances. The change feed will be processed by using the change feed processor from the Azure Cosmos DB SDK. The multiple instances must share the workload.
Which three actions should you perform? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point.

  • A. Configure the same processor name for all the instances
  • B. Configure a different processor name for each instance
  • C. Configure a different instance name for each instance
  • D. Configure a different lease container configuration for each instance
  • E. Configure the same instance name for all the instances
  • F. Configure the same lease container configuration for all the instances
Discover Answer Hide Answer

Answer: ACF
A: Implementing the change feed processor.
The point of entry is always the monitored container, from a Container instance you call GetChangeFeedProcessorBuilder.
C: You define the compute instance name or unique identifier with WithInstanceName, this should be unique and different in each compute instance you are deploying.
F: The lease container: The lease container acts as a state storage and coordinates processing the change feed across multiple workers. The lease container can be stored in the same account as the monitored container or in a separate account.
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/change-feed-processor

Question#27

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a database in an Azure Cosmos DB Core (SQL) API account that is configured for multi-region writes.
You need to use the Azure Cosmos DB SDK to implement the conflict resolution policy for a container. The solution must ensure that any conflicts are sent to the conflicts feed.
Solution: You set ConflictResolutionMode to Custom and you use the default settings for the policy.
Does this meet the goal?

  • A. Yes
  • B. No
Discover Answer Hide Answer

Answer: B
You can create a custom conflict resolution policy but you need a stored procedure as well.
The stored procedure should use the conflictingItems parameter. conflictingItems: Array of the committed version of all items in the container that are conflicting with incomingItem on ID or any other unique index properties.
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/how-to-manage-conflicts

Question#28

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a database in an Azure Cosmos DB Core (SQL) API account that is configured for multi-region writes.
You need to use the Azure Cosmos DB SDK to implement the conflict resolution policy for a container. The solution must ensure that any conflicts are sent to the conflicts feed.
Solution: You set ConflictResolutionMode to Custom. You set ResolutionProcedure to a custom stored procedure. You configure the custom stored procedure to use the conflictingItems parameter to resolve conflicts.
Does this meet the goal?

  • A. Yes
  • B. No
Discover Answer Hide Answer

Answer: A
You can create a custom conflict resolution policy using a stored procedure.
The stored procedure should use the conflictingItems parameter. conflictingItems: Array of the committed version of all items in the container that are conflicting with incomingItem on ID or any other unique index properties.
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/how-to-manage-conflicts

Question#29

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a database in an Azure Cosmos DB Core (SQL) API account that is configured for multi-region writes.
You need to use the Azure Cosmos DB SDK to implement the conflict resolution policy for a container. The solution must ensure that any conflicts are sent to the conflicts feed.
Solution: You set ConflictResolutionMode to LastWriterWins and you use the default settings for the policy.
Does this meet the goal?

  • A. Yes
  • B. No
Discover Answer Hide Answer

Answer: A
You can create a last-writer-wins conflict resolution policy.
These samples show how to set up a container with a last-writer-wins conflict resolution policy. The default path for last-writer-wins is the timestamp field or the _ts property. For SQL API, this may also be set to a user-defined path with a numeric type. In a conflict, the highest value wins. If the path isn't set or it's invalid, it defaults to _ts. Conflicts resolved with this policy do not show up in the conflict feed. This policy can be used by all APIs.
.NET SDK
DocumentCollection lwwCollection = await createClient.CreateDocumentCollectionIfNotExistsAsync(
UriFactory.CreateDatabaseUri(this.databaseName), new DocumentCollection
{
Id = this.lwwCollectionName,
ConflictResolutionPolicy = new ConflictResolutionPolicy
{
Mode = ConflictResolutionMode.LastWriterWins,
ConflictResolutionPath = "/myCustomId",
},
});
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/how-to-manage-conflicts

Question#30

HOTSPOT -
You have the following Azure Resource Manager (ARM) template.

You plan to deploy the template in incremental mode.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Discover Answer Hide Answer

Answer:
Box 1: No -
An account is not a resource in this context.
Note: In incremental mode, Resource Manager leaves unchanged resources that exist in the resource group but aren't specified in the template. Resources in the template are added to the resource group.
The Microsoft.DocumentDB databaseAccounts/sqlDatabases/containers resource type can be deployed to: Resource groups.

Box 2: Yes -
A container is a resource.

Box 3: Yes -
When redeploying an existing resource in incremental mode, all properties are reapplied. The properties aren't incrementally added. A common misunderstanding is to think properties that aren't specified in the template are left unchanged. If you don't specify certain properties, Resource Manager interprets the deployment as overwriting those values. Properties that aren't included in the template are reset to the default values. Specify all non-default values for the resource, not just the ones you're updating. The resource definition in the template always contains the final state of the resource. It can't represent a partial update to an existing resource.
Note: In incremental mode, Resource Manager leaves unchanged resources that exist in the resource group but aren't specified in the template. Resources in the template are added to the resource group.
Reference:
https://docs.microsoft.com/en-us/azure/templates/microsoft.documentdb/databaseaccounts/sqldatabases/containers https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-modes#incremental-mode

chevron rightPrevious Nextchevron right