Courseiva
Develop for Azure storagemediumMultiple ChoiceObjective-mapped

AZ-204 Develop for Azure storage Practice Question

You need to store temperature readings from IoT devices in Azure Table Storage. Each reading includes a device ID (string), timestamp (datetime), temperature value, and location. You must optimize for the query: "Retrieve all temperature readings for a specific device ID within a given one-hour time range." Which PartitionKey and RowKey combination should you use?

⚠ Common exam trap

It's easy for candidates to choose Option D, thinking that a composite PartitionKey will improve query performance, but in Azure Table Storage, a composite key in PartitionKey actually creates unique partitions per row, which prevents efficient range queries and forces point lookups, making it worse for time-range queries.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

PartitionKey = DeviceId, RowKey = Timestamp

Azure Table Storage queries are most efficient when the PartitionKey and RowKey are chosen to match the query pattern. By using DeviceId as the PartitionKey, all readings for a specific device are stored in the same partition, enabling fast partition-level scans. Using Timestamp as the RowKey allows efficient range queries within a one-hour window using RowKey comparisons, which is the optimal design for time-range queries on a single device.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • PartitionKey = DeviceId, RowKey = Timestamp

    Why this is correct

    This design is optimal for IoT data. The PartitionKey, `DeviceId`, groups all temperature readings from a specific device into a single partition, enabling highly efficient point queries or range queries for that device without scanning unrelated data. Within this partition, the `RowKey`, `Timestamp`, ensures that readings are stored in chronological order, which is crucial for performing fast and cost-effective time-based range queries (e.g., retrieving all readings for a device within a specific hour or day).

  • PartitionKey = Location, RowKey = DeviceId

    Why it's wrong here

    Using `Location` as the PartitionKey would scatter a single device's readings across multiple partitions if the device moves or if multiple devices are at different locations, making it inefficient to retrieve all data for a specific `DeviceId`. Furthermore, with `DeviceId` as the RowKey, all readings for a particular device would not be grouped together within a single partition, necessitating costly and slow cross-partition scans to gather all data for a single device.

  • PartitionKey = Temperature, RowKey = Timestamp

    Why it's wrong here

    Making `Temperature` the PartitionKey is highly inefficient for typical IoT data access patterns. Temperature values are often continuous or have a wide range, leading to either many small partitions or a few very large, 'hot' partitions if many devices report similar temperatures. This schema makes it impossible to efficiently query data for a specific `DeviceId` without performing a full table scan, as the primary access key does not align with the most common query dimension.

  • PartitionKey = DeviceId + Timestamp, RowKey = empty

    Why it's wrong here

    Concatenating `DeviceId` and `Timestamp` into the `PartitionKey` creates a unique partition for virtually every single temperature reading. While this allows for direct access to a specific reading if both `DeviceId` and `Timestamp` are known, it severely hinders efficient range queries. Any query attempting to retrieve readings for a device over a time window would necessitate scanning across multiple distinct partitions, resulting in costly and slow cross-partition operations rather than efficient in-partition range scans.

About these practice questions

Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.