Questions
- In a multithreaded environment, which of the following data structures should you use to protect data from getting overwritten/corrupted?
a. async-await.
b. Tasks.
c. Synchronization constructs such as locks.
d. Data never gets corrupted.
Answer : a
- If you have a WPF application that retrieves data from a REST API, which of the following should you implement for better responsiveness?
a. A concurrent collection
b. Parallel.For
c. async-await for the REST API calls
Answer: c
- Which of the following should be passed to cancel a task?
a. CancellationToken
b. ConcurrentDictionary
c. SemaphoreSlim
Answer: a
- Which of the following is the recommended return type for an asynchronous method that uses async-await and does not return anything?
a. async void
b. async Task
c. async book
d. async Task<bool>
Answer: b