Courseiva

CCNA Ensuring Successful Operation of a Cloud Solution Questions

74 questions · Ensuring Successful Operation of a Cloud Solution · All types, answers revealed

1
Multi-Selectmedium

You want to create a log-based metric to count errors from your application logs. Which TWO resources are required? (Select 2)

Select 2 answers
A.A filter that matches the error log entries
B.An alerting policy
C.A metric descriptor (e.g., name, type, label)
D.A log sink
E.A notification channel
AnswersA, C

In Cloud Logging, a logs-based metric is created by defining a filter that selects which log entries increment the metric's counter. This filter is the heart of the metric because it evaluates each incoming log entry against conditions such as severity >= ERROR or a text payload match. Without it, the metric has no way to distinguish error logs from other entries, so the filter directly determines the metric's value and is therefore required.

Why this answer

You need a filter to match error logs and a metric descriptor that defines the metric type.

2
MCQmedium

You have updated a deployment in GKE, but the new pods are crashing. You want to revert to the previous working version. What should you do?

A.kubectl rollout status deployment/my-app
B.kubectl rollout undo deployment/my-app
C.kubectl scale deployment/my-app --replicas=0
D.kubectl delete deployment/my-app and recreate
AnswerB

This command reverts the Deployment to the previous revision by rolling back to the last good ReplicaSet. The Deployment controller will scale down the current ReplicaSet and scale up the old one, restoring the previous container image and configuration. This is the correct, built-in way to undo a bad deployment while maintaining availability.

Why this answer

kubectl rollout undo reverts to the previous revision.

3
MCQeasy

You are using Cloud Run and want to split traffic so that 10% of requests go to revision v2 and 90% go to revision v1. Which command should you use?

A.gcloud run deploy --image my-image --traffic v1=90,v2=10
B.gcloud run services update --traffic v1=90,v2=10
C.gcloud run revisions update v2 --traffic 10
D.gcloud run services update-traffic --to-revisions v1=90,v2=10
AnswerD

This is the correct command for splitting traffic between already deployed revisions: `gcloud run services update-traffic` with `--to-revisions` takes a comma-separated list of `revision=percentage` pairs (v1=90,v2=10) and applies the routing immediately. The specified revisions must exist and the percentages must total 100. It does not create a new revision, so it is the appropriate operation after v1 and v2 have both been deployed.

Why this answer

gcloud run services update-traffic allows traffic splitting between revisions.

4
Multi-Selectmedium

An engineer needs to create a Cloud Monitoring dashboard that displays CPU utilization for all Compute Engine instances in a project. Which TWO steps are required? (Choose 2)

Select 2 answers
A.Create an uptime check
B.Add the chart to a dashboard
C.Create a chart using Metric Explorer
D.Create a log-based metric
E.Set up a notification channel
AnswersB, C

After you generate a chart in Metric Explorer, adding it to a dashboard persists the visualization as a widget in a chosen layout, making it visible to the team and available in the Monitoring UI. This is the final, required step to actually place the metric on the dashboard; without it, the chart exists only in the temporary Metric Explorer session and will be lost when you navigate away.

Why this answer

First, use Metric Explorer to create a chart with the CPU utilization metric. Then, add that chart to a dashboard. Dashboards can have charts from Metric Explorer.

You do not need to create an alert or export logs.

5
MCQhard

You have a Cloud Run service that experiences intermittent high latency. You want to analyze the latency of specific request paths to identify bottlenecks. You enable Cloud Trace and instrument your application with OpenTelemetry. Which tool or feature should you use to view a waterfall diagram of latencies across services for a single request?

A.Error Reporting
B.Cloud Trace Trace List and Trace Details
C.Cloud Monitoring Metrics Explorer
D.Cloud Logging Logs Explorer
AnswerB

Cloud Trace Trace List and Trace Details is the correct service because the Trace List displays each sampled request as a row with its overall latency, while Trace Details opens a waterfall chart that breaks the request into individual spans. In a Cloud Run service, this shows time spent in container startup, internal logic, and downstream calls, making it possible to pinpoint exactly which span causes an intermittent slowdown. The per-request, span-level granularity directly matches the need to diagnose variable performance.

Why this answer

Cloud Trace provides distributed tracing capabilities, including waterfall diagrams that show the latency of each span in a request. Cloud Logging shows logs, not trace details. Error Reporting aggregates errors.

Metrics Explorer shows aggregated metrics, not per-request traces.

6
MCQeasy

You have a Compute Engine instance that is running a CPU-intensive workload. After monitoring, you realize the machine type needs to be upgraded to a larger CPU. What is the correct sequence to change the machine type?

A.Stop the instance, run gcloud compute instances set-machine-type, then start the instance
B.Run gcloud compute instances set-machine-type while the instance is running
C.Delete the instance and create a new one with the desired machine type
D.Use gcloud compute instances update to change the machine type
AnswerA

The correct sequence is to first stop the instance with `gcloud compute instances stop INSTANCE_NAME`, then run `gcloud compute instances set-machine-type INSTANCE_NAME --machine-type MACHINE_TYPE` while the instance is in the TERMINATED state, and finally start it again with `gcloud compute instances start INSTANCE_NAME`. This preserves the instance's boot disk, persistent disks, static IP, metadata, and other configuration, and is the standard non-destructive way to resize a VM.

Why this answer

Changing the machine type requires stopping the instance, then using gcloud compute instances set-machine-type, and finally starting the instance.

7
MCQeasy

A developer needs to query BigQuery using the bq command-line tool with standard SQL. Which flag should they include?

A.--format
B.--use_legacy_sql=false
C.--project_id
D.--sync
AnswerB

`--use_legacy_sql=false` is the required flag because the `bq` command-line tool historically defaults to legacy SQL when running queries. Legacy SQL uses a different syntax and operates differently from standard GoogleSQL (e.g., unique handling of JOINs and functions). Passing `false` explicitly switches the parser to standard SQL, allowing the developer's query to run without rewriting it into legacy dialect.

Why this answer

The '--use_legacy_sql=false' flag enables standard SQL. By default, bq uses legacy SQL. '--format' controls output format, not SQL dialect. '--project_id' specifies project. '--sync' is not a valid bq flag.

8
MCQhard

You need to collect and analyze latency traces for a microservices application running on GKE. You want to identify which services are contributing to overall latency. Which Google Cloud service should you enable and use?

A.Cloud Logging
B.Cloud Profiler
C.Cloud Monitoring
D.Cloud Trace
AnswerD

Cloud Trace is the Google Cloud service specifically designed for distributed tracing: it captures spans from instrumented applications or via OpenTelemetry, groups them into traces for each request, and renders a waterfall view showing where time is spent across microservices. It supports latency distribution analysis, allows comparison of recent traces, and can identify bottleneck services and anomalously slow requests. Thus it directly answers the need to collect and analyze latency traces.

Why this answer

Cloud Trace is a distributed tracing service that collects latency data from applications and provides tools to analyze performance bottlenecks.

9
MCQhard

You are deploying a GKE cluster with node autoscaling enabled. The cluster runs batch jobs that are sensitive to startup latency. You notice that during scale-up, new nodes take several minutes to become ready. Which action can reduce the time it takes for new nodes to join the cluster?

A.Increase the initial node pool size
B.Set the --max-nodes-per-pool flag to a higher value
C.Use a custom image with pre-installed dependencies
D.Enable cluster autoscaler with --enable-autorepair
AnswerC

Using a custom image with pre-installed dependencies is the correct approach because it directly reduces node initialization time. A custom image can bake in the container runtime, required OS packages, and even pre-cached application container images, avoiding the typical runtime download and configuration steps when a new node is added. When the cluster autoscaler triggers a scale-out, these nodes become schedulable faster, so pending pods are scheduled more quickly.

Why this answer

Using a custom image with pre-installed dependencies reduces the time needed for node initialization because the image already contains the required software, avoiding downloads during startup. This is especially beneficial for batch jobs.

10
MCQmedium

Your BigQuery query is taking longer than expected. You want to estimate the query cost before running it and get a preview of how many bytes will be processed. Which bq command should you use?

A.bq show --format=prettyjson mydataset.mytable
B.bq ls --format=prettyjson mydataset
C.bq query --use_legacy_sql=false --dry_run 'SELECT ...'
D.bq query --use_legacy_sql=false --batch 'SELECT ...'
AnswerC

bq query --use_legacy_sql=false --dry_run 'SELECT ...' sends the query to BigQuery's planner, which validates the SQL and returns the estimated number of bytes that would be read from storage, without actually executing the query or consuming slots. The --use_legacy_sql=false flag ensures your statement is parsed as standard SQL, not the older legacy dialect, which matters for syntax compatibility. This is exactly the right tool when a query is slow and you want to quickly see how much data it touches before investing time in optimization or running it.

