exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 26 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 26
Topic #: 1
[All Professional Cloud Developer Questions]

You are writing a single-page web application with a user-interface that communicates with a third-party API for content using XMLHttpRequest. The data displayed on the UI by the API results is less critical than other data displayed on the same web page, so it is acceptable for some requests to not have the API data displayed in the UI. However, calls made to the API should not delay rendering of other parts of the user interface. You want your application to perform well when the API response is an error or a timeout.
What should you do?

  • A. Set the asynchronous option for your requests to the API to false and omit the widget displaying the API results when a timeout or error is encountered.
  • B. Set the asynchronous option for your request to the API to true and omit the widget displaying the API results when a timeout or error is encountered.
  • C. Catch timeout or error exceptions from the API call and keep trying with exponential backoff until the API response is successful.
  • D. Catch timeout or error exceptions from the API call and display the error response in the UI widget.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
[Removed]
Highly Voted 4 years, 4 months ago
Answer is B. Api should not delay rendering: asynchronous Application perform well when Api error or timeout: omit the widget
upvoted 11 times
...
syu31svc
Highly Voted 3 years, 2 months ago
Correct answer is B Asynchronous handling provides the ability to call the API in the background without blocking the rendering of other elements. If the response is received it can be rendered or omitted if a timeout occurs.
upvoted 6 times
...
santoshchauhan
Most Recent 7 months, 3 weeks ago
Selected Answer: B
B. Asynchronous requests allow the browser to continue processing other tasks while waiting for the API response. If the response is an error or a timeout, you can handle this gracefully by not displaying the widget or showing a message indicating that the data couldn't be loaded. This way, the performance of the rest of your page remains unaffected.
upvoted 1 times
...
dscifo
1 year ago
Selected Answer: B
About synchronous=true is more comfortable for user experience.
upvoted 1 times
...
__rajan__
1 year, 1 month ago
Selected Answer: B
Correct Answer B.
upvoted 1 times
...
maxdanny
1 year, 2 months ago
Selected Answer: B
Setting the asynchronous option to true means that the requests will not block the main thread and will be executed in the background. Furthermore, so as written in the description the widget can be omitted
upvoted 1 times
...
omermahgoub
1 year, 9 months ago
A is not the correct answer because setting the asynchronous option for the API request to false will block rendering of the user interface until the API response is received. This can cause a delay in rendering other parts of the user interface and negatively impact the performance of the application. B is the correct answer because setting the asynchronous option for the API request to true allows the user interface to continue rendering while the API request is being processed, which improves the performance of the application. Omitting the widget displaying the API results when a timeout or error is encountered allows the application to continue functioning without waiting for a successful API response.
upvoted 1 times
...
tomato123
2 years, 2 months ago
Selected Answer: B
B is correct
upvoted 3 times
...
herocc
2 years, 9 months ago
B is right one
upvoted 1 times
...
ParagSanyashiv
2 years, 9 months ago
Selected Answer: B
Understanding the question correctly, the answer should be B
upvoted 1 times
...
nehaxlpb
3 years, 3 months ago
In will vote C, as we can catch the error and retry api again, it is like we us amazone we select a project and we see pricing and other content as the picture are loaded asyn.
upvoted 2 times
...
mishsanjay
3 years, 8 months ago
can't achieve using synchronous requests, so answer must be B.
upvoted 1 times
...
saurabh1805
3 years, 11 months ago
Answer is B
upvoted 2 times
...
emmet
4 years, 5 months ago
It should be B), isn't it? Proposed answer A) uses synchronous behaviour so will block execution, it contradicts the question
upvoted 4 times
...
Alekshar
4 years, 5 months ago
"calls made to the API should not delay rendering" -> so A cannot be the answer as it makes Synchronous requests. B is a better option
upvoted 1 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago