DVA-C02 exam dumps

DVA-C02 practice question 95 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 95

Single answer

You are developing an application that uses Amazon DynamoDB to store product data. The DynamoDB table has a partition key named 'ProductCategory' and a sort key named 'ProductID'. You need to retrieve all items in a specific product category sorted by their ProductID, with high performance and minimal cost. Which operation should you use?

  1. A

    Query with a condition on the partition key 'ProductCategory'.

  2. B

    Scan with a filter condition on 'ProductCategory'.

  3. C

    Query with a filter condition on 'ProductCategory'.

  4. D

    Scan with a condition on the partition key 'ProductCategory'.

Show answer and explanation

Correct answer: A

Explanation

The Query operation is the correct choice when you need to retrieve items based on a specific partition key. It is optimized for performance and cost, as it retrieves only the relevant items without scanning the entire table. In this scenario, using Query with the partition key 'ProductCategory' ensures efficient retrieval of the items sorted by 'ProductID'. Scan, on the other hand, reads all the table items, regardless of any conditions, making it less efficient for targeted queries.

  • A. Correct.

    Correct. The Query operation retrieves items based on the partition key and optionally sorts by the sort key. It provides high performance and is cost-efficient for this use case.

  • B. Incorrect.

    Incorrect. The Scan operation examines every item in the table, making it less efficient and more costly than Query for retrieving specific items.

  • C. Incorrect.

    Incorrect. Query does not use filter conditions on the partition key. Instead, it directly uses the partition key to locate items, which is more efficient.

  • D. Incorrect.

    Incorrect. While Scan can use conditions, it still reads all items in the table, leading to higher costs and lower performance compared to Query.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam