# Free GPCDE practice questions

> 10 free GPCDE practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/google-professional-cloud-devops-engineer/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/google-professional-cloud-devops-engineer/

### Question 1 of 10

A company runs production GKE Standard clusters and must stay on supported versions with minimal disruption. Upgrades must not occur during the Black Friday week, and node upgrades should never take more than one node out of service at a time per pool. What should you configure?

- A. Pin the control plane version with a no-channel configuration and recreate each cluster from scratch with Terraform when a version reaches end of support
- B. Enroll the clusters in the Rapid release channel so upgrades happen early in the year, well before Black Friday, and rely on default upgrade settings
- C. Enroll the clusters in the Stable release channel with maintenance windows, a Black Friday maintenance exclusion, and surge upgrades with maxUnavailable 0
- D. Disable auto-upgrade on all clusters and node pools and upgrade manually once a year after the holiday season using blue-green node pool upgrades

**Answer:** C

**Explanation:** A release channel keeps versions supported, maintenance windows and exclusions control when automatic upgrades happen, and surge settings such as maxSurge 1 with maxUnavailable 0 avoid taking existing nodes out of service before replacements are ready. Disabling auto-upgrade and upgrading yearly risks running unsupported versions. The Rapid channel gets the newest versions with the most change and offers no protection for the holiday week. Recreating clusters at end of support is disruptive and operationally heavy.

### Question 2 of 10

Your organization requires that no Compute Engine VM in any project receives an external IP address, except in a single project that hosts bastion hosts for a legacy vendor. You want the control to be enforced automatically for new projects. What should you do?

- A. Remove the roles/compute.instanceAdmin.v1 role from all developers at the organization level and grant it only to the bastion team on the bastion project
- B. Create a hierarchical firewall policy at the organization node that denies all ingress from 0.0.0.0/0 and add a higher-priority allow rule scoped to the bastion project's VPC
- C. Write a Cloud Asset Inventory feed that publishes VM creation events to Pub/Sub and a Cloud Run function that deletes any external IP assigned outside the bastion project
- D. Enforce the compute.vmExternalIpAccess constraint at the organization node to deny all, and override it on the bastion project to allow only the bastion VMs

**Answer:** D

**Explanation:** The compute.vmExternalIpAccess organization policy constraint prevents external IPs from being assigned and is inherited by every new project, and a project-level policy can allow the specific bastion instances. A hierarchical firewall rule blocks traffic but does not stop external IP assignment. Removing an admin role stops all VM management rather than external IPs specifically. An Asset Inventory feed with a cleanup function is reactive and leaves a window where external IPs exist.

### Question 3 of 10

Developers complain that Cloud Build runs for a large Java monorepo take 25 minutes because Maven downloads dependencies on every build. You want to reduce build time without changing the build tool. What should you do?

- A. Increase the Cloud Build machine type to E2_HIGHCPU_32 so that dependency downloads run with more parallel network threads and compilation also finishes faster
- B. Use an Artifact Registry Maven remote repository as a caching proxy for Maven Central and point the build's settings.xml at it
- C. Split the build into one Cloud Build trigger per Maven module so that each trigger runs in parallel on its own worker
- D. Move the build to a private pool in the same region as the repository so network latency to Maven Central decreases

**Answer:** B

**Explanation:** An Artifact Registry remote repository caches upstream Maven artifacts close to the build workers, so repeated dependency fetches are fast and also more resilient to upstream outages. A larger machine helps CPU-bound compilation, not repeated downloads from the internet. A private pool changes the network location but still fetches everything from Maven Central each run. Splitting triggers per module adds orchestration overhead and each trigger still downloads its dependencies.

### Question 4 of 10

A company wants to release a new checkout flow to 5% of Cloud Run traffic, observe error rates for an hour, and then shift the rest of the traffic, with the ability to return instantly to the previous behavior. Which approach uses built-in Cloud Run functionality with the LEAST operational overhead?

- A. Deploy the new revision with 100% traffic and keep a second region on the old revision as a fallback through DNS failover
- B. Deploy the new revision with 100% traffic and add a feature flag in code that randomly enables the checkout for 5% of requests
- C. Deploy the new version as a separate Cloud Run service and use a global external Application Load Balancer URL map with weighted backends
- D. Deploy the new revision with --no-traffic, then use gcloud run services update-traffic to send 5% to it and later 100%

**Answer:** D

**Explanation:** Cloud Run revisions support traffic splitting natively: deploying with no traffic and then assigning percentages provides a canary with instant rollback by moving traffic back to the old revision. A second service behind a load balancer works but adds configuration overhead. Sending all traffic to the new revision and failing over by DNS exposes every user and rolls back slowly. A random in-code flag requires a code change and a redeploy to adjust or roll back.

### Question 5 of 10

A GKE workload must read secrets from Secret Manager at runtime. Security forbids node service account permissions for workloads and any Kubernetes Secret objects containing the values. What should you implement?

- A. Enable Workload Identity Federation for GKE, grant Secret Accessor to the Kubernetes service account's principal, and use the client library
- B. Store a service account key in a ConfigMap and have the application use it to authenticate to Secret Manager when the pod starts
- C. Grant the node pool's service account the Secret Accessor role and let pods use the metadata server credentials to read the secrets
- D. Sync the secrets into Kubernetes Secret objects with a CronJob every hour and mount them into the application pods as environment variables at container startup

