exam questions

Exam DP-203 All Questions

View all questions & answers for the DP-203 exam

Exam DP-203 topic 2 question 28 discussion

Actual exam question from Microsoft's DP-203
Question #: 28
Topic #: 2
[All DP-203 Questions]

HOTSPOT -
You are building an Azure Analytics query that will receive input data from Azure IoT Hub and write the results to Azure Blob storage.
You need to calculate the difference in the number of readings per sensor per hour.
How should you complete the query? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: LAG -
The LAG analytic operator allows one to look up a ג€previousג€ event in an event stream, within certain constraints. It is very useful for computing the rate of growth of a variable, detecting when a variable crosses a threshold, or when a condition starts or stops being true.

Box 2: LIMIT DURATION -
Example: Compute the rate of growth, per sensor:
SELECT sensorId,
growth = reading -
LAG(reading) OVER (PARTITION BY sensorId LIMIT DURATION(hour, 1))

FROM input -
Reference:
https://docs.microsoft.com/en-us/stream-analytics-query/lag-azure-stream-analytics

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ANath
Highly Voted 2 years, 11 months ago
The answer is correct
upvoted 19 times
...
UristMcFarmer
Highly Voted 2 years ago
The question and answer do not match. The question asks for "the difference in THE NUMBER OF READINGS per sensor per hour". The answer given is to compute the difference between the current sensor reading and the sensor reading from an hour ago.
upvoted 10 times
...
Azure_2023
Most Recent 11 months, 1 week ago
Correct. Choosing the Right Function: When you need to compare a value with its future occurrences: Use LEAD. When you need to analyze dependencies or trends based on past values: Use LAG. When you want to identify the maximum or minimum for a group based on a specific order: Use LAST.
upvoted 9 times
...
Momoanwar
1 year, 1 month ago
Correct, cgatpgt : To calculate the difference in the number of readings per sensor per hour using an Azure Stream Analytics query, you would use the LAG function to access the previous value and then calculate the difference. Here is how you would complete the query: - Use `LAG` to get the previous reading. - Use `LIMIT DURATION` to set the window of time for comparison, which in this case is per hour. The completed query would look something like this: ```sql SELECT sensorId, reading - LAG(reading) OVER (PARTITION BY sensorId LIMIT DURATION(hour, 1)) AS growth FROM input ``` This query assumes `reading` is the column holding the sensor data and `sensorId` is the column to partition the data by each sensor. The `LAG` function gets the last reading for the same sensor from the previous hour, and then you subtract this value from the current reading to find the growth.
upvoted 1 times
...
kkk5566
1 year, 4 months ago
should be correct
upvoted 1 times
...
Rajan191083
1 year, 7 months ago
LAG is the correct answer. Refer the below link. It mentions this example https://learn.microsoft.com/en-us/stream-analytics-query/lag-azure-stream-analytics
upvoted 4 times
...
Deeksha1234
2 years, 5 months ago
right answer
upvoted 4 times
...
Muishkin
2 years, 8 months ago
what about LAST?
upvoted 1 times
hbad
2 years, 8 months ago
LAST is possible, however the code sample in this question does not include any WHEN syntax, so that will rule out LAST
upvoted 4 times
UzairMir
1 year, 5 months ago
When clause is optional https://learn.microsoft.com/en-us/stream-analytics-query/last-azure-stream-analytics Still cannot understand the difference between LAG and LAST :(
upvoted 2 times
...
...
...
onyerleft
3 years ago
Answers as revealed are for computing the rate of growth per sensor. https://docs.microsoft.com/en-us/stream-analytics-query/lag-azure-stream-analytics#examples
upvoted 5 times
bubububox
3 years ago
yep, but the question here is unclear
upvoted 6 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...