Why this answer

The bq query command with the --dry_run flag (or --dry-run) will process the query and return the amount of data that would be scanned, without executing the query. This helps estimate cost and performance.

11
MCQmedium

A company wants to split traffic between two revisions of a Cloud Run service: 90% to revision 'green' and 10% to revision 'blue'. Which command should they use?

A.gcloud run revisions list
B.gcloud run services update
C.gcloud run services update-traffic
D.gcloud run deploy
AnswerC

`gcloud run services update-traffic` is the correct command to split traffic between two or more existing revisions of a Cloud Run service. It accepts flags like `--to-revisions=rev1=50,rev2=50` to assign precise percentages, or `--to-latest` to route all traffic to the latest revision. This command directly modifies the route resource, making it the appropriate tool for controlled canary rollouts or rollbacks.

Why this answer

'gcloud run services update-traffic' is the correct command to manage traffic splitting between revisions. 'gcloud run revisions list' only lists revisions. 'gcloud run services update' does not handle traffic directly. 'gcloud run deploy' with --no-traffic is for initial deployment.

12
MCQhard

An engineer needs to update a Kubernetes Deployment's container image to version v2. They run 'kubectl set image deployment/my-app my-container=gcr.io/my-project/my-image:v2'. After a few minutes, they check the rollout status and see a failure. They want to revert to the previous image. Which command should they use?

A.kubectl rollout status deployment/my-app
B.kubectl rollout undo deployment/my-app
C.kubectl delete deployment/my-app --cascade=false
D.kubectl set image deployment/my-app my-container=gcr.io/my-project/my-image:v1
AnswerB

kubectl rollout undo deployment/my-app is the correct command because it reverts the deployment to the previous revision, restoring the prior pod template spec and container image. Kubernetes retains rollout history for each change to the pod template, and undo automatically scales down the current ReplicaSet and scales up the previous one, seamlessly rolling back the application without manual image specification.

Why this answer

'kubectl rollout undo' reverts the Deployment to the previous revision. 'kubectl rollout status' shows status but does not revert. 'kubectl set image' with v1 would manually set the old image, but 'undo' is the standard rollback command.

13
MCQmedium

Your team wants to send Cloud Monitoring alerts to a Slack channel. You have created a Pub/Sub topic and subscription. Which notification channel type should you configure in Cloud Monitoring?

A.Pub/Sub
B.PagerDuty
C.Slack
D.Email
AnswerA

Pub/Sub is the correct notification channel type for this use case because Cloud Monitoring can send alert notifications to a Pub/Sub topic, and a separate subscriber (such as a Cloud Function or Cloud Run service) can then forward those messages to Slack using an incoming webhook. Unlike email or PagerDuty, Pub/Sub is not a direct end-user notification mechanism; instead it acts as a highly scalable, event-driven integration bus that decouples alert generation from downstream delivery. This pattern is the officially recommended way to connect Cloud Monitoring alerts to Slack, since Slack has no native notification channel in Cloud Monitoring.

Why this answer

Cloud Monitoring can send notifications to Pub/Sub topics, which can then be processed by a subscriber like Slack webhook.

14
MCQmedium

You have a Cloud Run service that is experiencing high latency. You want to analyze the latency distribution of requests. Which Google Cloud tool should you use?

A.Cloud Debugger
B.Cloud Logging Log Explorer
C.Cloud Trace
D.Cloud Monitoring Metrics Explorer
AnswerC

Cloud Trace is purpose-built for latency analysis. It collects latency data from Cloud Run and other GCP services, then generates distributed traces with spans that show the duration of each operation—such as receiving the request, calling downstream dependencies, and returning the response. Trace features like waterfall views, latency distributions, and per-trace breakdowns let you identify exactly which service or API call is the bottleneck, making it the correct tool for high-latency issues.

Why this answer

Cloud Trace is a distributed tracing service that collects latency data from applications and provides detailed analysis, including latency distributions and per-request traces.

15
MCQeasy

You have a Pub/Sub subscription that is accumulating a backlog of messages. Which Cloud Monitoring metric should you alert on to detect this condition?

A.pubsub.googleapis.com/subscription/oldest_unacked_message_age
B.pubsub.googleapis.com/subscription/sent_messages_count
C.pubsub.googleapis.com/subscription/unacked_messages_by_region
D.pubsub.googleapis.com/subscription/ack_message_count
AnswerA

This metric tracks the maximum age of the oldest message that has not yet been acknowledged by any subscriber for the subscription. It directly reflects backlog depth and consumer lag: when a subscription is accumulating a backlog, this value grows steadily because messages sit unacked for longer periods. It is the ideal signal for alerting on message processing delays because it captures the time dimension of the backlog, not just its size.

Why this answer

The Pub/Sub subscription's 'oldest_unacked_message_age' metric indicates how long the oldest unacknowledged message has been pending. A high value suggests a backlog that is not being processed.

16
MCQmedium

You need to update a deployment in your GKE cluster from image version v1 to v2 gradually, ensuring that only a small percentage of pods run v2 initially. After the rollout, you want to verify the rollout status. Which commands should you use?

A.kubectl set image deployment/my-deployment my-container=gcr.io/my-project/my-image:v2 --record && kubectl rollout status deployment/my-deployment
B.kubectl apply -f updated-deployment.yaml and kubectl rollout undo
C.kubectl edit deployment and kubectl rollout history
D.kubectl run my-deployment --image=gcr.io/my-project/my-image:v2 and kubectl get pods
AnswerA

The `kubectl set image` command imperatively updates the container image reference in the Deployment's pod template, and `--record` writes the change to the rollout history (stored in the `kubernetes.io/change-cause` annotation). Chaining `kubectl rollout status` polls the Deployment's status and returns successfully only when the new ReplicaSet has fully scaled up and the old one is scaled down, providing direct verification that the update completed. This combination is exactly the right way to update an image and confirm the rollout reached a ready state.

Why this answer

Use kubectl set image to update the image, then kubectl rollout status to monitor the rollout. For gradual rollout, you can use kubectl rollout pause/resume or set maxSurge/maxUnavailable, but the question asks for the command to update and verify.

17
Multi-Selecthard

Your application running on Compute Engine is experiencing intermittent high latency. You need to diagnose the root cause. Which THREE tools or services should you use to gather data? (Choose 3)

Select 3 answers
A.Cloud Monitoring
B.Cloud Logging
C.Cloud Profiler
D.Cloud Debugger
E.Cloud Trace
AnswersA, B, E

Cloud Monitoring is the correct starting point because it provides time-series metrics for Compute Engine, such as CPU utilization, memory usage, disk I/O, and network throughput. You can build custom dashboards and alerts to correlate intermittent latency spikes with resource saturation, helping you determine whether the cause is a bottleneck in the VM, disk, or network. This metric-centric view is essential for seeing the pattern of when slowdowns occur.

Why this answer

Cloud Monitoring provides metrics and dashboards; Cloud Logging provides logs; Cloud Trace provides trace data for latency analysis. Together they cover metrics, logs, and traces for comprehensive troubleshooting.

18
MCQmedium

A company wants to export all Cloud Logging logs to BigQuery for long-term analysis. They create a log sink with a BigQuery dataset as the destination. After a few days, they notice that some logs are missing in BigQuery. What is the most likely reason?

A.The sink's inclusion filter is too restrictive
B.Logs older than 30 days cannot be exported
C.The sink's destination is a table, not a dataset
D.BigQuery dataset is in a different region
AnswerA

This is the correct diagnostic. A log sink only forwards entries that match its inclusion filter, and an overly narrow filter—such as one restricted to a single resource type or severity level—will silently exclude the rest of the log stream before it reaches BigQuery. Check the sink's filter in the Logs Explorer to confirm it matches the actual log entries you expect to export, and note that any exclusion filters are applied after the inclusion filter and can further reduce the data routed.

Why this answer

Log sinks have a buffer period of up to a few minutes, but they guarantee delivery. However, if the sink's filter excludes certain logs (e.g., by resource type or severity), those logs are not exported. Missing logs usually indicate a filter misconfiguration.

19
MCQhard

Your GKE cluster nodes are running low on resources. You need to enable node pool autoscaling so that the cluster automatically adds and removes nodes based on demand. The node pool is named 'default-pool'. Which command completes this task?

A.gcloud container node-pools update default-pool --autoscaling enabled
B.gcloud container node-pools update default-pool --enable-autoscaling --min-nodes 1 --max-nodes 10
C.kubectl autoscale node-pool default-pool --min 1 --max 10
D.gcloud container clusters update my-cluster --enable-autoscaling --min-nodes 1 --max-nodes 10
AnswerB