**Answer:** A

**Explanation:** Workload Identity Federation for GKE lets IAM grant permissions directly to a Kubernetes service account principal, so only that workload can read the secret, without node permissions or Kubernetes Secrets. Node service account grants apply to every pod on the node. Syncing into Kubernetes Secrets violates the requirement. A key in a ConfigMap is a long-lived credential stored in plain text.

### Question 6 of 10

A video platform defines a latency SLI for its playback API. Users are frustrated mainly when starting playback takes longer than 400 ms, and the team wants an SLI that is easy to turn into an error budget. Which SLI definition is MOST appropriate?

- A. The maximum latency observed for any playback-start request in each hour, measured at the client
- B. The 99th percentile CPU utilization of the playback backend pods, measured by GKE system metrics
- C. The proportion of valid playback-start requests served in under 400 ms, measured at the load balancer
- D. The average latency of playback-start requests over five-minute windows, measured by each backend instance

**Answer:** C

**Explanation:** A good-events-over-valid-events ratio with a threshold that reflects user pain maps directly to an SLO and error budget, and measuring at the load balancer captures what users experience from the service. Averages hide tail latency and per-instance measurement misses queuing in front of instances. CPU utilization is a cause-oriented resource metric, not a user-facing SLI. A per-hour maximum is dominated by a single outlier and cannot be expressed as a budget.

### Question 7 of 10

A team's service has exhausted its error budget for the current window after two bad releases. According to SRE practice and the team's agreed error budget policy, what should happen next?

- A. Freeze feature releases other than reliability and security fixes until the service is back within its SLO
- B. Lower the SLO target permanently so that the current reliability level becomes the new objective
- C. Continue releasing features but require two reviewers per change, since the error budget only informs dashboards
- D. Raise the SLO target so that the service has more room for failures during the remainder of the window

**Answer:** A

**Explanation:** An error budget policy typically halts feature launches and redirects engineering effort to reliability once the budget is spent, which balances velocity with reliability. Raising the SLO shrinks the budget rather than giving more room. Treating the budget as informational defeats its purpose of governing release velocity. Permanently lowering the SLO because of two bad releases ignores user expectations and should only follow a deliberate review.

### Question 8 of 10

A GKE service writes structured JSON logs. Engineers want to jump from a slow trace in Cloud Trace directly to the log entries written while handling that request. What must the application do?

- A. Write the trace ID and span ID into the logging.googleapis.com/trace and logging.googleapis.com/spanId fields of each structured log entry
- B. Write the trace ID into a custom label named traceId and create a log-based metric that groups entries by that label
- C. Write each log entry to a separate log name that matches the trace ID so that Logs Explorer can filter by log name
- D. Send log entries to Cloud Trace as span events and disable Cloud Logging for the service to avoid duplicate data

**Answer:** A

**Explanation:** When structured logs populate the special trace and spanId fields with the full trace resource name and span, Cloud Logging and Cloud Trace correlate them so engineers can navigate between a trace and its logs. A custom label is not recognized for correlation. One log name per trace explodes the number of logs and is not how correlation works. Replacing logs with span events loses logs needed for other analysis.

### Question 9 of 10

You need an alert when the HTTP 5xx error ratio of a Cloud Run service exceeds 2% for 10 minutes, and the on-call engineers use PagerDuty. What should you configure?

- A. A Cloud Monitoring uptime check against the service URL with a PagerDuty notification channel and a 10-minute check interval
- B. A Cloud Monitoring alerting policy with a ratio condition on request_count filtered by response_code_class, a 10-minute duration, and a PagerDuty notification channel
- C. A dashboard chart of request_count by response code shared with the on-call team and a PagerDuty schedule that reviews it hourly
- D. A log-based counter metric for every request and a Cloud Scheduler job that compares counts and emails PagerDuty's inbound address

**Answer:** B

**Explanation:** An alerting policy can compute the ratio of 5xx requests to all requests from the built-in Cloud Run request_count metric, require it to persist for 10 minutes, and notify through a native PagerDuty channel. A scheduled comparison job is custom and fragile. Uptime checks probe availability from outside and do not measure the error ratio of real traffic. A dashboard reviewed hourly is not alerting.

### Question 10 of 10

A Cloud Run API receives bursts of traffic during the day and almost nothing overnight. The service does no work outside of request handling. Which configuration keeps cost LOWEST while still serving all requests?

- A. Use request-based billing, and set minimum instances to the daytime peak so that no request waits for an instance
- B. Use request-based billing so CPU is allocated only during request processing, and keep minimum instances at zero
- C. Use instance-based billing with concurrency set to 1 so each instance is fully utilized while it is running
- D. Use instance-based billing so CPU is always allocated, and set minimum instances to the daytime peak count

**Answer:** B

**Explanation:** With request-based billing you pay for CPU only while requests are processed, and zero minimum instances lets the service scale to zero overnight. Instance-based billing at peak count pays for idle capacity all night. Keeping peak minimum instances also pays for idle instances. Concurrency 1 increases the number of instances and cost.

Ready for a timed run? Take the free 15-question GPCDE mini exam: https://devopscodelab.com/app/exams/google-professional-cloud-devops-engineer/mini/

DevOpsCode Lab is not affiliated with Google Cloud. GPCDE and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
