Google Professional Cloud Developer exam dumps

Google Professional Cloud Developer practice question 269 of 481

Professional Cloud Developer. Professional level, Google Cloud. Free question with the correct answer and a full explanation.

Google Professional Cloud Developer Question 269

Select 3Google Cloud Platform

You are developing a serverless application on Google Cloud using Cloud Functions. During the testing phase, you notice intermittent failures in your function due to an external API’s rate-limiting behavior. Which of the following practices should you implement to ensure reliable and repeatable tests?

  1. A

    Mock the external API responses to isolate the function’s logic during testing.

  2. B

    Increase the timeout value of the Cloud Function to handle API rate limits.

  3. C

    Use a retry mechanism in the Cloud Function to handle transient API failures.

  4. D

    Write integration tests that directly call the external API to validate end-to-end behavior.

  5. E

    Use a dedicated testing environment or sandbox for the external API, if available.

Show answer and explanation

Correct answers: A, C, E

Explanation

To ensure reliable and repeatable tests, you should mock external API responses to isolate your application logic, implement a retry mechanism to handle transient failures, and use a dedicated testing environment or sandbox for external dependencies. These practices reduce variability, improve resilience, and enable consistent testing outcomes. Increasing the timeout or relying on direct API calls introduces unnecessary risks and does not align with testing best practices.

  • A. Correct.

    Mocking the external API responses allows you to isolate the function’s logic and avoid external dependencies during tests, ensuring consistent and reliable results.

  • B. Incorrect.

    Increasing the timeout value does not address the underlying issue of API rate limits and can lead to longer delays or failure in production scenarios.

  • C. Correct.

    A retry mechanism is a good practice to handle transient failures like rate-limiting, improving the function’s resilience during testing and production.

  • D. Incorrect.

    Directly calling the external API for integration tests might be useful occasionally, but it introduces variability due to rate-limiting and does not ensure repeatable tests.

  • E. Correct.

    Using a dedicated testing environment or sandbox for the external API, if available, allows you to test without affecting production APIs and helps maintain control over rate limits during testing.

Timed practice exam

Take a Google Professional Cloud Developer practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam