300-435 · Question #22
What are two characteristics of synchronous calls to APIs? (Choose two.)
The correct answer is C. They can add perceived latency to your application if data is not received. D. They block until a response is returned from the servers. Synchronous API calls block the execution of the calling program until a response is received, which can introduce perceived latency.
Question
Options
- AThey can be used only with certain programming languages.
- BThey make your application less portable, as asynchronous calls are preferred.
- CThey can add perceived latency to your application if data is not received.
- DThey block until a response is returned from the servers.
- EThey do not block while waiting for the API to be processed.
How the community answered
(23 responses)- A4% (1)
- B9% (2)
- C87% (20)
Why each option
Synchronous API calls block the execution of the calling program until a response is received, which can introduce perceived latency.
Synchronous API calls are a fundamental programming paradigm available in virtually all programming languages, not restricted to certain ones.
The choice between synchronous and asynchronous calls is a design decision based on application needs, not a factor that inherently affects application portability.
When an application makes a synchronous API call, it pauses and waits for the API response. If the API is slow or data is delayed, the application remains unresponsive during this waiting period, leading to increased perceived latency for the user.
A synchronous API call is a blocking operation, meaning the program execution will halt at the point of the call and wait for the API server to process the request and return a response before proceeding to the next line of code.
This describes asynchronous calls; synchronous calls explicitly block the execution of the calling thread or process until a response is received.
Concept tested: Synchronous vs. Asynchronous API calls
Source: https://www.geeksforgeeks.org/synchronous-vs-asynchronous-communication/
Topics
Community Discussion
No community discussion yet for this question.