This is the correct gcloud command to enable cluster autoscaler on a specific node pool. The `--enable-autoscaling` switch turns on autoscaling for the `default-pool`, and the `--min-nodes 1` and `--max-nodes 10` flags define the minimum and maximum size of the node pool. With this configuration, GKE's cluster autoscaler will automatically add or remove nodes within that range based on pending pod resource requests, which directly relieves the low-resource condition on the cluster's nodes.

Why this answer

gcloud container node-pools update with --enable-autoscaling enables autoscaling, and --min-nodes/--max-nodes set boundaries.

20
MCQeasy

An engineer needs to create an alerting policy in Cloud Monitoring that sends a notification when the 99th percentile latency of a service exceeds 500 ms for 5 minutes. Which metric type should they use?

A.Metric threshold
B.Log-based metric
C.Uptime check
D.Cloud Audit Logs
AnswerA

Metric threshold is the standard condition type used in a Cloud Monitoring alerting policy. It evaluates a metric stream (e.g., Compute Engine CPU utilization, disk bytes used) against a numeric threshold over a specified aggregation window, triggering notifications when the value crosses the threshold. This is the correct answer because it directly defines the alerting condition that the engineer needs.

Why this answer

A metric threshold alert uses a numeric metric and triggers when the value crosses a threshold. Log-based alerts are for when a specific log entry appears. Uptime checks monitor availability, not latency percentiles.

21
MCQhard

You need to change the machine type of a running Compute Engine instance from n1-standard-4 to n1-standard-8. What is the correct procedure?

A.Delete the instance and recreate it with the new machine type.
B.Run gcloud compute instances set-machine-type while the instance is running.
C.Stop the instance, run gcloud compute instances set-machine-type, then start the instance.
D.Take a snapshot, create a new instance, and attach the disk.
AnswerC

This is the only correct sequence: first stop the instance (gcloud compute instances stop), which transitions it to the TERMINATED state, then call gcloud compute instances set-machine-type with the desired type (predefined, custom, or E2), and finally start the instance again. The stop/start cycle is required because the hypervisor must release the old vCPU and memory resources before the new allocation can be applied. After the instance starts, it retains its existing disks, IP addresses, and metadata, so no configuration is lost.

Why this answer

Changing machine type requires stopping the instance first.

22
MCQmedium

You need to export all Cloud Logging logs from a specific project to BigQuery for long-term analysis. What should you create?

A.A log-based metric with BigQuery as destination
B.A log sink with BigQuery as the destination
C.A Pub/Sub subscription that pushes logs to BigQuery
D.An export job from Logging to BigQuery using gcloud logging export
AnswerB

A log sink is the correct Cloud Logging resource for streaming log entries to a supported destination, and BigQuery is a first-class destination. When you create a sink with `gcloud logging sinks create` or in the console, you specify a BigQuery dataset as the destination; Cloud Logging then continuously routes exported log entries into a partitioned table. This satisfies the requirement to export all logs from the project, optionally filtered by a log query.

Why this answer

Log sinks in Cloud Logging allow you to route logs to destinations like BigQuery, Cloud Storage, or Pub/Sub. You create a sink with BigQuery as the destination.

23
MCQmedium

You need to attach an existing 100 GB persistent disk named 'my-disk' to a Compute Engine instance 'web-server-1'. What is the correct command?

A.gcloud compute instances add-disk web-server-1 --disk my-disk
B.gcloud compute disks attach my-disk --instance web-server-1
C.gcloud compute disks create my-disk --instance web-server-1
D.gcloud compute instances attach-disk web-server-1 --disk my-disk
AnswerD

This is the correct command. The attach-disk subcommand belongs to gcloud compute instances, takes web-server-1 as the resource, and uses --disk my-disk to specify the existing persistent disk to attach. It associates the already provisioned 100 GB disk with the instance, and requires the disk and instance to be in the same zone (or use --zone if they are not set).

Why this answer

The command is gcloud compute instances attach-disk.

24
MCQeasy

You want to receive notifications when a specific metric exceeds a threshold. Which Cloud Monitoring resource defines the condition and the action?

A.Alerting policy
B.Dashboard
C.Uptime check
D.Notification channel
AnswerA

An alerting policy is the correct resource in Google Cloud Monitoring for triggering notifications based on a specific metric condition. It contains one or more conditions (e.g., metric crosses a threshold for a set duration) and references a notification channel to deliver the alert. Without an alerting policy, no metric evaluation or notification can occur.

Why this answer

An alerting policy defines conditions (metric threshold) and notification channels.

25
MCQmedium

You are using Cloud Logging and want to export all logs from a specific Compute Engine instance to BigQuery for long-term analysis. You create a log sink with a filter for the instance's resource type and labels. What additional step is required to complete the export?

A.Create a Cloud Pub/Sub topic and configure a push subscription
B.Create a BigQuery dataset and grant the log sink's service account the BigQuery Data Editor role
C.Create a Cloud Storage bucket as a staging location
D.Enable BigQuery's streaming buffer on the dataset
AnswerB

This is the correct approach because BigQuery must already exist as a dataset for the log sink to write into, and the sink's underlying writer identity (the service account) needs the BigQuery Data Editor role (roles/bigquery.dataEditor) on that dataset to create tables and insert log entries. You first create the dataset, then configure the log sink with BigQuery as its destination, and after the sink is created you copy its service account ID and grant that service account the required IAM role. Without that grant, the sink will fail with permission errors when trying to deliver logs to BigQuery.

Why this answer

Log sinks require a destination. For BigQuery, the sink must be configured with the destination as a BigQuery dataset. You must create the dataset first, then specify it in the sink.

The sink also needs appropriate permissions on the dataset.

26
MCQmedium

You have a Cloud Run service that you want to update to use a new container image. You also want to keep the previous revision available in case you need to roll back. Which command should you use?

A.gcloud run deploy my-service --image gcr.io/my-project/my-app:v2
B.gcloud run revisions update my-service --image gcr.io/my-project/my-app:v2
C.gcloud run services update --image gcr.io/my-project/my-app:v2
D.kubectl set image service/my-service my-app=gcr.io/my-project/my-app:v2
AnswerA

Running 'gcloud run deploy my-service --image gcr.io/my-project/my-app:v2' is the correct way to update a Cloud Run service's container image. The deploy command prepares a new immutable revision with the specified image, makes it the latest revision, and automatically routes traffic to it according to your service's traffic policy. Existing revisions are preserved in the revision history, enabling immediate rollback via 'gcloud run services update-traffic' if the new revision misbehaves.

Why this answer

gcloud run deploy creates a new revision and by default keeps the previous revision(s).

27
MCQhard

Your application uses Pub/Sub to process orders. You notice that the subscription backlog is growing. Which tool should you use to analyze the latency of each step in the processing pipeline?

A.Cloud Monitoring
B.Cloud Profiler
C.Cloud Logging
D.Cloud Trace
AnswerD

Cloud Trace provides distributed tracing with per-span and per-service latency breakdowns, capturing the full path of a message as it flows through Pub/Sub and downstream services. Its waterfall view and latency distributions reveal exactly which step—from publish to processing—contributes the most delay. It is the only tool among these options specifically designed to analyze per-step latency in a distributed, asynchronous pipeline.

Why this answer

Cloud Trace provides end-to-end latency analysis across distributed services, helping identify bottlenecks.

28
Multi-Selectmedium

You are troubleshooting a slow Pub/Sub subscription. Which three steps should you take to diagnose the issue? (Choose three.)

Select 3 answers
A.Check the subscription's backlog in the Pub/Sub console or via gcloud pubsub subscriptions describe
B.Use Cloud Monitoring Metrics Explorer to view the subscription's backlog and ack messages count
C.Use Cloud Trace to analyze the latency of each Pub/Sub message
D.Use Cloud Debugger to inspect the subscriber code
E.Use Cloud Logging to check for subscriber errors or delivery failures
AnswersA, B, E

Checking the subscription's backlog, either in the Pub/Sub console or via the `gcloud pubsub subscriptions describe` command, gives a direct numeric measurement of how many messages are unacknowledged and waiting to be redelivered. A consistently growing backlog relative to the publish rate indicates the subscriber cannot keep up with the incoming flow. This is the first diagnostic step because it confirms whether the bottleneck is on the delivery side or the processing side without instrumenting any application code.

Why this answer

Cloud Monitoring (Metrics Explorer) can show subscription backlog, Cloud Logging can show subscriber errors, and checking the subscription's backlog via gcloud or console helps assess the issue. Cloud Trace is for HTTP-based services, not Pub/Sub directly. Cloud Debugger is for code debugging, not Pub/Sub monitoring.

29
MCQmedium

An engineer needs to attach an existing persistent disk to a Compute Engine instance. They have created the disk using 'gcloud compute disks create'. Which command should they use to attach it?

A.gcloud compute disks resize
B.gcloud compute instances attach-disk
C.gcloud compute instances add-disk
D.gcloud compute disks attach
AnswerB

gcloud compute instances attach-disk is the correct command: it attaches an existing zonal or regional persistent disk to a specified Compute Engine instance, using --disk and optionally --device-name. It works on both running and stopped instances, and it ensures the disk becomes visible as a block device in the instance's guest OS.

Why this answer

'gcloud compute instances attach-disk' attaches a disk to an instance. 'gcloud compute disks attach' does not exist. 'gcloud compute instances add-disk' is not a valid command. 'gcloud compute disks resize' resizes the disk.

30
MCQeasy

You want to export a subset of Cloud Logging logs to BigQuery for long-term analysis. Which method should you use?

A.Create a log-based metric and export the metric to BigQuery
B.Create a log sink with a filter and destination BigQuery
C.Set up a Cloud Function that triggers on logs and inserts into BigQuery
D.Use gcloud logging read and pipe to bq load
AnswerB

A log sink with a filter and a BigQuery destination is the fully managed, native way to export logs: Cloud Logging continuously routes any newly ingested log entries that match the filter into a specified BigQuery dataset. The sink automatically creates a table with the log schema, and you can use the _PARTITIONTIME pseudo-column for time-based partitioning. This gives reliable, near-real-time export without custom code or manual intervention.

Why this answer

Log sinks route logs to destinations like BigQuery, Cloud Storage, or Pub/Sub. Creating a sink with a filter is the correct approach.

31
MCQmedium

You want to monitor the uptime of an external HTTP endpoint every minute and receive an email notification if the endpoint is unavailable for more than two consecutive checks. What should you do?

A.Create a log-based alert in Cloud Logging that triggers on network errors
B.Create an uptime check in Cloud Monitoring, then create an alerting policy with condition 'metric threshold' for 'check_failed' and set notification channel to email
C.Use Cloud Functions to periodically call the endpoint and send an email on failure
D.Configure a TCP health check on the load balancer
AnswerB

Uptime checks in Cloud Monitoring are the managed, intended way to verify that an external HTTP endpoint is reachable and returning expected responses from multiple locations across the globe. The check_failed metric increments each time a probe fails, and a metric-threshold alerting policy lets you define a condition—for instance, when the number of failed checks is consistently above zero over a specified period—and route it to an email notification channel. This directly implements the requirement without custom code.

Why this answer

Uptime checks in Cloud Monitoring can be configured to check HTTP endpoints. You can set alerting conditions based on the duration of the outage and choose email as a notification channel.

32
MCQmedium

You need to export logs from Cloud Logging to a BigQuery dataset for long-term analysis. What should you create?

A.An alerting policy with a log-based trigger
B.A log-based metric
C.An export job in BigQuery
D.A log sink with BigQuery as the destination
AnswerD

A log sink with BigQuery as the destination is the correct method: Cloud Logging's log router matches your chosen log entries and delivers them to a BigQuery dataset, where each daily collection becomes a table. You configure the destination by providing a dataset name, and the sink automatically handles batching and streaming writes. This is the officially supported, commonly used way to export logs to BigQuery for analytics.

Why this answer

Log sinks are used to route logs to destinations like BigQuery, Cloud Storage, or Pub/Sub.

33
MCQhard

You need to drain a GKE node for maintenance, ensuring that daemonsets and pods using emptyDir volumes are handled properly. Which command should you use?

A.kubectl taint nodes NODE key=value:NoSchedule
B.kubectl drain NODE --ignore-daemonsets --delete-emptydir-data
C.kubectl delete node NODE
D.kubectl cordon NODE && kubectl delete pods --all
AnswerB

`kubectl drain` gracefully evicts all pods from the node while respecting PodDisruptionBudgets, making the node unschedulable and empty for maintenance. The `--ignore-daemonsets` flag skips DaemonSet-managed pods, which are intended to run on every node and would otherwise block eviction, while `--delete-emptydir-data` allows deletion of pods using emptyDir volumes, which would otherwise prevent the drain from finishing. These flags together ensure the command completes cleanly on nodes with these pod types.

Why this answer

kubectl drain with flags ignores daemonsets and deletes emptyDir pods.

34
MCQmedium

You need to resize a Compute Engine instance from n1-standard-4 to n1-highmem-8. The instance has a local SSD attached. What must you do before changing the machine type?

A.Stop the instance, change the machine type, then start the instance
B.Take a snapshot of the local SSD
C.Change the machine type without stopping
D.Detach the local SSD
AnswerA

To change the machine type of a Compute Engine instance, you must first stop it, which brings it to the TERMINATED state. While stopped, the persistent disks and instance settings remain intact, but any data on local SSDs is permanently lost because local SSDs are ephemeral storage tied to the host server. After updating the machine type, you start the instance; this process is the only supported way to resize an instance's vCPU and memory.

Why this answer

To change the machine type, the instance must be stopped. Local SSDs preserve data only if the instance is not stopped or terminated; however, when you stop the instance, local SSD data is lost. The correct procedure is to stop the instance, change the machine type, and then start it.

Data on local SSDs will be lost.

35
MCQhard

An application is experiencing intermittent high latency. Using Cloud Trace, an engineer identifies that the bottleneck is a Pub/Sub subscription with a large backlog. Which action would MOST directly help reduce the backlog?

A.Increase the ack deadline
B.Increase the maximum message size
C.Increase the message retention duration
D.Increase the number of subscribers
AnswerD

Increasing the number of subscribers (i.e., scaling out the subscriber fleet) directly raises the aggregate processing throughput of the subscription. Because the intermittent high latency is likely due to a backlog of messages accumulating faster than the current subscribers can drain, adding more subscribers allows messages to be pulled and processed in parallel, reducing the queue depth and lowering end-to-end latency. This is the correct scaling action for a latency problem caused by insufficient compute, assuming the subscribers are stateless and can process messages independently.

Why this answer

Increasing the number of subscribers (e.g., scaling out the subscriber application) will increase the processing rate and reduce backlog. Increasing the retention duration keeps messages longer, not reducing backlog. The ack deadline and message size are not the primary causes of backlog.

36
MCQmedium

You need to export all Cloud Logging logs from your project to BigQuery for long-term analysis. What should you create?

A.A Cloud Monitoring dashboard
B.A VPC flow log
C.A log-based alert
D.A log sink with destination BigQuery
AnswerD

A log sink in Cloud Logging's Router exports matching log entries to a destination such as BigQuery, Cloud Storage, or Pub/Sub. By configuring a sink with BigQuery as the destination and a filter that matches all logs (or empty filter), you continuously export your project's logs to a BigQuery dataset for analysis and long-term retention. This is the standard and only fully supported mechanism for exporting Cloud Logging logs to external services.

Why this answer

Log sinks route logs to supported destinations including BigQuery.

37
MCQmedium

You are investigating high latency in your application deployed on Compute Engine. You suspect a specific API call is taking longer than expected. Which Google Cloud tool should you use to analyze the latency of individual requests?

A.Cloud Debugger
B.Cloud Trace
C.Cloud Monitoring dashboards
D.Cloud Logging log explorer
AnswerB

Cloud Trace is a distributed tracing service designed to collect latency data from Google Cloud and measure time spent in each service and API call during a request. It provides detailed per-request traces with spans that show the timing of each operation, making it the correct tool to investigate high application latency. By analyzing the waterfall view of spans, you can identify the exact component responsible for the delay across distributed services.

Why this answer

Cloud Trace provides distributed tracing, allowing you to see the latency of individual requests and identify bottlenecks. It captures trace spans from supported frameworks and services.

38
MCQhard

You are deploying a new revision of a Cloud Run service. You want to gradually shift traffic from the old revision to the new one, starting with 10% traffic to the new revision. Which command should you use?

A.gcloud run services update-traffic my-service --to-revision new-revision --percent 10
B.gcloud run revisions traffic my-service --to-revision new-revision --percent 10
C.gcloud run services update my-service --image gcr.io/my-project/my-image:new
D.gcloud run deploy my-service --image gcr.io/my-project/my-image:new --traffic new-revision=10
AnswerA

The `gcloud run services update-traffic` command is the correct tool for modifying an existing Cloud Run service's traffic routing. By specifying `--to-revision new-revision` and `--percent 10`, you instruct the service to send 10% of incoming requests to that revision while the remaining 90% continues to the current default revision. This enables incremental canary rollouts and rollbacks without redeploying code.

Why this answer

Cloud Run allows traffic splitting between revisions. The gcloud run services update-traffic command can specify the percentage of traffic for each revision.

39
MCQmedium

You manage a Google Kubernetes Engine (GKE) cluster and need to update the deployment 'web-app' to use a new container image tag 'v2'. You also want to ensure the update proceeds and, if it fails, roll back to the previous revision. Which set of commands should you use?

A.gcloud container clusters upgrade; kubectl rollout status; kubectl rollout undo
B.kubectl set image deployment/web-app web-app=gcr.io/myproject/web-app:v2; kubectl rollout status; kubectl rollout undo
C.kubectl edit deployment web-app; kubectl rollout status; kubectl delete deployment web-app
D.kubectl apply -f web-app.yaml; kubectl rollout status; kubectl rollout undo
AnswerB

kubectl set image directly updates the Deployment's pod template to reference the v2 image, which triggers a rolling update orchestrated by the Deployment controller. kubectl rollout status then watches that update to completion, returning a non-zero exit code if the rollout fails (e.g., due to crash-loops or insufficient readiness), which is the correct signal for conditional rollback. kubectl rollout undo reverts to the previous revision, but note it should be gated on that failure in practice; even so, this is the only option that uses the proper Kubernetes-native commands for image update, rollout monitoring, and rollback.

Why this answer

kubectl set image updates the image; kubectl rollout status monitors progress; kubectl rollout undo reverts to the previous revision.

40
MCQmedium

You have a GKE cluster with a node pool that needs to scale automatically based on load. The cluster was created with autoscaling disabled. Which command enables autoscaling on an existing node pool?

A.gcloud container node-pools create my-pool --enable-autoscaling
B.kubectl autoscale node-pool my-pool --min=1 --max=10
C.gcloud container node-pools update my-pool --cluster=my-cluster --enable-autoscaling --min-nodes=1 --max-nodes=10
D.gcloud container clusters update my-cluster --enable-autoscaling
AnswerC

This is the correct command because it targets an existing node pool (`my-pool`) within the specified cluster and toggles the GKE cluster autoscaler on for that pool. The `--min-nodes=1` and `--max-nodes=10` flags define the scaling boundaries, allowing the pool to resize within those limits based on resource demand. The `--cluster` flag scopes the operation to the right cluster, and the update command modifies the live pool without recreating it.

Why this answer

gcloud container node-pools update with --enable-autoscaling and min/max node parameters enables autoscaling.

41
Multi-Selectmedium

You need to set up log-based alerting in Cloud Logging to send notifications when a specific error pattern appears in your application logs. Which TWO components are required to accomplish this?

Select 2 answers
A.An alerting policy
B.A log sink
C.A Cloud Pub/Sub topic
D.An uptime check
E.A log-based metric
AnswersA, E

The alerting policy is the actual alerting mechanism in Cloud Logging. It defines the conditions that trigger an incident, such as a threshold on a metric (e.g., a log-based metric exceeding a value) and specifies the notification channels (email, Slack, etc.) to receive alerts. Without an alerting policy, a log-based metric only counts or samples log entries; it does not perform any active monitoring or notify anyone.

Why this answer

To create a log-based alert, you need a log-based metric that counts the matching log entries, and an alerting policy that uses that metric. The metric is the source of the condition, and the policy defines when to notify.

42
Multi-Selectmedium

You are troubleshooting a Pub/Sub subscription that is not delivering messages promptly. Which THREE factors should you investigate? (Choose THREE.)

Select 3 answers
A.The subscription's backlog size
B.The topic's retention duration
C.The subscriber's processing latency
D.The message ordering key
E.The acknowledgment deadline
AnswersA, C, E

The subscription's backlog size is the primary indicator of delivery problems: it counts messages that have been published but not yet acknowledged. When troubleshooting a subscription that is not delivering, an ever-growing backlog means messages are arriving faster than the subscriber can process them, or the subscriber has stopped pulling entirely. Large backlog also correlates with slow processing and can help you decide whether to scale out subscribers or inspect subscriber logs.

Why this answer

Common causes include backlog, subscriber latency, and ack deadlines.

43
MCQmedium

You have a Compute Engine VM instance that is currently running. You need to resize it to a different machine type. What must you do first?

A.Stop the instance, then use gcloud compute instances set-machine-type, then start the instance.
B.Use gcloud compute instances update --machine-type while the instance is running.
C.Detach all disks, change machine type, then reattach disks.
D.Create a snapshot of the disk and use it to create a new instance with the desired machine type.
AnswerA

Stopping the instance transitions it to the TERMINATED state, which releases the underlying host resources while preserving the boot disk, metadata, and attachment of persistent disks. The `gcloud compute instances set-machine-type` command can then change the vCPU and memory allocation, and after that you start the instance. This is the correct workflow because Compute Engine rejects machine type changes on running instances.

Why this answer

Changing the machine type requires the VM to be in a stopped state. You must stop the instance, change the machine type, then start it.

44
Multi-Selectmedium

A company wants to automate the response to specific log entries by triggering a Cloud Function. Which THREE components are required? (Choose 3)

Select 3 answers
A.Cloud Function (Pub/Sub trigger)
B.Cloud Logging log sink
C.Pub/Sub topic
D.BigQuery dataset
E.Cloud Monitoring notification channel
AnswersA, B, C

A Cloud Function with a Pub/Sub trigger is the compute piece that executes your custom response logic asynchronously. When a message lands on the subscribed topic, the function is invoked with the message payload, letting you parse the log data and call external APIs, send alerts, or modify resources. This event-driven model avoids maintaining a server and scales automatically with message volume. Without this function, the sink and topic would merely transport logs with no automated reaction.

Why this answer

Log entries must be routed to a Pub/Sub topic via a log sink. The Cloud Function subscribes to that topic (triggered by Pub/Sub). The log sink is the exporter, Pub/Sub is the intermediary, and Cloud Function is the action.

A notification channel is for alerts, not triggers. BigQuery is not needed.

45
MCQeasy

An engineer needs to monitor the external HTTP availability of a web application hosted on Compute Engine. Which Cloud Monitoring feature should they use?

A.Uptime check
B.Dashboard
C.Metric Explorer
D.Log-based alert
AnswerA

An uptime check is a Cloud Monitoring synthetic probe that periodically sends an HTTP(S) request to the specified URL from configurable global locations. It validates availability by checking for expected HTTP status codes, response time thresholds, and optional content matches, and it emits metrics such as uptime, latency, and check success. This is the correct choice because it actively measures external HTTP reachability from outside the network, which is exactly what is needed to monitor external availability.

Why this answer

Uptime checks are designed to verify that a resource is accessible and measure response latency from various locations. They can check HTTP/HTTPS/TCP endpoints.

46
MCQmedium

A Cloud Run service is experiencing high latency. You suspect one revision is causing the issue. The service is configured to split traffic 90% to revision A and 10% to revision B. You want to gradually shift traffic back to revision A only. Which command should you use?

A.kubectl set traffic my-service --revision=my-service-00001=100
B.gcloud run services update-traffic my-service --to-revisions=my-service-00001=100
C.gcloud run revisions delete my-service-00002
D.gcloud run services update my-service --set-revision my-service-00001
AnswerB

This is the correct, supported command for adjusting traffic on a Cloud Run service. The 'update-traffic' subcommand directly modifies the revision routing percents, and '--to-revisions' allows explicit targeting of a specific revision; here, setting 'my-service-00001=100' routes all live traffic to the known-good revision A. This immediately reduces load on the suspect revision B and is exactly how you roll back a bad deployment on Cloud Run.

Why this answer

gcloud run services update-traffic allows you to set traffic percentages for revisions. Setting 100% to revision A achieves the goal.

47
MCQeasy

You need to update the container image of a deployment named 'my-app' in GKE to a new version. Which command should you use?

A.kubectl apply -f updated-deployment.yaml
B.kubectl update deployment my-app --image=my-image:v2
C.kubectl edit deployment my-app --image=my-image:v2
D.kubectl set image deployment/my-app my-app-container=my-image:v2
AnswerD

kubectl set image deployment/my-app my-app-container=my-image:v2 is correct because it imperatively changes the image of the container named 'my-app-container' in the deployment 'my-app'. The syntax is RESOURCE_TYPE/RESOURCE_NAME CONTAINER_NAME=IMAGE, and the command triggers a rolling update by creating a new ReplicaSet and scaling it up while scaling down the old one. This is the standard kubectl command for updating a container image without modifying a manifest or entering a text editor. After running it, you can monitor progress with kubectl rollout status deployment/my-app.

Why this answer

kubectl set image updates the image of a deployment.

48
Multi-Selecthard

An engineer is troubleshooting a Compute Engine instance that is unreachable via SSH. They suspect a firewall rule is blocking traffic. Which TWO actions should they take to diagnose the issue? (Choose 2)

Select 2 answers
A.Create a Cloud Monitoring alert for packet loss
B.View Cloud Logging for firewall rule logs
C.Run gcloud compute ssh --dry-run
D.Use Cloud Trace to analyze network latency
E.Check VPC firewall rules in Cloud Console
AnswersB, E

Viewing Cloud Logging for firewall rule logs is the direct way to see whether VPC firewall rules are dropping or allowing traffic. Firewall rule logging records each connection attempt with details like source IP, destination IP, port, protocol, and the action (allow or deny). If the Compute Engine instance is unreachable due to a firewall rule, these logs will show the denied packets, making this a reliable troubleshooting step.

Why this answer

In Cloud Logging, you can view firewall logs (if VPC flow logs are enabled, but firewall rules logging can be enabled per rule). Checking VPC firewall rules in the Cloud Console allows you to verify the rules. Cloud Trace is for latency, Cloud Monitoring for metrics, and gcloud compute ssh is for connecting, not diagnosing firewall rules.

49
MCQhard

You need to perform a rolling update of a GKE deployment and ensure that during the update, the new pods are ready before terminating the old ones. You have already set the update strategy to RollingUpdate. Which kubectl command sequence should you use to update the image and monitor the rollout?

A.gcloud container clusters upgrade my-cluster; kubectl get deployments
B.kubectl set image deployment/myapp myapp=gcr.io/myproject/myapp:v2; kubectl rollout status deployment/myapp
C.kubectl edit deployment myapp; kubectl get pods; kubectl delete pod old-pod
D.kubectl apply -f deployment.yaml; kubectl rollout undo deployment/myapp
AnswerB

kubectl set image updates the Deployment's pod template to gcr.io/myproject/myapp:v2, which triggers the Deployment controller to create a new ReplicaSet and incrementally replace old pods while respecting maxSurge/maxUnavailable. kubectl rollout status then blocks until the new ReplicaSet becomes ready and the old ReplicaSet is scaled down, confirming the rolling update completed successfully. This is the standard declarative workflow for updating an app version.

Why this answer

kubectl set image updates the image; kubectl rollout status monitors the progress. If the rollout fails, kubectl rollout undo rolls back.

50
Multi-Selecteasy

You need to set up an alerting policy to notify your team via email and Slack when a Compute Engine instance's CPU utilization exceeds 80% for 5 minutes. Which two resources must you configure? (Choose two.)

Select 2 answers
A.A Cloud Function to check CPU and send Slack message
B.A metric threshold condition on the 'compute.googleapis.com/instance/cpu/utilization' metric
C.An uptime check for the external IP of the instance
D.A notification channel of type 'email'
E.A log-based alert for the 'compute.googleapis.com/instance' log
AnswersB, D

The correct condition uses a metric threshold on the time series compute.googleapis.com/instance/cpu/utilization. This metric is emitted automatically from GCE instances and can be queried with a threshold (e.g., > 80%) aligned over a defined period such as 5 minutes. When the condition's duration (e.g., 'for 5 minutes') is met, the alerting policy enters the firing state and notifies any attached channels. This is the native, fully integrated way to alert on CPU load.

Why this answer

To create an alerting policy, you need a metric threshold condition (e.g., CPU utilization > 80% for 5 minutes) and notification channels (email, Slack). Uptime checks are for availability, not performance metrics. Log-based alerts are for log events, not metrics.

51
Multi-Selectmedium

You need to drain a GKE node for maintenance without disrupting running workloads that are managed by a DaemonSet. Which TWO flags should you use with kubectl drain? (Choose two.)

Select 2 answers
A.--delete-emptydir-data
B.--grace-period=0
C.--disable-eviction
D.--ignore-daemonsets
E.--force
AnswersA, D

This flag allows the eviction of pods that use emptyDir volumes. During a node drain, kubectl will not evict such pods by default because their data is ephemeral and would be lost. To proceed with draining and terminate these pods gracefully, you must explicitly permit the deletion of their emptyDir data. This is safe when you don't need the temporary data or when apps handle empty volumes on startup.

Why this answer

kubectl drain evicts pods. By default, it will fail if there are pods not managed by a ReplicationController/ReplicaSet/Deployment or if there are DaemonSet pods. The --ignore-daemonsets flag allows draining despite DaemonSet pods.

The --delete-emptydir-data flag is needed if any pods use emptyDir volumes.

52
MCQhard

Your GKE cluster is running a deployment with a container image my-app:v1. You need to update it to my-app:v2 and monitor the rollout progress. Which commands should you use?

A.gcloud compute instances update-container and kubectl get events
B.kubectl edit deployment/my-app and change the image, then kubectl rollout undo if needed
C.kubectl set image deployment/my-app my-app=my-app:v2 followed by kubectl rollout status deployment/my-app
D.gcloud container clusters upgrade and kubectl get pods
AnswerC

kubectl set image deployment/my-app my-app=my-app:v2 imperatively updates the container image of the specified container in the Deployment, which immediately triggers a new ReplicaSet and rolling update. kubectl rollout status deployment/my-app then blocks and reports the status of that rollout until it completes, satisfying the requirement to update and monitor progress in one straightforward command sequence.

Why this answer

kubectl set image updates the deployment, and kubectl rollout status monitors progress.

53
MCQeasy

You need to alert when the CPU utilization of your Compute Engine instance exceeds 80% for 5 minutes. What should you create in Cloud Monitoring?

A.An uptime check
B.A metric threshold alerting policy
C.A log-based alert
D.A dashboard chart
AnswerB

In Cloud Monitoring, you create an alerting policy with a condition that uses a threshold for a metric such as 'compute.googleapis.com/instance/cpu/utilization'. The policy samples the metric stream over an alignment period and triggers when the value (e.g., average CPU utilization) crosses the threshold for a specified duration. This is exactly the native mechanism for CPU utilization alerts.

Why this answer

A metric threshold alerting policy triggers when a metric crosses a threshold for a specified duration.

54
MCQhard

You need to create a log-based metric that counts the number of 5xx errors from your application logs. The logs are in Cloud Logging and contain a field "httpRequest.status". Which filter should you use when creating the metric?

A.httpRequest.status:5*
B.severity=ERROR AND "5xx"
C.httpRequest.status = 500 OR httpRequest.status = 501 OR httpRequest.status = 502
D.httpRequest.status >= 500
AnswerD

This filter uses a comparison operator on the numeric field httpRequest.status. In Cloud Logging, filters support comparison operators like >= for numeric values, so this will match any log entry where the HTTP response status is 500 or higher, capturing all server error statuses (5xx). This is the recommended approach because it is concise and semantically correct.

Why this answer

Log-based metrics use Cloud Logging filter language to select log entries.

55
MCQeasy

A site reliability engineer needs to be notified immediately when the error rate of a production microservice exceeds 5% over a 5-minute window. Which type of alerting policy should be used?

A.Uptime check alert
B.Pub/Sub notification hook
C.Metric threshold alert
D.Log-based alert (log metric trigger)
AnswerC

A metric threshold alert continuously evaluates a time-series metric (e.g., error rate, request latency, or CPU utilization) against a user-defined threshold, such as 'error rate > 5% for 5 minutes', and immediately triggers a notification when the condition is met. This is precisely the right tool for an SRE who needs to be notified when application error rates exceed an acceptable level, because it supports real-time aggregation, sliding windows, and alerting policies with multiple notification channels. It is the correct answer.

Why this answer

A metric threshold alert triggers when a metric crosses a threshold. This scenario requires tracking the error rate metric and alerting when it exceeds 5%.

56
MCQmedium

You are configuring an uptime check for an HTTPS endpoint that returns a JSON response. The check should validate that the response contains a specific field "status":"ok". Which uptime check option should you use?

A.Enable SSL hostname verification
B.Configure a notification channel
C.Add a content match with a regular expression
D.Create a log-based alert for the endpoint
AnswerC

Adding a content match with a regular expression is the direct way to verify a specific string pattern in the HTTPS response body. Cloud Monitoring uptime checks accept both substring and regex content matches, allowing you to assert that the page contains a particular marker or dynamic token. This confirms the endpoint is serving expected application content, not just a reachable server.

Why this answer

Uptime checks can validate response content using content matching.

57
Multi-Selecthard

Your GKE cluster is running an older version of Kubernetes. You need to upgrade the cluster's control plane and node pools. Which two steps should you perform? (Choose two.)

