Explore / Google Cloud Professional Cloud DevOps Engineer Exam Prep / Practice questions
Google Cloud Professional Cloud DevOps Engineer practice questions
10 questions from the bank behind this course's timed mock. Free to read and to answer, no account needed, and each has its answer and an explanation. They belong to Google Cloud Professional Cloud DevOps Engineer Exam Prep.
Answer them one at a time →Read lesson 1 free
Question 1
A platform team runs dozens of Jenkins pipelines on one self-managed Compute Engine VM, and the VM keeps running out of capacity during release weeks. Their manager has set a hard constraint: the existing Jenkins pipelines must be reused with no rewrite. The goal is to handle the peak load with less VM maintenance. Which option best meets the stated requirement?
- Replace Jenkins with a cron script on a larger VM that runs docker build on a schedule
- Migrate all pipelines to Cloud Build and push images to Artifact Registry
- Run Jenkins on GKE with autoscaling so capacity grows with the build load
- Move the pipelines to Cloud Deploy delivery pipelines and retire Jenkins
Show the answer
Answer: C. Run Jenkins on GKE with autoscaling so capacity grows with the build load
The 'no rewrite' constraint rules out any option that drops Jenkins, so Jenkins on GKE with autoscaling is the best fit: it keeps the pipelines unchanged and handles the peak load. Cloud Build would usually win on least operational overhead, but here it breaks the hard constraint because every pipeline would have to be rewritten.
Question 2
A DevOps engineer runs Terraform in a CI pipeline. A reviewer approves the plan output shown on a pull request, but the apply step runs later and works out a fresh plan, so the changes it makes sometimes differ from what was approved. The team wants the apply step to make exactly the changes the reviewer saw. What should the engineer do?
- Run `terraform validate` before the apply step to confirm the configuration has not changed
- Run `terraform init` again just before the apply step so providers and modules match the review
- Run `terraform plan -out=tfplan` in the review step, then `terraform apply tfplan` in the apply step
- Run `terraform apply -auto-approve` in the apply step so no second prompt is needed
Show the answer
Answer: C. Run `terraform plan -out=tfplan` in the review step, then `terraform apply tfplan` in the apply step
Saving the plan with `-out` and passing that file to `apply` makes Terraform apply exactly the reviewed diff instead of working out a new one. `-auto-approve` only skips the confirmation prompt, and Terraform still plans again, so the gap between review and apply is still there.
Question 3
A platform engineer manages Cloud Workstations for a data team. Developers sometimes delete and recreate their workstations when they switch to a new configuration version, and twice this month someone lost uncommitted work stored in their home directory. The engineer wants home disks to survive when a workstation is deleted, without changing how developers work. What should the engineer change in the workstation configuration?
- Increase --pd-disk-size so the home disk has more room for backups
- Set --pd-reclaim-policy=retain on the workstation configuration
- Move the team to Cloud Shell, which keeps a persistent 5 GB $HOME
- Raise --idle-timeout so workstations are not stopped while developers are away
Show the answer
Answer: B. Set --pd-reclaim-policy=retain on the workstation configuration
The reclaim policy controls what happens to a workstation's persistent home disk when the workstation is deleted. The default is delete, and retain keeps the disk. Raising the idle timeout only changes when a running VM stops. It does nothing to protect the disk when the workstation itself is deleted.
Question 4
A developer is moving a stateless API off GKE and onto Cloud Run. The Cloud Deploy pipeline and its Cloud Run target (project and region) already exist. The release still fails, because the Skaffold configuration was copied from the GKE version of the app. What is the best change to make to the Skaffold setup?
- Keep the GKE manifests and change the target's gke block so its cluster path names the Cloud Run region
- Replace the Cloud Run target with a custom target whose deploy container runs gcloud run deploy
- Point the profile's manifests at a Knative Service YAML file and set the Skaffold deploy section to cloudrun: {}
- Keep the Kubernetes Deployment and Service manifests and set the Skaffold deploy section to kubectl: {}
Show the answer
Answer: C. Point the profile's manifests at a Knative Service YAML file and set the Skaffold deploy section to cloudrun: {}
Cloud Run releases use Knative Service YAML manifests and deploy: cloudrun: {} in Skaffold, while the target itself only needs a location. A custom target could be made to work, but custom targets are meant for destinations Cloud Deploy does not support natively, and Cloud Run is supported natively.
Question 5
A platform engineer is creating a Secret Manager secret for a payments service. Data residency rules require replicas only in europe-west1 and europe-west2, so the secret uses user-managed replication. Compliance also requires customer-managed encryption keys (CMEK). How should the Cloud KMS keys be set up?
- Create one Cloud KMS key in the global location and grant the Secret Manager service agent roles/cloudkms.cryptoKeyEncrypterDecrypter on it
- Create a Cloud KMS key in europe-west1 and another in europe-west2, and grant the Secret Manager service agent roles/cloudkms.cryptoKeyEncrypterDecrypter on both keys
- Create one Cloud KMS key in europe-west1 for both replicas, and grant the Secret Manager service agent roles/cloudkms.admin on it
- Create one Cloud KMS key in europe-west2 for both replicas, and grant your own user account roles/cloudkms.cryptoKeyEncrypterDecrypter on it
Show the answer
Answer: B. Create a Cloud KMS key in europe-west1 and another in europe-west2, and grant the Secret Manager service agent roles/cloudkms.cryptoKeyEncrypterDecrypter on both keys
With user-managed replication, each replica needs a CMEK key in its own region, and the service agent needs the Encrypter/Decrypter role on every key. A global key is only right for automatically replicated secrets, so it doesn't fit this replication policy.
Question 6
You are an SRE for a checkout API that handles about 10 million requests a month. The customer SLA promises 99.9% non-5xx requests per calendar month, with service credits if that target is missed. Your team's internal SLO is 99.95% over the same period. Halfway through the month, Cloud Monitoring shows 7,000 failed (5xx) requests. What is the best next step?
- Treat the SLO as missed while the SLA is still met: pause risky releases and put reliability work first so you stay under the SLA's 10,000-failure limit.
- Lower the internal SLO to 99.9% to match the SLA, so the team is no longer out of compliance.
- Start issuing service credits to customers now, because the internal SLO has been breached.
- Take no action, because the 7,000 failures are below the SLA limit of 10,000 and no service credits are owed.
Show the answer
Answer: A. Treat the SLO as missed while the SLA is still met: pause risky releases and put reliability work first so you stay under the SLA's 10,000-failure limit.
At 10 million requests, the 99.95% SLO allows 5,000 failures and the 99.9% SLA allows 10,000. You have passed the SLO but not the SLA, which is exactly the warning the stricter SLO exists to give, so you act now, before you owe credits. Doing nothing wastes that warning, and credits are owed only when the SLA itself is breached.
Question 7
An SRE runs an I/O-bound API on a regional managed instance group (MIG) behind an external Application Load Balancer. The backend service uses RATE balancing mode with a max rate per instance that matches what each VM can serve. The MIG autoscales on CPU with a target of 0.6. During peaks, latency climbs and the load balancer sends traffic to other backends, but average CPU stays near 30%, so the group never grows. What should the SRE change so the MIG scales on the real constraint?
- Lower --target-cpu-utilization to 0.3 so the CPU signal triggers sooner
- Increase --cool-down-period so new VMs' metrics are ignored for longer
- Enable predictive autoscaling with --cpu-utilization-predictive-method=optimize-availability
- Autoscale on load-balancing serving capacity with --target-load-balancing-utilization=0.8
Show the answer
Answer: D. Autoscale on load-balancing serving capacity with --target-load-balancing-utilization=0.8
Here the limit is the serving capacity set on the backend service (requests per instance), not CPU, so load-balancing utilization makes the MIG scale on the signal that actually saturates. Lowering the CPU target or turning on CPU-based predictive autoscaling still ties scaling to CPU, which doesn't track this I/O-bound load.
Question 8
You are the SRE for a GKE Standard cluster that uses Managed Service for Prometheus with managed collection. Finance reports that the Prometheus line on the monthly bill has tripled since several teams added exporters. You must cut the cost without losing the metrics that back your SLOs. Which TWO actions directly lower the bill? (Select TWO.)
More than one answer is right.
- Increase the scrape interval on the high-volume PodMonitoring endpoints that are not used for SLOs, for example from 10s to 60s
- Reduce Monarch retention from 24 months to 3 months so that less data is stored
- Add a filter to the OperatorConfig resource in the gmp-public namespace so that only the metrics you need are exported
- Replace managed collection with self-deployed collection so that samples are no longer billed
- Enable --export.compression=gzip on the collectors to reduce ingestion charges
Show the answer
Answers: A. Increase the scrape interval on the high-volume PodMonitoring endpoints that are not used for SLOs, for example from 10s to 60s; C. Add a filter to the OperatorConfig resource in the gmp-public namespace so that only the metrics you need are exported
You pay mainly per sample ingested, so the levers that lower the bill are fewer scrapes (a longer interval) and fewer exported series (an OperatorConfig filter in gmp-public). The 24-month retention comes at no extra cost, so shortening it saves nothing. Gzip compression cuts data transfer fees, not the number of samples you are billed for.
Question 9
You are the SRE for a Cloud Run checkout service. Product owners say a few customers get very slow responses during the evening peak, but your Metrics Explorer chart of the latency distribution metric run.googleapis.com/request_latencies looks flat. It uses ALIGN_MEAN with a 1-minute alignment period. You need the chart to show the slow tail without changing the metric. What should you change?
- Change the aligner to ALIGN_PERCENTILE_99 so that each alignment period shows the 99th-percentile latency
- Keep ALIGN_MEAN and add a sum reducer grouped by revision_name so each revision gets its own line
- Keep ALIGN_MEAN and shorten the alignment period to 10 seconds so short spikes are not averaged away
- Change the aligner to ALIGN_RATE so the chart shows how fast latency is changing per second
Show the answer
Answer: A. Change the aligner to ALIGN_PERCENTILE_99 so that each alignment period shows the 99th-percentile latency
Latency distributions should use a percentile aligner. A mean hides the slow tail, and ALIGN_PERCENTILE_99 shows it directly. Shortening the alignment period does not work: the period must be at least 60 seconds, and a mean of any window still hides the tail. ALIGN_RATE is meant for counters, not distributions.
Question 10
You are a DevOps engineer investigating high CPU usage in a Go service. In the Cloud Profiler CPU-time flame graph, processOrder takes up 70% of the width. Two children sit directly on top of it and cover almost all of that width: validate (30%) and serialize (38%). Above serialize, only a few narrow frames are stacked, leaving about 30% of the graph's width as empty space directly above it. A separate stack, computeTax, is 10% wide and is fully covered by its children. You want to start where an optimisation will save the most CPU. Which function should you examine first?
- processOrder, because it is the widest frame above main
- serialize, because it has the most self time
- validate, because the deepest stack in a flame graph always marks the costliest code path
- computeTax, because a frame fully covered by its children is where the hot spot is
Show the answer
Answer: B. serialize, because it has the most self time
Empty space directly above a frame is that function's self time, so serialize, with about 30% of CPU spent in its own code, is the real hot spot. processOrder is wide only because it includes its children's time. It is almost fully covered, so it is just passing work along.
The full timed mock
50 questions in 120 minutes, with a pass mark of 70%. Each paper is drawn from a bank of questions written for the mock alone, and these 10 are left out of it. Full access opens it, with every level of the course.
LevelUpWith is independent of the organisation that sets this exam. These questions were written for this course; they are not taken from the exam.