All Google Cloud exams

Free Professional Cloud DevOps Engineer practice test: 30 questions with answers

30 original questions for Professional Cloud DevOps Engineer, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.

Free questions
30
Full bank
112 questions
Real exam
120 min

Professional Cloud DevOps Engineer exam guide: topics, cost and format

All 30 Professional Cloud DevOps Engineer questions with answers

The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.

Build and implement CI/CD pipelines (6 questions)

  1. Question 1

    A Cloud Build pipeline must run unit tests before deploying, and the deploy step needs a database password. The password must not appear in the repository or in trigger settings. Which configuration is BEST?

    1. AStore the password as a plaintext substitution variable in the trigger definition and mask the value in build logs
    2. BWrite the password into a Dockerfile ENV instruction in the test step and build the image there before deploying
    3. CStore the password in Secret Manager and reference it through availableSecrets in cloudbuild.yaml
    4. DCommit an encrypted .env file and decrypt it in the deploy step with a passphrase that the whole team shares
    Show answer and explanation
    Correct answer: C

    Cloud Build can read secrets from Secret Manager at build time when they are declared in availableSecrets, and the build service account needs the Secret Accessor role on that secret. Trigger substitutions, image layers and committed files all expose the value to anyone who can read the repository, logs or images.

  2. Question 2

    A GKE cluster must run only container images that were built by the company's approved Cloud Build pipeline and carry a passing attestation. Which service enforces this at deploy time?

    1. AVPC Service Controls perimeter placed around the Artifact Registry repository that stores the images
    2. BBinary Authorization with an attestor that verifies the build attestation before admission
    3. CCloud Armor security policy attached to the ingress load balancer that fronts the cluster's services
    4. DIdentity-Aware Proxy configured in front of the Kubernetes API server for all administrative access
    Show answer and explanation
    Correct answer: B

    Binary Authorization evaluates signed attestations for images at deploy time and blocks any image that does not satisfy the policy. Cloud Armor filters network traffic, VPC Service Controls limits data movement across perimeters, and IAP controls user access, so none of them check image provenance.

  3. Question 3

    A team uses Cloud Deploy to promote a release from a development target to a staging target and then to production. Which Cloud Deploy resource defines the ordered targets for that promotion?

    1. ADelivery pipeline that lists the ordered targets through which a release is promoted
    2. BCloud Build trigger that starts a build whenever a commit lands on the main branch
    3. CArtifact Registry repository that stores the container images being promoted between targets
    4. DSkaffold configuration that describes how images are built and rendered for each environment
    Show answer and explanation
    Correct answer: A

    A Cloud Deploy delivery pipeline lists the ordered targets, and releases are promoted through them in sequence. Skaffold describes how to build and render artifacts, a Cloud Build trigger starts builds, and Artifact Registry stores images without defining promotion order.

  4. Question 4

    Several engineers run Terraform against the same production infrastructure. Which backend configuration prevents two runs from corrupting the shared state?

    1. AA state blob stored in a Cloud SQL table with no separate locking table configured for concurrent applies
    2. BAn object in a Cloud Storage bucket with versioning disabled, so that each upload simply replaces the previous state
    3. CA local terraform.tfstate file on each engineer's laptop, synced through a shared git repository
    4. DA Cloud Storage bucket backend, which supports state locking, with object versioning enabled for recovery
    Show answer and explanation
    Correct answer: D

    The Cloud Storage backend supports state locking, so concurrent applies wait instead of overwriting each other, and versioning allows earlier state to be recovered. Local state synced through git cannot lock, and a bucket with versioning off simply lets the last writer win.

  5. Question 5

    Which test stage can validate a Terraform change before any cloud resource is created or changed?

    1. ALoad test run against the production load balancer during peak business hours to confirm capacity
    2. BChaos experiment that deletes random Pods in the production cluster to confirm self-healing
    3. CRunning terraform plan and evaluating the plan JSON with a policy validator such as OPA rules
    4. DPenetration test run against the staging Cloud SQL instance to confirm network exposure
    Show answer and explanation
    Correct answer: C

    Evaluating the plan output with policy checks catches disallowed settings before apply, and it is a read-only gate. Load tests, chaos experiments and penetration tests all act on running systems, which is the wrong place to discover configuration mistakes.

  6. Question 6

    Which two actions reduce the risk that a faulty build reaches production users? (Choose two.)

    1. APin base images to a specific digest and scan the built image for known vulnerabilities before promotion
    2. BUse the latest tag for every image so that the newest fixes are always picked up automatically
    3. CSkip unit tests for hotfix branches so that the fix ships to production as quickly as possible
    4. DRun the build as the default Compute Engine service account with the Editor role on the project
    5. EStore long-lived service account JSON keys in the repository so the build can authenticate on its own
    Show answer and explanation
    Correct answer: A, B

    Digest pinning makes builds reproducible and scanning before promotion blocks known-bad images, so both reduce risk. The other options remove tests, use mutable tags, or give builds excessive and long-lived credentials, which all increase risk.