Select 2 answers
A.Create a new cluster with the desired version and migrate workloads
B.Drain all nodes using kubectl drain before upgrading
C.Manually update the kubelet version on each node
D.Upgrade the cluster's control plane using gcloud container clusters upgrade
E.Upgrade node pools using gcloud container node-pools upgrade
AnswersD, E

Upgrading the cluster's control plane with `gcloud container clusters upgrade` is the correct first step because GKE enforces a maximum version skew between the control plane and node pools—typically one minor version. The control plane must be on the target version before node pools can be upgraded, and this command without a `--node-pool` flag updates only the control plane. This ensures the Kubernetes API server and scheduler are consistent with the target version, reducing the risk of API deprecations or incompatibility. It is the only supported way to perform an in-place control plane upgrade while preserving cluster identity and state.

Why this answer

Upgrading a GKE cluster involves upgrading the cluster (control plane) first using gcloud container clusters upgrade, and then upgrading node pools separately (or they can be auto-upgraded). You cannot upgrade nodes without upgrading the control plane first. Draining nodes is not a step for upgrading, it's for maintenance.

58
MCQeasy

Your team uses Cloud Logging to store application logs. You want to create a metric that counts the number of ERROR log entries per service. Which type of log-based metric should you create?

A.Distribution metric
B.Boolean metric
C.Counter metric
D.Gauge metric
AnswerC

A counter metric is the correct log-based metric type for this use case, because it increments by one for every log entry that matches the specified filter, such as severity=ERROR. This gives the total number of error logs over the selected time window, which is exactly what the team wants to track. In Cloud Logging, you define a counter-based log metric with a filter and then use it in Monitoring charts or alerts.

Why this answer

Log-based metrics can be counter metrics (count of log entries matching a filter) or distribution metrics. For counting occurrences, a counter metric is appropriate.

59
MCQhard

Your GKE cluster has a node pool that you want to enable autoscaling on. The initial node count is 3, and you want the cluster to scale between 1 and 10 nodes. Which command should you use?

A.gcloud container clusters update my-cluster --enable-autoscaling --min-nodes 1 --max-nodes 10 --region us-central1
B.gcloud container clusters update my-cluster --enable-autoscaling --min-size 1 --max-size 10 --region us-central1
C.gcloud container node-pools update my-pool --cluster=my-cluster --enable-autoscaling --min-nodes 1 --max-nodes 10 --region us-central1
D.gcloud container node-pools update my-pool --cluster=my-cluster --autoscaling --min 1 --max 10 --region us-central1
AnswerC

This is the correct command because autoscaling is a node-pool-level feature. It uses `gcloud container node-pools update`, points at the specific pool with `--cluster=my-cluster`, and enables the Cluster Autoscaler with the valid `--enable-autoscaling` flag. The `--min-nodes 1 --max-nodes 10` range constrains the pool size, and `--region us-central1` correctly specifies the regional control plane where the cluster lives.

Why this answer

The correct command is gcloud container node-pools update with --enable-autoscaling and the min and max node flags. The cluster name and region/zone are required.

60
MCQeasy

You need to load a CSV file from Cloud Storage into an existing BigQuery table. Which bq command should you use?

A.bq query --source_format=CSV 'SELECT * FROM mydataset.mytable'
B.bq load --source_format=CSV mydataset.mytable gs://mybucket/myfile.csv
C.bq insert mydataset.mytable gs://mybucket/myfile.csv
D.bq import mydataset.mytable gs://mybucket/myfile.csv
AnswerB

bq load is the correct BigQuery CLI command to initiate a batch load job from Cloud Storage. It creates a load job that reads the CSV file at the given URI, parses it according to the specified --source_format, and writes rows into the target table (mydataset.mytable), which can be appended to or replace. This is the standard, idempotent way to bulk-load CSV data into BigQuery.

Why this answer

The bq load command loads data into a BigQuery table. You specify the source format (CSV) and the location of the file in Cloud Storage.

61
MCQmedium

You notice that a deployment in your GKE cluster is running an outdated image. You need to update the deployment to use the new image 'gcr.io/my-project/my-app:v2'. Which kubectl command should you use?

A.kubectl set image deployment/my-deployment my-app=gcr.io/my-project/my-app:v2
B.kubectl rollout restart deployment my-deployment --image gcr.io/my-project/my-app:v2
C.kubectl update deployment my-deployment --image gcr.io/my-project/my-app:v2
D.kubectl replace deployment my-deployment --image gcr.io/my-project/my-app:v2
AnswerA

kubectl set image deployment/my-deployment my-app=gcr.io/my-project/my-app:v2 is the correct imperative command to update a container image inside a Deployment. The container name (my-app) must exactly match the container name defined in the Deployment's pod spec, and the command updates the pod template so the Deployment controller creates a new ReplicaSet and performs a rolling update. This is the canonical kubectl syntax for changing an image without editing a manifest.

Why this answer

To update the image of a deployment, use 'kubectl set image' specifying the deployment name and the container name:tag.

62
MCQhard

You need to drain a GKE node for maintenance. The node is running a DaemonSet and some pods with emptyDir volumes. Which kubectl command should you use to safely drain the node without causing errors?

A.kubectl drain node-name --force
B.kubectl drain node-name --ignore-daemonsets --delete-emptydir-data
C.kubectl drain node-name --ignore-daemonsets
D.kubectl cordon node-name && kubectl delete pods --all --grace-period=0
AnswerB

This is the correct drain command because --ignore-daemonsets tells kubectl to skip evicting Pods that are managed by DaemonSets (they would just be recreated on the same node), and --delete-emptydir-data lets the drain proceed even if Pods have emptyDir volumes that will be lost. The drain cordons the node, then gracefully evicts remaining workload Pods while honoring PodDisruptionBudgets, making it safe for planned maintenance. These flags are the standard pair used when a GKE node contains DaemonSets and emptyDir-backed pods.

Why this answer

The kubectl drain command with --ignore-daemonsets and --delete-emptydir-data flags safely evicts pods while ignoring DaemonSets (which are managed by the node) and allowing deletion of pods with emptyDir volumes.

63
Multi-Selecteasy

You want to create a monitoring dashboard that shows a time-series chart of CPU utilization for a specific Compute Engine instance. Which THREE components do you need to configure? (Choose three.)

Select 3 answers
A.Choose a time aggregation function (e.g., mean, max)
B.Select the resource type: 'gce_instance' and filter by the instance ID
C.Create a log-based metric for CPU utilization
D.Select the metric: 'compute.googleapis.com/instance/cpu/utilization'
E.Set up a notification channel to send alerts
AnswersA, B, D

Choosing a time aggregation function is essential because raw metric samples arrive at irregular intervals and need to be aligned to a fixed time step for a coherent time series. The aggregation function (e.g., mean, max, sum) reduces multiple points within each alignment window into a single value, which determines the chart's shape and sensitivity to spikes. Without this step, the dashboard may render unusable, too-dense data or fail to produce a meaningful trend. For CPU utilization, 'mean' is typical for overall usage, while 'max' can highlight peak behavior.

Why this answer

In Cloud Monitoring, to create a chart you need to select a metric, a resource, and a time aggregation function.

64
Multi-Selecthard

Your Cloud Run service has a new revision that you want to gradually shift traffic to. You want to send 10% of traffic to the new revision and 90% to the current one. Which TWO steps are required? (Choose TWO.)

Select 2 answers
A.Set a new default URL for the new revision.
B.Delete the old revision.
C.Create the new revision by updating the service with a new image tag.
D.Enable VPC ingress for the new revision.
E.Use gcloud run services update-traffic to set traffic percentages.
AnswersC, E

Updating the service with a new image tag, for example via `gcloud run deploy`, is what creates a new revision. A revision cannot be manually created in isolation—it is always the result of deploying a new container image or configuration change. This step is a prerequisite because the later `update-traffic` command must reference the new revision's name to assign it a percentage of incoming requests.

Why this answer

You first create the new revision (by updating the service) and then modify traffic percentages.

65
MCQeasy

You have a Compute Engine VM that is running a critical application. You need to change its machine type from n1-standard-4 to n2-standard-8. What is the correct procedure?

A.Stop the instance, then use gcloud compute instances set-machine-type, then start the instance
B.Use gcloud compute instances update --machine-type n2-standard-8 while the instance is running
C.Delete the instance and create a new one with the desired machine type
D.Use gcloud compute instances resize --machine-type n2-standard-8 without stopping
AnswerA

Stopping the instance first moves it to the TERMINATED state, where the underlying vCPU/memory allocation can be changed. The `gcloud compute instances set-machine-type` command only works on a stopped instance, so stopping, changing, then starting is the documented, supported path. This preserves the boot disk, persistent disks, static IP, and all instance metadata.

Why this answer

To change the machine type of a VM, you must stop the instance first, then use the gcloud compute instances set-machine-type command, and finally start the instance again.

66
MCQmedium

A Cloud Run service named 'my-service' is currently serving 100% traffic to revision 'rev1'. You deploy a new revision 'rev2' and want to gradually shift traffic so that rev2 receives 10% of requests. Which command should you use?

A.gcloud run services update-traffic my-service --to-revisions=rev2=10,rev1=90
B.gcloud run services update my-service --traffic=rev2=10%
C.gcloud run deploy my-service --image=... --traffic=rev2=10
D.gcloud run revisions update rev2 --traffic=10
AnswerA

This is the correct service-level command for a precise traffic split between two existing revisions. It specifies both revisions explicitly, so Cloud Run routes exactly 10% of requests to rev2 and 90% to rev1; percentages must sum to 100 and should be entered as bare integers (no '%' sign). Because it uses `--to-revisions` on `update-traffic`, it works for rollbacks and gradual shifts without creating a new revision.

Why this answer

gcloud run services update-traffic allows you to set traffic percentages per revision. The syntax is --to-revisions=REVISION=PERCENTAGE.

67
MCQmedium

You are troubleshooting a Pub/Sub subscription that is not receiving messages as fast as they are published. You want to check if there is a backlog of unacknowledged messages for the subscription. What should you use?

A.Check the Cloud Logging logs for the subscription
B.Use gcloud pubsub subscriptions describe and check the ackDeadlineSeconds
C.Check the Cloud Console Pub/Sub dashboard for the topic publish rate
D.Use Cloud Monitoring to view the 'oldest_unacked_message_age' metric
AnswerD

The `oldest_unacked_message_age` metric, available in Cloud Monitoring under `pubsub.googleapis.com/subscription/oldest_unacked_message_age`, is a gauge metric that reports, per subscription, the age of the oldest message that has not yet been acknowledged. A high or increasing value directly indicates that the subscriber is not keeping up with the message flow, representing a growing backlog. This is the standard and most direct way to detect consumer lag in Cloud Pub/Sub, making it the correct diagnostic tool for the scenario.

Why this answer

Cloud Monitoring has a metric for Pub/Sub subscription backlog (oldest unacknowledged message age or num_undelivered_messages).

68
MCQmedium

You need to create a log-based metric that counts the number of errors in your application logs. What must you do first in Cloud Logging?

A.Create an alerting policy with a condition
B.Create a log sink that exports logs to BigQuery
C.Define a filter that matches the error logs
D.Install the Logging agent on your VMs
AnswerC

The correct approach is to define a filter expression in Cloud Logging that matches the error logs (e.g., severity=ERROR or specific text), then use that filter to create a logs-based metric. The metric counter increments for every matching log entry, and the filter becomes the metric's definition, allowing you to alert on the count over time.

Why this answer

In Cloud Logging, a log-based metric is based on a filter. You define the filter using the logging query language to match the logs you want to count, then create the metric from that filter.

69
MCQhard

Your Cloud Run service is receiving a sudden spike in traffic. You want to ensure that the number of concurrent requests per container instance does not exceed 10 to avoid overloading the backend. Which configuration should you set?

A.Set --timeout to 10 seconds
B.Set --concurrency to 10
C.Set --max-instances to 10
D.Set --cpu-throttling to true
AnswerB

Correct: --concurrency controls the maximum number of simultaneous requests that each container instance can process at the same time. With a spike, setting it to 10 means an instance will accept only 10 in-flight requests and Cloud Run will automatically spin up additional instances to handle the remaining traffic, preventing any single instance from being overwhelmed. It directly manages per-instance load rather than total capacity or request duration.

Why this answer

Cloud Run allows setting the maximum number of concurrent requests per container instance via the --concurrency flag or the concurrency field in the YAML. The default is 80; setting it to 10 limits each instance to 10 concurrent requests.

70
MCQmedium

An engineer needs to enable autoscaling on an existing node pool in a GKE cluster. Which command should they use?

A.gcloud compute instance-groups set-autoscaling
B.kubectl autoscale node-pool
C.gcloud container clusters update
D.gcloud container node-pools update --enable-autoscaling
AnswerD

This is the correct command because GKE exposes node-pool-level autoscaling through the container API. Running `gcloud container node-pools update NODE_POOL --cluster=CLUSTER --enable-autoscaling --min-nodes=MIN --max-nodes=MAX` turns on the cluster autoscaler for that specific node pool, allowing GKE to add or remove nodes within the configured limits based on resource demand. The command can also be used later to adjust min/max limits or disable autoscaling on existing node pools.

Why this answer

'gcloud container node-pools update' with '--enable-autoscaling' enables autoscaling. 'gcloud container clusters update' updates cluster-level settings, not node pools. 'kubectl autoscale' is for workloads, not node pools. 'gcloud compute instance-groups' is not used for GKE node pools.

71
MCQeasy

You need to monitor the uptime of an external HTTPS endpoint that is critical to your application. Which Google Cloud service should you use to create an uptime check?

A.Cloud Monitoring
B.Cloud Debugger
C.Cloud Trace
D.Cloud Logging
AnswerA

Cloud Monitoring includes native uptime checks that actively send HTTPS GET requests to the external endpoint from multiple global locations, verifying that the service is reachable and that expected HTTP status codes are returned. You can set response-time thresholds and alerting policies on these checks to trigger notifications when the endpoint fails or becomes slow. This makes it the correct service for monitoring endpoint availability rather than merely analyzing its internal behavior.

Why this answer

Cloud Monitoring provides uptime checks that can monitor HTTP, HTTPS, and TCP endpoints from multiple locations.

72
MCQmedium

You need to create a snapshot of a persistent disk attached to a running Compute Engine instance. The disk is used by a production database; you want minimal impact. What should you do?

A.Detach the disk, create the snapshot, then reattach.
B.Create the snapshot while the instance is running; snapshots are always consistent.
C.Use gcloud compute disks snapshot without stopping; data will be consistent.
D.Stop the instance, create the snapshot using gcloud compute disks snapshot, then restart the instance.
AnswerD

Stopping the instance is the correct approach because it triggers a clean guest OS shutdown, allowing filesystem caches to be flushed and applications to close files gracefully. After the instance is in the `TERMINATED` state, the persistent disk is quiescent, and running `gcloud compute disks snapshot` captures a point-in-time image that is both crash-consistent and application-consistent for most setups. Once the snapshot completes, you can restart the instance with `gcloud compute instances start` and resume operations with confidence that the snapshot reflects a known-good state.

Why this answer

Creating a snapshot of a disk in use is possible, but for data consistency, it's recommended to stop the instance or at least freeze the filesystem. However, the question says 'minimal impact', so the best practice is to stop the instance. But the correct answer reflects that snapshots can be taken from attached disks, but for database consistency, stop is recommended.

Let's choose the safer answer: stop the instance.

73
Multi-Selecthard

You are troubleshooting a slow application that uses multiple microservices. You suspect a particular service is causing high latency. Which TWO Google Cloud tools should you use to identify the root cause? (Select 2)

Select 2 answers
A.Cloud Profiler
B.Cloud Logging
C.Cloud Monitoring
D.Cloud Trace
E.Cloud Debugger
AnswersC, D

Cloud Monitoring ingests service-level metrics such as request count, latency, and error rate from GKE, Compute Engine, and App Engine, and can display them in dashboards with percentile aggregations. You can create alerting policies and SLOs to detect when one service's latency breaches a threshold. This metric-centric view identifies which service is slow and when, but does not give the end-to-end span journey through each internal call — that is Cloud Trace's role.

Why this answer

Cloud Trace traces requests across services to pinpoint latency, and Cloud Monitoring can show metrics like request latency and error rates.

74
MCQeasy

You need to be notified when the CPU utilization of any Compute Engine instance in your project exceeds 80% for 5 minutes. Which Cloud Monitoring feature should you use?

A.Uptime check
B.Log-based alert
C.Metric threshold alerting policy
D.Dashboard
AnswerC

A metric threshold alerting policy is the native Cloud Monitoring mechanism for checking a numeric metric stream against a condition, such as compute.googleapis.com/instance/cpu/utilization being above 80% for 5 minutes. You configure an alignment period, aggregator, window, and threshold, then route the incident to notification channels like email, Pub/Sub, or mobile. This directly consumes the CPU utilization metric and triggers a notification only when the threshold condition is met.

Why this answer

Metric threshold alerting policies allow you to set conditions based on metric values. When the condition (CPU > 80% for 5 minutes) is met, the alert fires and sends notifications via configured channels.

Ready to test yourself?

Try a timed practice session using only Ensuring Successful Operation of a Cloud Solution questions.