Google Professional Cloud Developer Practice Test 38
Question 370
A unit test for business-tax calculation unexpectedly creates real Pub/Sub messages and sometimes fails on network outages. The team is choosing a sustainable solution. Which design best meets the stated requirement without broad unrelated changes? Select ONE best answer.
- Generate authorized attestations tied to immutable artifact digests before the deployment policy evaluates them.
- Isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage.
- Use versioned dependencies and safe build caches rather than sacrificing reproducibility for faster downloads.
- Use a supported emulator for local feature tests and keep separate targeted tests for real cloud IAM, quotas, and networking.
Explanation
Correct Answer
B:Isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage. Before rollout, inspect the test boundary, external service calls, fixture data, and whether functions are deterministic. In this scenario, a unit test for business-tax calculation unexpectedly creates real Pub/Sub messages and sometimes fails on network outages.
Incorrect Answers
A:Generate authorized attestations tied to immutable artifact digests before the deployment policy evaluates them. This design addresses binary Authorization attestations in CI, where Binary Authorization requires digest-specific trust evidence and an enforcement policy, not just an assertion that a build succeeded. It cannot substitute for the required control: isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage.
C:Use versioned dependencies and safe build caches rather than sacrificing reproducibility for faster downloads. For this case, unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. It cannot substitute for the required control: isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage.
D:Use a supported emulator for local feature tests and keep separate targeted tests for real cloud IAM, quotas, and networking. This design addresses local Google Cloud emulator boundaries, where local emulators reduce feedback latency but cannot certify every managed-service feature or production security boundary. It cannot substitute for the required control: isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage.
Question 371
A unit test for business-tax calculation unexpectedly creates real Pub/Sub messages and sometimes fails on network outages. An approved limited change can be tested in a safe environment. Which implementation action most directly addresses this scenario? Select ONE best answer.
- Create versioned build configuration with ordered test, image build, and Artifact Registry push stages.
- Enable the approved merge controls and attach immutable commit IDs to built artifacts and deployment records.
- Mock external clients at a defined interface and assert expected function outputs for representative cases.
- Review the suggested patch, verify imported methods, and run targeted tests and static analysis before merge.
Explanation
Correct Answer
C:Mock external clients at a defined interface and assert expected function outputs for representative cases. Unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. Validate the change by checking that unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior.
Incorrect Answers
A:Create versioned build configuration with ordered test, image build, and Artifact Registry push stages. This action changes a different concern, Cloud Build container pipeline steps. It addresses a different dependency from unit testing with isolated dependencies.
B:Enable the approved merge controls and attach immutable commit IDs to built artifacts and deployment records. This action changes a different concern, source control branch protection and review. It addresses a different dependency from unit testing with isolated dependencies.
D:Review the suggested patch, verify imported methods, and run targeted tests and static analysis before merge. This action changes a different concern, Gemini Code Assist generated code verification. It addresses a different dependency from unit testing with isolated dependencies.
Question 372
A unit test for business-tax calculation unexpectedly creates real Pub/Sub messages and sometimes fails on network outages. The team has tried a correction. Which measurable outcome most directly demonstrates that this issue is resolved? Select ONE best answer.
- Only changes matching the documented release conditions initiate the expected pipeline.
- Unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior.
- Reviewers can trace an artifact to its build inputs and trusted builder without relying on a mutable filename.
- The integrated code compiles, behaves as intended, and introduces no unreviewed permission or business-logic change.
Explanation
Correct Answer
B:Unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. Unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. The original diagnosis should have included this step: inspect the test boundary, external service calls, fixture data, and whether functions are deterministic.
Incorrect Answers
A:Only changes matching the documented release conditions initiate the expected pipeline. In this case, the outcome to verify is that unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. The reported condition is about unit testing with isolated dependencies, not this adjacent change.
C:Reviewers can trace an artifact to its build inputs and trusted builder without relying on a mutable filename. In this case, the outcome to verify is that unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. The reported condition is about unit testing with isolated dependencies, not this adjacent change.
D:The integrated code compiles, behaves as intended, and introduces no unreviewed permission or business-logic change. That result could support testing of Gemini Code Assist generated code verification: AI coding assistance can accelerate development but generated suggestions do not establish their own correctness or safety. The reported condition is about unit testing with isolated dependencies, not this adjacent change.
Question 373
A developer conflates an integration test with a unit test and cannot determine which code path caused the failure. Before choosing a remediation, which investigation best isolates the specific cause or unmet dependency? Select ONE best answer.
- Inspect which Google Cloud service exposes a supported emulator and which production behaviors the emulator cannot simulate.
- Inspect build steps, image artifact outputs, stage dependencies, and failure propagation.
- Inspect proxy lifecycle, database IAM permissions, network reachability, client credentials, and database user access.
- Inspect the test boundary, external service calls, fixture data, and whether functions are deterministic.
Explanation
Correct Answer
D:Inspect the test boundary, external service calls, fixture data, and whether functions are deterministic. This checks the actual operating conditions relevant to unit testing with isolated dependencies, rather than changing a service before the failure is understood. In this scenario, a developer conflates an integration test with a unit test and cannot determine which code path caused the failure.
Incorrect Answers
A:Inspect which Google Cloud service exposes a supported emulator and which production behaviors the emulator cannot simulate. Local emulators reduce feedback latency but cannot certify every managed-service feature or production security boundary. This is not the decisive inspection for unit testing with isolated dependencies.
B:Inspect build steps, image artifact outputs, stage dependencies, and failure propagation. A build pipeline must explicitly encode its ordering and failure gates; saving a Dockerfile alone does not enforce release quality. This is not the decisive inspection for unit testing with isolated dependencies.
C:Inspect proxy lifecycle, database IAM permissions, network reachability, client credentials, and database user access. Cloud SQL connection helpers secure the connection path; database-level authentication and authorization still apply separately. This is not the decisive inspection for unit testing with isolated dependencies.
Question 374
A developer conflates an integration test with a unit test and cannot determine which code path caused the failure. The team is choosing a sustainable solution. Which design best meets the stated requirement without broad unrelated changes? Select ONE best answer.
- Generate authorized attestations tied to immutable artifact digests before the deployment policy evaluates them.
- Use versioned dependencies and safe build caches rather than sacrificing reproducibility for faster downloads.
- Isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage.
- Capture supported build provenance with a documented trust level and link it to the deployed artifact.
Explanation
Correct Answer
C:Isolate business logic using controlled stubs or mocks while keeping separate cloud integration coverage. Before rollout, inspect the test boundary, external service calls, fixture data, and whether functions are deterministic. In this scenario, a developer conflates an integration test with a unit test and cannot determine which code path caused the failure.
Incorrect Answers
A:Generate authorized attestations tied to immutable artifact digests before the deployment policy evaluates them. This design addresses binary Authorization attestations in CI, where Binary Authorization requires digest-specific trust evidence and an enforcement policy, not just an assertion that a build succeeded. That may help elsewhere, but it does not make the change required for unit testing with isolated dependencies.
B:Use versioned dependencies and safe build caches rather than sacrificing reproducibility for faster downloads. For this case, unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. That may help elsewhere, but it does not make the change required for unit testing with isolated dependencies.
D:Capture supported build provenance with a documented trust level and link it to the deployed artifact. For this case, unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. That may help elsewhere, but it does not make the change required for unit testing with isolated dependencies.
Question 375
A developer conflates an integration test with a unit test and cannot determine which code path caused the failure. An approved limited change can be tested in a safe environment. Which implementation action most directly addresses this scenario? Select ONE best answer.
- Mock external clients at a defined interface and assert expected function outputs for representative cases.
- Record the digest at build completion and pin it in deployment manifests and release evidence.
- Refactor the Dockerfile to separate compilation from runtime and inspect the final image filesystem and dependency inventory.
- Set user permissions and file ownership deliberately, then run unit and container startup checks under the final image identity.
Explanation
Correct Answer
A:Mock external clients at a defined interface and assert expected function outputs for representative cases. Unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. Validate the change by checking that unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. An approved limited change can be tested in a safe environment.
Incorrect Answers
B:Record the digest at build completion and pin it in deployment manifests and release evidence. This action changes a different concern, artifact Registry image digest reproducibility. A more direct response is to recognize that mock external clients at a defined interface and assert expected function outputs for representative cases.
C:Refactor the Dockerfile to separate compilation from runtime and inspect the final image filesystem and dependency inventory. This action changes a different concern, multi-stage Docker image construction. A more direct response is to recognize that mock external clients at a defined interface and assert expected function outputs for representative cases.
D:Set user permissions and file ownership deliberately, then run unit and container startup checks under the final image identity. This action changes a different concern, non-root minimal container runtime. A more direct response is to recognize that mock external clients at a defined interface and assert expected function outputs for representative cases.
Question 376
A developer conflates an integration test with a unit test and cannot determine which code path caused the failure. The team has tried a correction. Which measurable outcome most directly demonstrates that this issue is resolved? Select ONE best answer.
- The application reaches the intended instance without opening unrestricted inbound database access.
- Only reviewed commits with passing checks reach production and each deployment has a reproducible source reference.
- Only images carrying the expected evidence satisfy the admission policy; arbitrary tags do not bypass the gate.
- Unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior.
Explanation
Correct Answer
D:Unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. Unit tests target a bounded code unit; production network dependencies should be tested through separate controlled integration layers. The original diagnosis should have included this step: inspect the test boundary, external service calls, fixture data, and whether functions are deterministic. A developer conflates an integration test with a unit test and cannot determine which code path caused the failure. The team has tried a correction.
Incorrect Answers
A:The application reaches the intended instance without opening unrestricted inbound database access. In this case, the outcome to verify is that unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. The case instead calls for the following: unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior.
B:Only reviewed commits with passing checks reach production and each deployment has a reproducible source reference. In this case, the outcome to verify is that unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior. The case instead calls for the following: unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior.
C:Only images carrying the expected evidence satisfy the admission policy; arbitrary tags do not bypass the gate. That result could support testing of binary Authorization attestations in CI: Binary Authorization requires digest-specific trust evidence and an enforcement policy, not just an assertion that a build succeeded. The case instead calls for the following: unit tests run quickly and deterministically without side effects while integration tests cover real protocol behavior.
Question 377
A Firestore event handler passes unit tests but fails when serialized document timestamps use an unexpected field type. Before choosing a remediation, which investigation best isolates the specific cause or unmet dependency? Select ONE best answer.
- Inspect environment variables, secret sources, project IDs, and access to production resources from development builds.
- Inspect server tool manifests, caller identity, accessible resources, and validation of tool arguments.
- Inspect image digests, mutable tags, build provenance, and the image reference used by each deployment.
- Inspect API serialization, emulator feature support, test data setup, and the next production-like test boundary.
Explanation
Correct Answer
D:Inspect API serialization, emulator feature support, test data setup, and the next production-like test boundary. Service emulators exercise protocol and data behavior but do not eliminate the need for selective production-like integration checks. A focused follow-up is to add a test that writes a fixture, reads it back, and verifies application decoding with a real-service smoke check where required.
Incorrect Answers
A:Inspect environment variables, secret sources, project IDs, and access to production resources from development builds. Environment configuration and secret injection must be isolated; a dev label on a file does not constrain the credentials it contains. It does not isolate the integration testing with service emulators issue described.
B:Inspect server tool manifests, caller identity, accessible resources, and validation of tool arguments. Context exchange and tool access do not grant inherent authority; MCP integrations require independent tool-side permissions and argument validation. It does not isolate the integration testing with service emulators issue described.
C:Inspect image digests, mutable tags, build provenance, and the image reference used by each deployment. Tags can be moved to new images; a content digest identifies the exact stored container artifact for verification and rollback. It does not isolate the integration testing with service emulators issue described.
Question 378
A Firestore event handler passes unit tests but fails when serialized document timestamps use an unexpected field type. The team is choosing a sustainable solution. Which design best meets the stated requirement without broad unrelated changes? Select ONE best answer.
- Use supported Cloud Code and Skaffold workflows to automate iterative build and deploy with explicit target environments.
- Treat AI-generated code as a reviewable proposal that must satisfy the same tests and security standards as human-written code.
- Use protected branches with mandatory code review and verified CI status before release promotions.
- Run integration tests against suitable emulators plus bounded staging tests for unsupported cloud-specific behavior.
Explanation
Correct Answer
D:Run integration tests against suitable emulators plus bounded staging tests for unsupported cloud-specific behavior. Service emulators exercise protocol and data behavior but do not eliminate the need for selective production-like integration checks. Before rollout, inspect API serialization, emulator feature support, test data setup, and the next production-like test boundary.
Incorrect Answers
A:Use supported Cloud Code and Skaffold workflows to automate iterative build and deploy with explicit target environments. This design addresses Cloud Code and Skaffold inner development loop, where Cloud Code and Skaffold can streamline iterative container development but must be scoped to the correct cluster and configuration profile. It addresses a different dependency from integration testing with service emulators.
B:Treat AI-generated code as a reviewable proposal that must satisfy the same tests and security standards as human-written code. This design addresses Gemini Code Assist generated code verification, where aI coding assistance can accelerate development but generated suggestions do not establish their own correctness or safety. It addresses a different dependency from integration testing with service emulators.
C:Use protected branches with mandatory code review and verified CI status before release promotions. For this case, service emulators exercise protocol and data behavior but do not eliminate the need for selective production-like integration checks. It addresses a different dependency from integration testing with service emulators.
Question 379
A Firestore event handler passes unit tests but fails when serialized document timestamps use an unexpected field type. An approved limited change can be tested in a safe environment. Which implementation action most directly addresses this scenario? Select ONE best answer.
- Enable provenance generation in an approved Cloud Build workflow and verify its source-to-image linkage.
- Set an isolated named configuration and pass the intended project ID in deployment scripts where applicable.
- Add a test that writes a fixture, reads it back, and verifies application decoding with a real-service smoke check where required.
- Review the suggested patch, verify imported methods, and run targeted tests and static analysis before merge.
Explanation
Correct Answer
C:Add a test that writes a fixture, reads it back, and verifies application decoding with a real-service smoke check where required. Service emulators exercise protocol and data behavior but do not eliminate the need for selective production-like integration checks. Validate the change by checking that interface regressions are caught before production without claiming emulators prove every IAM, quota, or availability condition.
Incorrect Answers
A:Enable provenance generation in an approved Cloud Build workflow and verify its source-to-image linkage. This action changes a different concern, SLSA and build provenance evidence. The reported condition is about integration testing with service emulators, not this adjacent change.
B:Set an isolated named configuration and pass the intended project ID in deployment scripts where applicable. This action changes a different concern, google Cloud CLI project and identity context. The reported condition is about integration testing with service emulators, not this adjacent change.
D:Review the suggested patch, verify imported methods, and run targeted tests and static analysis before merge. This action changes a different concern, Gemini Code Assist generated code verification. The reported condition is about integration testing with service emulators, not this adjacent change.
Question 380
A Firestore event handler passes unit tests but fails when serialized document timestamps use an unexpected field type. The team has tried a correction. Which measurable outcome most directly demonstrates that this issue is resolved? Select ONE best answer.
- Only reviewed commits with passing checks reach production and each deployment has a reproducible source reference.
- Equivalent source and locks produce the expected artifact while warm builds improve latency without hidden dependency drift.
- Interface regressions are caught before production without claiming emulators prove every IAM, quota, or availability condition.
- Reviewers can trace an artifact to its build inputs and trusted builder without relying on a mutable filename.
Explanation
Correct Answer
C:Interface regressions are caught before production without claiming emulators prove every IAM, quota, or availability condition. Service emulators exercise protocol and data behavior but do not eliminate the need for selective production-like integration checks. The original diagnosis should have included this step: inspect API serialization, emulator feature support, test data setup, and the next production-like test boundary.
Incorrect Answers
A:Only reviewed commits with passing checks reach production and each deployment has a reproducible source reference. It would not establish the success condition for integration testing with service emulators. Applying it first would leave integration testing with service emulators unresolved.
B:Equivalent source and locks produce the expected artifact while warm builds improve latency without hidden dependency drift. It would not establish the success condition for integration testing with service emulators. Applying it first would leave integration testing with service emulators unresolved.
D:Reviewers can trace an artifact to its build inputs and trusted builder without relying on a mutable filename. It would not establish the success condition for integration testing with service emulators. Applying it first would leave integration testing with service emulators unresolved.