Implement observability practices and troubleshoot issues (6 questions)

  1. Question 7

    A team needs an alert when the p95 request latency of a Cloud Run service stays above 500 ms for 5 minutes. Which Cloud Monitoring configuration does this?

    1. AAn alerting policy on the request latency distribution metric, with a 95th percentile aligner and a 5-minute duration condition
    2. BAn uptime check that fetches the service URL every minute and alerts on a 500 ms response timeout
    3. CA log-based metric that counts requests whose log entries record a latency above 500 ms
    4. DA notification channel that sends an email to the on-call group whenever a deployment completes successfully
    Show answer and explanation
    Correct answer: A

    An alerting policy on the request latency distribution with a percentile aligner and a duration condition expresses exactly this rule. A log-based metric or an uptime check measures different things, and a notification channel only delivers alerts after a policy has decided to fire.

  2. Question 8

    Audit requirements state that logs must be kept for 400 days and that a copy must be available in BigQuery for analysis. Which configuration meets both requirements?

    1. AIncrease the default retention in the project settings to 400 days and rely on the audit team to query Logs Explorer
    2. BExport logs to a Pub/Sub topic that has a 7-day message retention period for downstream consumers
    3. CA log sink to a BigQuery dataset, plus a log bucket whose retention period is set to 400 days
    4. DExport logs to a persistent disk with weekly snapshots kept for 400 days in a separate project
    Show answer and explanation
    Correct answer: C

    Retention is controlled by the log bucket, and a log sink exports a copy to BigQuery for analysis, so both pieces are needed. Pub/Sub is a delivery channel with short message retention, and persistent disk snapshots are not a logging destination.

  3. Question 9

    An engineer must see how long each downstream call takes within one slow user request that crosses three microservices. Which tool shows this breakdown?

    1. ANetwork Intelligence Center
    2. BError Reporting
    3. CCloud Profiler
    4. DCloud Trace
    Show answer and explanation
    Correct answer: D

    Cloud Trace records spans for each hop of a request, so the per-service latency breakdown is visible in one view. Cloud Profiler shows code-level CPU and memory use, Error Reporting groups exceptions, and Network Intelligence Center analyzes network topology.

  4. Question 10

    Over several weeks a service's CPU cost has risen. The team wants to see which functions consume the most CPU in production, sampled continuously with minimal overhead. Which tool should they use?

    1. ACloud Trace
    2. BCloud Profiler
    3. CCloud Monitoring uptime checks
    4. DCloud Logging Logs Explorer
    Show answer and explanation
    Correct answer: B

    Cloud Profiler collects low-overhead sampling profiles from running production code and shows where CPU time is spent by function. Cloud Trace shows request latency across services rather than code hot spots.

  5. Question 11

    After a rollout, several GKE Pods remain in Pending with an event reporting insufficient CPU. Which check best diagnoses the cause?

    1. ACompare the Pod CPU requests with allocatable CPU on the nodes, and check whether the node pool autoscaler has reached its maximum node count
    2. BIncrease the liveness probe initial delay so that the Pods have more time to finish starting before restarts
    3. CDelete the Service object and recreate it so that the scheduler assigns the Pods to new nodes
    4. DRotate the control plane certificates, because scheduling depends on a valid API server credential
    Show answer and explanation
    Correct answer: A

    A Pending Pod with an insufficient CPU event means no node has enough allocatable CPU for its request, so the request sizes and the node pool autoscaler limits are the first things to check. Probes run only after scheduling, and recreating a Service does not change resource fit.

  6. Question 12

    A planned maintenance window will trigger Cloud Monitoring alerts, and on-call engineers should not be paged during it. Which approach suppresses those notifications for the window while keeping the policies in place?

    1. ADelete the affected alerting policies before the window and recreate them afterward
    2. BSet each notification channel to a shared mailbox that nobody reads during the window
    3. CChange every alert condition duration to zero so that alerts never open an incident
    4. DCreate a snooze that covers the affected alerting policies for the duration of the maintenance period
    Show answer and explanation
    Correct answer: D

    A snooze suppresses notifications for selected policies for a defined period and leaves the configuration intact, so monitoring resumes automatically afterward. Deleting and recreating policies loses history and risks forgetting them, while changing channels or durations alters the alerts themselves.

Apply SRE practices (6 questions)

  1. Question 13

    A checkout API has a 99.9% availability SLO over 28 days. Most of its error budget was spent in the first week. According to SRE practice, what should the team do first?

    1. AAdd client-side retries so that failed requests are no longer counted as errors in the SLI
    2. BFreeze non-urgent production changes and direct engineers to reliability fixes until the budget recovers
    3. CShorten the SLO window to 7 days so that the early failures roll out of the measurement
    4. DRaise the SLO to 99.95% so that the budget looks healthier on the dashboard
    Show answer and explanation
    Correct answer: B

    An exhausted error budget is the trigger defined by the error budget policy to slow risky changes and spend effort on reliability. Changing the SLO target, its window, or how failures are counted only hides the problem and breaks the agreement with the business.

  2. Question 14

    Which SLI best measures the user experience of a request-driven API?

    1. ARatio of requests returning a non-error response within a latency threshold
    2. BCPU utilization averaged across all instances in the managed instance group behind the load balancer
    3. CCount of Pods restarted per day in the GKE cluster that hosts the API workloads
    4. DAverage disk IOPS on the persistent disks attached to the backend VM instances
    Show answer and explanation
    Correct answer: A

    A good SLI is a ratio of good events to valid events, and for an API the good events are successful responses returned within a latency bound. CPU, restart counts and disk IOPS are infrastructure signals that may correlate with user pain but do not describe it directly.

  3. Question 15

    After a multi-hour outage, the team wants the postmortem to lead to fewer repeat incidents. Which content is most useful?

    1. AA conclusion that the outage was caused by a third-party provider failure, with no further analysis of the system
    2. BA decision to add more on-call engineers to the rotation without reviewing how the failure path was reached
    3. CA timeline, contributing factors, detection gaps, and owned action items with due dates
    4. DA record naming the engineer whose change triggered the outage so that accountability is clear to leadership
    Show answer and explanation
    Correct answer: C

    A blameless postmortem captures how the system failed and tracks concrete, owned follow-up work that prevents recurrence. Attributing the failure to one engineer or to a vendor, or simply adding staff, leaves the conditions that allowed the failure in place.

  4. Question 16

    Which task is best classified as toil under SRE guidance?

    1. AWriting a design document that compares two options for the next database schema migration
    2. BDesigning a canary analysis pipeline that will automatically halt rollouts when error rates rise
    3. CReviewing a pull request that changes the threshold of an existing alerting policy for the API
    4. DManually restarting a service each time a known memory leak triggers a page, with no automation planned or scheduled
    Show answer and explanation
    Correct answer: D

    Toil is manual, repetitive, automatable operational work that grows with service size and produces no lasting improvement. The manual restart fits that definition, while the other tasks create engineering value or reduce future operational work.

  5. Question 17

    Which alerting strategy follows SRE guidance for a user-facing API?

    1. APage when the replication lag of a Cloud SQL read replica exceeds 10 seconds, regardless of user-facing impact
    2. BPage when the burn rate of the availability SLO over a short window would exhaust the error budget soon
    3. CPage on every ERROR-level log line written by the application to Cloud Logging during production hours
    4. DPage whenever any Pod's CPU usage exceeds 80 percent for one minute on any node in the cluster
    Show answer and explanation
    Correct answer: B

    Burn-rate alerts tie paging to consumption of the user-facing error budget, so they page for real impact and not for noise. CPU, individual error lines and replica lag are cause-level signals that can fire constantly without any effect on users.

  6. Question 18

    A team must release a new Cloud Run revision with minimal user risk and a quick way to back out if errors increase. Which approach is best?

    1. ADeploy the new revision and send 100 percent of traffic to it immediately, then rely on users to report problems
    2. BDeploy the new revision with 5 percent of traffic, watch error rate and latency, then shift traffic in steps or roll back
    3. CStop the current revision, start the new one, and update DNS at midnight without any monitoring in place
    4. DDeploy the new revision to a second project and copy traffic across manually after a single smoke test
    Show answer and explanation
    Correct answer: B

    Gradual traffic splitting between revisions limits the blast radius, and watching error rate and latency lets the team stop or roll back quickly. Sending all traffic at once or relying on user reports removes that safety net entirely.

Optimize performance and cost (6 questions)

  1. Question 19

    A nightly batch job on Compute Engine can tolerate interruption and checkpoints its progress. Which purchase option reduces the cost of that workload the most?

    1. AReserved standard persistent disks attached to on-demand machines for the batch volume
    2. BCommitted use discounts on a three-year commitment for the batch machine family
    3. CSpot VMs with checkpointing and automatic restart after preemption
    4. DOn-demand VMs with the sustained use discount assumed to apply every month
    Show answer and explanation
    Correct answer: C

    Spot VMs offer the deepest discount and suit interruptible work when the job can resume from a checkpoint. Committed use discounts reward steady baseline usage, which a nightly job does not provide, and disk reservations do not reduce compute cost.

  2. Question 20

    A Cloud Run service shows slow first responses after idle periods because of cold starts. Which change addresses this with the smallest configuration change?

    1. ASet minimum instances to 1 so that one warm instance stays available between requests
    2. BRaise the maximum instances to 1000 so that more instances can start in parallel during traffic bursts
    3. CMove the workload to Cloud Functions first generation running the same runtime version as before
    4. DIncrease the request timeout to 900 seconds so that slow starts do not fail the caller
    Show answer and explanation
    Correct answer: A

    Minimum instances keeps a warm instance ready, which removes most cold-start latency for the first requests after idle time. Raising the maximum does not help a single cold request, and changing platform or timeout does not change start-up behavior.

  3. Question 21

    Which two tools or purchase options reduce Google Cloud compute cost without changing application code? (Choose two.)

    1. ACommitted use discounts for a steady baseline of predictable usage
    2. BActive Assist VM rightsizing recommendations applied to over-provisioned instances
    3. CCloud Trace span sampling that lowers the number of traces stored each day
    4. DCloud Armor adaptive protection rules tuned for lower request volume
    5. ECloud Identity audit logs exported to a cheaper storage class for retention
    Show answer and explanation
    Correct answer: A, B

    Committed use discounts lower the price of steady usage and rightsizing shrinks over-provisioned machines, and neither requires code changes. Trace sampling, Cloud Armor and identity audit logs do not reduce the compute bill for the workload.

  4. Question 22

    A team wants a notification when monthly spend for a project reaches 80 percent of its budget. Which configuration provides this?

    1. AAn organization policy that sets a hard spending cap on the project's billable resources
    2. BA Cloud Monitoring dashboard that displays the current month's spend for the project as a gauge
    3. CA Cloud Billing budget with an 80 percent threshold rule and notifications
    4. DA Cloud Scheduler job that runs a BigQuery query every hour and writes the result to a text file
    Show answer and explanation
    Correct answer: C

    Cloud Billing budgets support threshold rules that send notifications, and the budget can publish to Pub/Sub for automation. A dashboard does not notify anyone, and organization policies cannot cap spending in the way the scenario describes.

  5. Question 23

    Network egress charges for a service rose sharply because a consumer in one region pulls large datasets from a bucket in another region. What is the most effective fix?

    1. AMove the consumer into the same region as the bucket or cache data regionally
    2. BEnable more detailed VPC flow logs on both subnets so that the traffic pattern can be analyzed later
    3. CAdd more consumer instances so that each one downloads the data faster and the job finishes sooner
    4. DDisable Cloud CDN for the bucket's static assets so that requests reach the origin directly again
    Show answer and explanation
    Correct answer: A

    Cross-region transfer is billed as egress, so keeping the reader near the data or caching locally removes most of that cost. Flow logs, more instances and disabling a CDN either add cost or increase origin traffic.

  6. Question 24

    Finance wants to see spend split by team for every service. Which setup makes this possible with the least manual work?

    1. AEnable Cloud Billing export to BigQuery and group by the team label
    2. BRename each project so that its name includes the owning team, then read the console billing page
    3. CCreate a separate folder for every team label value and move each project into the matching folder
    4. DApply labels only to Cloud Storage buckets, since storage is where most of the team spend occurs
    Show answer and explanation
    Correct answer: A

    Billing export to BigQuery keeps daily line-item detail, including resource labels, so spend can be grouped by team automatically. Renaming projects and moving them into folders does not allocate cost, and labeling only storage ignores the rest of the spend.

Bootstrap and maintain a Google Cloud organization (6 questions)

  1. Question 25

    A security team must stop anyone in any project under the organization from creating Compute Engine resources outside europe-west1 and europe-west4, including projects created later. Which approach meets this with the least ongoing administration?

    1. AEnable Cloud Asset Inventory feeds that alert the security team when resources appear in other regions
    2. BCreate a VPC Service Controls perimeter around every project and restrict the Compute Engine API inside it
    3. CGrant each project team the Compute Viewer role and review new resources in Cloud Logging every week
    4. DSet the gcp.resourceLocations constraint at the organization node, allowing only the two regions
    Show answer and explanation
    Correct answer: D

    The gcp.resourceLocations constraint is enforced at the organization node, so it covers existing and future projects without per-project work. VPC Service Controls limits data movement across perimeters rather than resource placement, and Asset Inventory only reports violations after they happen.

  2. Question 26

    A release engineer must deploy new revisions of a Cloud Run service in a production project but must not be able to change the service's IAM policy. Which predefined role should be granted on the project?

    1. Aroles/run.admin
    2. Broles/run.invoker
    3. Croles/run.developer
    4. Droles/editor
    Show answer and explanation
    Correct answer: C

    roles/run.developer allows creating and updating services and revisions without the permission to set IAM policies. roles/run.admin does include IAM management for Cloud Run resources, and roles/editor grants much broader write access across the whole project than the scenario allows.

  3. Question 27

    Several business units must use one centrally managed VPC network, while each unit keeps its own project for billing and IAM. Which networking design fits this requirement?

    1. AVPC Network Peering between the default networks that each unit project creates automatically
    2. BShared VPC with the network in a host project and each unit project attached as a service project
    3. CCloud VPN tunnels from every unit project to a central connectivity project
    4. DA single project with all unit teams granted the Editor role on it
    Show answer and explanation
    Correct answer: B

    Shared VPC lets a host project own the network and subnets while service projects consume them, keeping separate billing and IAM boundaries. Peering links separate networks that each project still owns, and Cloud VPN is for hybrid connectivity rather than sharing one project-level network.

  4. Question 28

    Which two practices help bootstrap a Google Cloud organization securely? (Choose two.)

    1. ACreate a folder hierarchy by environment or business unit, and assign IAM roles at the folder level where possible
    2. BGrant the Owner role on the organization to every engineer so that nobody is blocked by a missing permission
    3. CPlace all workloads in one shared project so that billing is simpler to read in the cost reports
    4. DAssign billing administration to a dedicated group that is separate from the project owners
    5. EDisable Admin Activity audit logs in each project to reduce the cost of logging
    Show answer and explanation
    Correct answer: A, D

    A folder hierarchy lets policy and IAM be inherited by environment, and separating billing administration from project owners limits who can change spend. Broad Owner grants, a single shared project and disabling Admin Activity logs each weaken access control or auditability.

  5. Question 29

    A GitHub Actions workflow must deploy to Google Cloud. Security forbids long-lived service account keys stored as repository secrets. Which approach meets this requirement?

    1. AGenerate a JSON key for a deployer service account and store it as an encrypted repository secret that is rotated every 90 days
    2. BUse the default Compute Engine service account of a self-hosted runner VM and grant it the Owner role on the project
    3. CWorkload Identity Federation that trusts the GitHub OIDC issuer and maps only this repository to a deployer service account
    4. DStore a user's OAuth refresh token in the workflow and rotate it manually once a year through the console
    Show answer and explanation
    Correct answer: C

    Workload Identity Federation exchanges the short-lived GitHub OIDC token for Google credentials, so no key is stored, and an attribute condition can restrict the mapping to one repository. A stored JSON key, even if rotated, is still a long-lived secret, and the default runner identity with Owner grants far too much.

  6. Question 30

    Developers must be able to read Cloud Logging entries in a production project only during business hours on weekdays. Which IAM feature enforces this without extra automation?

    1. AA Cloud Scheduler job that adds and removes the logging role binding each morning and evening
    2. BA custom role containing logging.logEntries.list with no time restriction, reviewed quarterly
    3. CA VPC Service Controls access level that allows requests only from the corporate IP ranges
    4. DAn IAM Conditions expression on the role binding that checks request time and day of the week
    Show answer and explanation
    Correct answer: D

    IAM Conditions can restrict a role binding by request time, so access is granted only inside the defined window and expires automatically outside it. Scheduler-driven binding changes depend on a job succeeding, and VPC Service Controls access levels filter by network origin rather than time.