Recall & Review
beginner
What does the
async keyword do in C#?The
async keyword marks a method as asynchronous, allowing it to run operations without blocking the main thread. It enables the use of await inside the method.Click to reveal answer
beginner
What is the purpose of the
await keyword?await pauses the execution of an async method until the awaited task completes, without blocking the thread. It helps write asynchronous code that looks like synchronous code.Click to reveal answer
intermediate
Can an
async method return void?Yes, but only for event handlers. Normally, async methods return
Task or Task<T> to allow callers to await them and handle exceptions.Click to reveal answer
intermediate
What happens if you forget to use
await inside an async method?The method will run synchronously until it hits an awaited task. If you don't use
await, the method may complete early and not wait for asynchronous operations, causing bugs.Click to reveal answer
beginner
Why is using
async and await better than blocking calls?They keep the app responsive by not blocking threads. This is like waiting for a friend without stopping everything else you do, improving performance and user experience.
Click to reveal answer
What keyword do you use to mark a method as asynchronous in C#?
✗ Incorrect
The
async keyword marks a method as asynchronous.What does the
await keyword do?✗ Incorrect
await pauses the async method but does not block the thread.Which return type is common for async methods?
✗ Incorrect
Async methods usually return
Task or Task<T>.What happens if you call an async method but do not use
await?✗ Incorrect
Without
await, the caller does not wait for the async method to finish.Why should you avoid blocking calls in UI applications?
✗ Incorrect
Blocking calls freeze the UI, making the app unresponsive.
Explain how
async and await work together in C# to keep applications responsive.Think about waiting for a task without stopping everything else.
You got /4 concepts.
Describe the common return types of async methods and why they are important.
Consider how the caller knows when the async work is done.
You got /5 concepts.