Courseiva
Question 404 of 881
Develop Azure compute solutionshardMultiple ChoiceObjective-mapped

AZ-204 Develop Azure compute solutions Practice Question

You are implementing a Durable Functions orchestration that calls an activity function which may fail transiently. You want to retry the activity up to 3 times with a 5-second delay and exponential backoff. Which code snippet should you use?

⚠ Common exam trap

Watch out — candidates often confuse `CallActivityAsync` with `CallActivityWithRetryAsync`, assuming that retry options can be passed as an additional parameter to the former, or they may underestimate the value of the built-in retry mechanism and opt for a manual loop, which is less robust and not idiomatic in Durable Functions.

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

await context.CallActivityWithRetryAsync("Activity", new RetryOptions(TimeSpan.FromSeconds(5), 3), input);

The Durable Functions SDK provides the `CallActivityWithRetryAsync` method, which accepts a `RetryOptions` object to configure retry count and delay. The `RetryOptions` constructor takes `TimeSpan.FromSeconds(5)` as the first retry interval and `3` as the maximum number of attempts, including the initial call. This built-in method handles exponential backoff automatically, eliminating the need for manual retry logic.

Answer analysis

Option-by-option breakdown

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

  • await context.CallActivityAsync("Activity", input);

    Why it's wrong here

    The `context.CallActivityAsync` method executes an activity function a single time without any built-in retry mechanism. If the called activity fails due to a transient error, the orchestration will either fail or require explicit, manual implementation of retry logic using a `try-catch` block and durable timers, which is less efficient and more verbose than using the dedicated retry API.

  • await context.CallActivityWithRetryAsync("Activity", new RetryOptions(TimeSpan.FromSeconds(5), 3), input);

    Why this is correct

    This is the correct and idiomatic approach for implementing built-in retry logic in Durable Functions orchestrations. The `context.CallActivityWithRetryAsync` method automatically handles transient failures by retrying the specified activity function based on the provided `RetryOptions`, which define the `FirstRetryInterval` (5 seconds) and `MaxNumberOfAttempts` (3), ensuring robustness without manual retry loops.

  • await context.CallActivityAsync("Activity", input, new RetryOptions(TimeSpan.FromSeconds(5), 3));

    Why it's wrong here

    This option is syntactically incorrect because the `context.CallActivityAsync` method does not have an overload that accepts `RetryOptions` as an argument. Attempting to pass `RetryOptions` to `CallActivityAsync` would result in a compilation error, as the method signature is not designed to incorporate built-in retry policies directly through this specific overload.

  • Use a durable timer and a loop to retry manually.

    Why it's wrong here

    A manual loop with a durable timer lacks the built-in retry policy that Durable Functions provides via `CallActivityWithRetryAsync`, which automatically manages exponential backoff and maximum attempt counts. This approach is tempting because it offers explicit control over timing and retry logic, and would be correct for custom retry patterns not supported by the built-in retry feature, such as non-standard delays or conditional retries based on activity output.

Visual reference

Client Server SYN (seq=100) SYN-ACK (seq=200, ack=101) ACK (ack=201) Connection established — data transfer begins

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.