Courseiva

Google Associate Cloud Engineer (ACE) — Questions 175

769 questions total · 11pages · All types, answers revealed

Page 1 of 11

Page 2
1
MCQmedium

A GKE Deployment is running 3 replicas and receiving steady traffic. A junior engineer runs `kubectl scale deployment api-service --replicas=0` to 'stop it temporarily'. What happens to traffic during and after this command?

A.Traffic is paused and queued by the Service until replicas are restored
B.All Pods are terminated immediately; the Service has no backends and requests fail until replicas are restored
C.GKE detects the replica count is 0 and automatically restores it to maintain high availability
D.The Deployment is paused but Pods continue running until the next rollout
AnswerB

Running `kubectl scale deployment --replicas=0` directly patches the Deployment's `.spec.replicas` to 0, which signals the ReplicaSet controller to terminate every Pod immediately. The corresponding EndpointSlice objects are updated to have no ready addresses, leaving the Service with zero backends and causing all client requests to fail until the replicas are restored. Reapplying `kubectl scale --replicas=3` recreates Pods, repopulates endpoints, and resumes normal traffic.

Why this answer

When you scale a Deployment to 0 replicas, `kubectl` immediately terminates all Pods. The associated Kubernetes Service continues to exist but has no healthy endpoints, so any traffic directed to the Service’s ClusterIP or external load balancer will be dropped or result in a connection refusal (TCP RST) or HTTP 503. Traffic is not queued or buffered; it simply fails until new Pods are created by scaling the Deployment back up.

Exam trap

Google Cloud often tests the misconception that Kubernetes Services can queue or buffer traffic during scaling events, when in reality they are stateless and rely on real-time endpoint availability.

How to eliminate wrong answers

Option A is wrong because Kubernetes Services do not queue or buffer traffic; they rely on real-time endpoint discovery via the EndpointSlice controller, and with zero endpoints, packets are either rejected or blackholed. Option C is wrong because GKE does not automatically restore a Deployment’s replica count; the user explicitly set `--replicas=0`, and Kubernetes respects that desired state without any built-in high-availability override. Option D is wrong because scaling to 0 immediately terminates Pods; the Deployment is not paused, and Pods do not continue running — `kubectl scale` directly modifies the `spec.replicas` field, triggering a rollout that deletes all Pods.

2
MCQmedium

An organization needs to set up a new Google Cloud project with restricted access to only approved IP ranges for SSH into VMs. Which Google Cloud service should be used?

A.Cloud Armor
B.Cloud NAT
C.VPC Firewall Rules
D.Identity-Aware Proxy (IAP) TCP forwarding
AnswerC

VPC firewall rules are the correct choice because they are stateful, distributed ingress/egress filters applied at the VM's network interface, regardless of whether the VM has a public or private IP. You can create an ingress rule that allows TCP protocol, port 22, only from a specific CIDR range (e.g., 203.0.113.0/24) and uses a deny-all rule or the implied deny to block all other source IPs. These rules are enforced before traffic reaches the guest OS, making them a direct, IP-based access control mechanism for SSH.

Why this answer

VPC Firewall Rules (Option C) are the correct choice because they allow you to restrict inbound SSH (TCP port 22) traffic to specific source IP ranges by defining ingress rules at the VPC network level. This directly enforces IP-based access control for SSH into VM instances without additional services or proxies.

Exam trap

The trap here is that candidates often confuse Cloud Armor (a WAF for HTTP/S) with network-layer firewall rules, or assume IAP TCP forwarding is for IP whitelisting when it actually uses identity-based access, not source IP restrictions.

How to eliminate wrong answers

Option A is wrong because Cloud Armor is a web application firewall (WAF) that protects HTTP/HTTPS traffic at the Google Cloud Armor edge, not SSH traffic at the VM level; it cannot filter SSH connections. Option B is wrong because Cloud NAT provides outbound internet access for private VMs via source network address translation, but it does not control inbound SSH access or restrict source IPs. Option D is wrong because Identity-Aware Proxy (IAP) TCP forwarding enables SSH access without public IPs by tunneling through IAP, but it does not restrict access to approved IP ranges; instead, it uses identity and context-based access, not source IP filtering.

3
MCQmedium

A company wants to manage multiple GCP projects with different configurations (e.g., different regions and accounts) on the same workstation. Which gcloud feature should they use to switch between these configurations?

A.Environment variables
B.gcloud init each time
C.Configuration profiles
D.Multiple gcloud installations
AnswerC

gcloud config configurations (also called profiles) let you create and store named sets of properties including project, account, and region, then switch between them instantly with 'gcloud config configurations activate PROFILE'. Each profile can have its own authenticated credentials because 'gcloud auth login' can be run while a profile is active, so you can maintain distinct identities and project scopes simultaneously — this is the built-in, designed mechanism for multi-project management.

Why this answer

Configuration profiles allow setting different sets of properties (project, region, account) and switching between them with 'gcloud config configurations activate'.

4
MCQeasy

A load balancer is routing traffic to a VM where the application process has crashed, but the VM itself is still running. What prevents the load balancer from continuing to send traffic to this instance?

A.A VPC firewall rule blocking traffic to the VM
B.An HTTP health check configured on the backend service
C.A Cloud Armor security policy blocking the crashed instance's IP
D.The instance group autoscaling policy detecting the failure
AnswerB

An HTTP health check configured on the backend service is the mechanism that actively probes each VM's application port (for example, /healthz) over HTTP. When the application crashes and fails to return a 200 OK response within the set thresholds, the load balancer marks that instance as UNHEALTHY, removes it from active service, and stops forwarding new requests to it until the health check succeeds again. This is exactly how Google Cloud load balancers perform per-instance liveness detection and is the correct reason traffic stops.

Why this answer

The load balancer uses an HTTP health check to periodically probe the application on the VM. When the application process crashes, the health check fails (e.g., returns a non-2xx status code or times out), and the load balancer automatically stops routing new traffic to that unhealthy instance. This is the standard mechanism in Google Cloud for detecting application-level failures, as opposed to infrastructure-level failures.

Exam trap

The trap here is that candidates confuse infrastructure-level health (VM running) with application-level health (process responding), and assume autoscaling or firewall rules handle this, when in fact only a properly configured health check can detect a crashed application process.

How to eliminate wrong answers

Option A is wrong because a VPC firewall rule would block traffic at the network layer, but the question states the VM is still running and the application has crashed—firewall rules do not detect application crashes. Option C is wrong because Cloud Armor security policies filter traffic based on IP addresses, geographic regions, or layer 7 attributes, not based on the health of the application process on a VM. Option D is wrong because the instance group autoscaling policy reacts to overall load metrics (e.g., CPU utilization, requests per second) and may replace unhealthy instances, but it does not directly prevent the load balancer from sending traffic to a crashed instance—that is the health check's role.

5
MCQeasy

What is the basic role that grants full control over all resources in a GCP project?

A.Editor
B.Owner
C.Viewer
D.Admin
AnswerB

The Owner basic role is the highest-level predefined role in Cloud IAM, encompassing all Editor permissions plus the ability to manage IAM policies, set billing accounts, and configure organization-level settings when applied at the project or organization level. An Owner can grant any role to any principal, including making another user an Owner, and can view or change the project's billing account and payment details. This role is typically reserved for a small number of administrators because it provides unrestricted management of the project and its entire resource hierarchy.

Why this answer

The Owner role (roles/owner) grants full access, including the ability to manage roles and billing.

6
MCQeasy

A company needs to store 50 TB of access logs that are rarely accessed (once a year) and must be retained for 7 years. Which storage option is the most cost-effective?

A.Nearline Storage
B.Regional persistent disk
C.Archive Storage
D.Coldline Storage
AnswerC

Archive Storage is the correct choice because it is Google Cloud's lowest-cost storage class, specifically designed for data that is accessed less than once a year and has a 365-day minimum storage duration. For 50 TB of access logs that are rarely read, Archive gives the lowest total cost of ownership, and the data remains immediately retrievable (with retrieval latency in the seconds-to-minutes range, not offline tape). The 365-day minimum is irrelevant here because the logs will be stored for years, and any retrieval costs will be minimal given the rare access pattern.

Why this answer

Archive Storage is the most cost-effective option for data that is accessed less than once a year and must be retained for 7 years. It offers the lowest storage cost among Google Cloud storage classes, specifically designed for long-term, infrequently accessed data with a 365-day minimum storage duration and a higher retrieval cost, which is acceptable given the rare access pattern.

Exam trap

Google Cloud often tests the distinction between Coldline and Archive storage by making candidates assume 'cold' is the cheapest, but Archive Storage is the true lowest-cost tier for data accessed less than once a year, with a longer minimum storage duration and higher retrieval fees.

How to eliminate wrong answers

Option A (Nearline Storage) is wrong because it is optimized for data accessed less than once a month, not once a year, and has a 30-day minimum storage duration, making it more expensive for 7-year retention. Option B (Regional persistent disk) is wrong because it is a block storage solution for high-performance compute instances, not designed for archival log storage, and would be prohibitively expensive for 50 TB of rarely accessed data. Option D (Coldline Storage) is wrong because it is designed for data accessed less than once a quarter (90-day minimum storage duration), which is more frequent than once a year, and its storage cost is higher than Archive Storage.

7
MCQhard

A team deploys a Cloud Run service that must access resources in a private VPC (a private Cloud SQL instance and a Redis instance on Memorystore). The Cloud Run service has no public IP connectivity requirements for these resources. What must be configured?

A.Enable VPC Service Controls around Cloud Run to connect it to the VPC
B.Configure a Serverless VPC Access connector and specify it in the Cloud Run service deployment
C.Assign an external IP to the Cloud SQL and Memorystore instances — Cloud Run can reach them via public internet
D.Cloud Run automatically connects to any VPC resource in the same project via project-level networking
AnswerB

The correct solution is to create a Serverless VPC Access connector and attach it to your Cloud Run service during deployment (e.g., using `--vpc-connector`). The connector creates a bridge between the serverless environment and your VPC, allowing Cloud Run to reach Cloud SQL and Memorystore via their private, internal IP addresses. This setup preserves security by keeping all traffic inside your VPC and avoids public exposure of resources.

Why this answer

Cloud Run is a serverless compute platform that runs in a Google-managed VPC, not the customer's VPC. To access private resources like Cloud SQL and Memorystore (Redis) within a customer VPC, you must configure a Serverless VPC Access connector. This connector bridges the serverless environment to the specified VPC, enabling private, internal IP communication without public internet exposure.

Exam trap

Google Cloud often tests the misconception that serverless services like Cloud Run can natively reach VPC resources without explicit configuration, or that VPC Service Controls provide connectivity rather than security boundaries.

How to eliminate wrong answers

Option A is wrong because VPC Service Controls are a security perimeter mechanism that prevents data exfiltration, not a connectivity method for Cloud Run to reach VPC resources. Option C is wrong because assigning external IPs to Cloud SQL and Memorystore would expose them to the public internet, violating the requirement for no public IP connectivity and introducing security risks. Option D is wrong because Cloud Run does not automatically connect to VPC resources; it runs in a Google-managed network and requires explicit configuration (e.g., Serverless VPC Access or Direct VPC) to access private VPC resources.

8
MCQmedium

A company wants to use Cloud Run to deploy a containerized API that requires up to 8 GB of memory per request. The API experiences unpredictable traffic spikes. They want to minimize cost while ensuring fast cold starts. Which configuration should they use?

A.Use Cloud Run jobs instead of Cloud Run service
B.Deploy the container to GKE Autopilot with a single pod
C.Set max-instances to a high number and min-instances to 0 with CPU always allocated
D.Set min-instances to 1 and max-instances to a value that handles peak traffic with CPU throttled
AnswerD

Setting min-instances to 1 keeps one container instance always warm, eliminating the cold start for the first request after idle periods. A max-instances value calibrated to peak traffic caps both concurrent capacity and monthly cost, preventing unbounded scaling. CPU throttled (the default) charges only for CPU time used while processing requests, so the idle warm instance costs nothing for CPU, making this configuration both cost-effective and responsive to unpredictable traffic spikes.

Why this answer

Cloud Run supports up to 8 GB memory per container (as of 2024). Setting min-instances to a small number (e.g., 1) reduces cold starts, while max-instances limits costs during spikes. CPU boost can also speed up cold starts.

Using CPU always allocated increases costs, so CPU throttled (default) is fine. The question emphasizes cost minimization, so setting a minimal min-instances is appropriate.

9
MCQmedium

An engineer needs to allow HTTP traffic from the internet to a set of Compute Engine instances that have the network tag 'web-server'. The instances are in a VPC with a default firewall rule that denies all ingress. Which command creates the required firewall rule?

A.gcloud compute firewall-rules create allow-http --allow tcp:80 --source-tags web-server
B.gcloud compute firewall-rules create allow-http --allow tcp:80 --source-ranges web-server
C.gcloud compute firewall-rules create allow-http --allow http --target-tags web-server
D.gcloud compute firewall-rules create allow-http --allow tcp:80 --source-ranges 0.0.0.0/0 --target-tags web-server
AnswerD

This command correctly opens inbound TCP port 80 to traffic from any IPv4 address (0.0.0.0/0) and applies the rule only to VM instances tagged with 'web-server', matching the requirement precisely. The combination of --source-ranges 0.0.0.0/0 for internet sources and --target-tags web-server to scope the rule to the intended backend VMs is the standard way to allow HTTP in GCP. No other flags are needed, and the protocol:port syntax 'tcp:80' is accurately specified.

Why this answer

The rule must allow TCP port 80 from source 0.0.0.0/0 to instances with target tag 'web-server'. The correct command uses '--allow tcp:80', '--source-ranges 0.0.0.0/0', and '--target-tags web-server'. Priority can be default (1000).

10
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.

11
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.

12
MCQeasy

What is the correct order of the Google Cloud resource hierarchy from highest to lowest level?

A.Folder → Organization → Project → Resources
B.Organization → Folder → Project → Resources
C.Project → Folder → Organization → Resources
D.Organization → Project → Folder → Resources
AnswerB

This is the canonical Google Cloud resource hierarchy: Organization is the root node, Folders provide an intermediate grouping layer, Projects are the containers for resources, and individual Resources (VMs, buckets, etc.) live inside Projects. IAM policies and other settings are inherited downward from each ancestor to its descendants, so placing Projects under Folders and Folders under the Organization enables a clean policy and billing structure.

Why this answer

The Google Cloud resource hierarchy is structured from highest to lowest as Organization, Folder, Project, and Resources. The Organization node is the root, allowing centralized policy management; Folders group projects under departments or teams; Projects are the base-level containers for services and APIs; Resources (like Compute Engine instances) reside within projects. Option B correctly reflects this top-down inheritance of IAM policies and access control.

Exam trap

The trap here is that candidates often confuse the hierarchy with a typical filesystem tree, mistakenly thinking Projects are the top level, but the Organization node is the root that enables enterprise-grade policy control.

How to eliminate wrong answers

Option A is wrong because it places Folder above Organization, but the Organization is the top-level node in the hierarchy, not a Folder. Option C is wrong because it reverses the order, placing Project above Folder and Organization, whereas Projects are always children of Folders or the Organization. Option D is wrong because it places Project above Folder, but Folders are a higher-level grouping mechanism that can contain multiple projects, so the correct order is Organization → Folder → Project → Resources.

13
MCQmedium

A company wants to set up a hybrid network between their on-premises data center and Google Cloud. They need a highly available VPN connection with 99.99% SLA. Which VPN solution should they choose?

A.Classic VPN
B.HA VPN
C.Cloud Interconnect
D.Cloud NAT
AnswerB

HA VPN uses two external IP addresses and two tunnels to the same on-premises peer, and when paired with two on-premises VPN gateways, it achieves a 99.99% SLA. It relies on BGP to automatically fail over if one tunnel or gateway becomes unavailable, providing true high availability and making it the correct choice here.

Why this answer

HA VPN offers a 99.99% SLA (with certain conditions) when configured with two interfaces and two tunnels to two on-premises VPN gateways. Classic VPN does not provide an SLA.

14
MCQmedium

An organization needs to separate development, staging, and production environments using the GCP resource hierarchy. Which approach is most effective?

A.Create folders for dev, staging, and prod under the organization, then place projects in each folder
B.Use labels on projects to denote environment, but keep all in one folder
C.Create separate projects for each environment without folders
D.Create a single project and use separate VPC networks per environment
AnswerA

Folders in the Google Cloud resource hierarchy allow you to organize projects under the organization node, and you can apply IAM policies and organization policies at the folder level, which are inherited by all projects within. This gives you a natural separation between dev, staging, and prod while enabling consistent controls, e.g., different approval workflows or network configurations. Placing projects in environment-specific folders is the standard best practice for multi-environment governance.

Why this answer

Using folders under the organization node allows isolating environments, and organization policies can be applied at the folder level for governance.

15
Multi-Selectmedium

An engineer wants to create a VPC with a custom subnet mode and then create a subnet with Private Google Access enabled. Which two commands should they use? (Choose TWO.)

Select 2 answers
A.gcloud compute networks subnets create my-subnet --network my-vpc --region us-central1 --range 10.0.0.0/24 --enable-private-ip-google-access
B.gcloud compute networks create my-vpc --subnet-mode custom
C.gcloud compute networks subnets create my-subnet --network my-vpc --region us-central1 --range 10.0.0.0/24
D.gcloud compute firewall-rules create allow-http --allow tcp:80
E.gcloud compute networks create my-vpc --subnet-mode auto
AnswersA, B

This command explicitly creates a subnet in a custom mode VPC (assuming the VPC already exists) and enables Private Google Access, allowing instances in that subnet to reach Google APIs and services through their internal IP addresses without needing a NAT or external IP. In a custom mode VPC, you must create each subnet manually, and this command defines the region and IP range, making it a required step after the VPC is created. Without this flag, the subnet would lack the Private Google Access capability, which is often a prerequisite for workloads that should reach Google services without public IPs.

Why this answer

To create a custom mode VPC, use 'gcloud compute networks create' with '--subnet-mode custom'. Then add a subnet with 'gcloud compute networks subnets create' including '--enable-private-ip-google-access'. The other commands are incorrect: one creates an auto mode VPC, another is for firewall rules.

16
MCQmedium

Your company uses BigQuery for analytics. Users frequently run queries against a large, date-partitioned table containing sales data. The table has 10 TB of data and is partitioned by the 'order_date' column. Queries often filter on the 'customer_id' and 'region' columns in addition to the date range. You observe that queries are slow and expensive, even when scanning only a few partitions. Which optimization should you implement first?

A.Enable clustering on the 'customer_id' and 'region' columns.
B.Create materialized views for common queries.
C.Create views for each combination of filters.
D.Change partitioning to use ingestion time instead of 'order_date'.
AnswerA

Enabling clustering on 'customer_id' and 'region' physically sorts the data by these columns within each storage block, allowing BigQuery to use block-level metadata to prune blocks that cannot match the filter predicates. Because typical ad-hoc queries filter on these exact columns, cluster pruning drastically reduces the number of bytes scanned and therefore query cost and latency. Clustering is ideal for high-cardinality columns like customer_id, whereas partitioning would be impractical at that granularity. Placing the most selective or frequently filtered column (customer_id) first in the clustering key maximizes this pruning.

Why this answer

Clustering on 'customer_id' and 'region' organizes the data within each partition based on these filter columns, allowing BigQuery to perform block-level pruning and skip irrelevant data even when scanning only a few partitions. This directly addresses the slowness and cost by reducing the amount of data read per query, without requiring additional storage or maintenance overhead.

Exam trap

Google Cloud often tests the misconception that partitioning alone is sufficient for all filter optimization, but the trap here is that clustering is needed to optimize queries that filter on non-partition columns within already-selected partitions.

How to eliminate wrong answers

Option B is wrong because materialized views precompute and store query results, which can speed up repeated queries but do not optimize the underlying data layout for arbitrary filters on 'customer_id' and 'region'; they also incur storage costs and maintenance complexity. Option C is wrong because creating views for each combination of filters does not reduce the amount of data scanned—views are just saved queries and do not change how BigQuery reads the underlying table; this approach would be impractical and offer no performance benefit. Option D is wrong because changing partitioning to ingestion time (e.g., _PARTITIONTIME) would not improve query performance for filters on 'customer_id' and 'region'; it would only change how partitions are defined, and since queries already filter on 'order_date', the current partitioning is appropriate—ingestion time partitioning is typically used when no natural date column exists.

17
MCQhard

You need to set an organization policy that prevents any project from creating Cloud SQL instances with a public IP address. The constraint you need is `sql.restrictPublicIp`. What type of constraint is this, and how do you enable it?

A.List constraint — add `CLOUD_SQL_INSTANCE` to the `deniedValues` list.
B.Boolean constraint — set `enforce: true` in the organization policy.
C.Custom constraint — define a CEL expression that evaluates the Cloud SQL instance's IP configuration.
D.List constraint — add `0.0.0.0/0` to the `deniedValues` list.
AnswerB

The `sql.restrictPublicIp` constraint is a boolean organization policy constraint, meaning it only has two states: enforced or not enforced. Setting `enforce: true` on this policy at the desired folder, project, or organization level actively blocks the assignment of public IPv4 addresses to any matching Cloud SQL instances within that scope. This is the native, supported mechanism for prohibiting public IP exposure and requires no additional values or expressions.

Why this answer

`sql.restrictPublicIp` is a boolean constraint in Google Cloud Organization Policies. Boolean constraints have a simple `enforce: true` or `enforce: false` setting, and setting it to `true` prevents projects from creating Cloud SQL instances with public IP addresses. This is the standard method to enforce this restriction across the organization.

Exam trap

The trap here is that candidates confuse boolean constraints with list constraints, thinking they need to specify denied values like IP ranges, when in fact the boolean constraint simply toggles enforcement on or off.

How to eliminate wrong answers

Option A is wrong because `sql.restrictPublicIp` is not a list constraint; list constraints use `deniedValues` or `allowedValues` lists for resources like allowed external IPs, but this constraint is boolean. Option C is wrong because custom constraints require a CEL expression and are used for policies not covered by built-in constraints, but `sql.restrictPublicIp` is a built-in boolean constraint, so no custom definition is needed. Option D is wrong because adding `0.0.0.0/0` to `deniedValues` is a list constraint approach for VPC firewall rules or similar, not for Cloud SQL public IP restriction, and the constraint type is boolean, not list.

18
MCQmedium

A team is creating a new GCP project for a sensitive workload. They need to ensure the project is linked to the correct billing account, placed in the correct folder, and has specific APIs enabled — all reproducibly. They want to automate this via Infrastructure as Code. Which approach is most appropriate?

A.Use a gcloud script with `gcloud projects create`, `gcloud beta billing projects link`, and `gcloud services enable`.
B.Use Terraform with `google_project`, `google_project_service`, and billing account linkage resources.
C.Use Cloud Console to manually create the project, then document the steps in a runbook.
D.Use Cloud Deployment Manager with a Python template to create the project.
AnswerB

Terraform is the right choice because it provides a declarative, end-to-end project bootstrap in a single `terraform plan`/`apply` workflow. The `google_project` resource can specify the parent folder, billing account, and project name, while `google_project_service` entries enable required APIs such as compute.googleapis.com; Terraform's dependency graph automatically ensures the project exists and is linked to billing before services are enabled. Because Terraform stores real-world resource IDs in its state file, re-running apply after a manual change detects drift and either corrects it or surfaces a plan, making the whole process idempotent and auditable.

Why this answer

Terraform is an Infrastructure as Code (IaC) tool that allows you to define the entire project setup—including folder placement, billing account linkage, and API enablement—in declarative configuration files. This ensures reproducibility, version control, and automation, which aligns with the requirement for a sensitive workload that must be set up consistently every time.

Exam trap

Google Cloud often tests the distinction between imperative scripting (gcloud) and declarative IaC (Terraform), where candidates mistakenly choose gcloud because it seems simpler, but fail to recognize that reproducibility and state management are the key requirements for sensitive workloads.

How to eliminate wrong answers

Option A is wrong because while gcloud commands can create a project and link billing, a script is imperative and less reproducible than declarative IaC; it also lacks built-in state management and drift detection, making it error-prone for sensitive workloads. Option C is wrong because manually creating the project via Cloud Console and documenting steps in a runbook is not automated and introduces human error, violating the reproducibility requirement. Option D is wrong because Cloud Deployment Manager, while capable of IaC, is a Google-specific tool that is less portable and has a smaller community compared to Terraform; it also requires Python templates, adding complexity without the multi-cloud benefits of Terraform.

19
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.

20
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.

21
MCQmedium

A company wants to monitor the CPU utilization of their Compute Engine instances and receive an alert if utilization exceeds 80% for 5 minutes. Which services should they combine?

A.Cloud Functions and Cloud Tasks.
B.Cloud Audit Logs and Cloud Storage.
C.Cloud Monitoring and Cloud Pub/Sub.
D.Cloud Logging and Cloud Functions.
AnswerC

Cloud Monitoring directly collects CPU utilization from Compute Engine via built-in hypervisor metrics or the Ops Agent, and supports alerting policies with conditions like CPU threshold violations. Cloud Pub/Sub acts as a fully managed notification channel that receives alert messages, enabling fan-out to multiple subscribers or triggering downstream automation. Together they deliver the metric-observation layer and a scalable event-delivery mechanism for alert notifications.

Why this answer

Cloud Monitoring collects CPU utilization metrics from Compute Engine instances and can evaluate them against a threshold-based alerting policy. When the condition (CPU > 80% for 5 minutes) is met, the alert fires and sends a notification to a Cloud Pub/Sub topic, which can then trigger downstream actions such as sending emails or invoking serverless functions. This combination provides the metric ingestion, alert evaluation, and event-driven notification pipeline required for the use case.

Exam trap

Google Cloud often tests the distinction between logging (Cloud Logging) and monitoring (Cloud Monitoring) — the trap here is that candidates confuse log-based metrics with native system metrics, assuming Cloud Logging can evaluate CPU thresholds when it can only parse log entries, not numeric time-series data.

How to eliminate wrong answers

Option A is wrong because Cloud Functions and Cloud Tasks are serverless compute and task orchestration services, not designed for metric collection or threshold-based alerting; they lack native monitoring of CPU utilization. Option B is wrong because Cloud Audit Logs record administrative actions and access events, not system metrics like CPU utilization, and Cloud Storage is an object store with no alerting capability for real-time metrics. Option D is wrong because Cloud Logging ingests log data, not time-series metrics, and Cloud Functions alone cannot evaluate metric thresholds over a sliding window; the alerting logic must be handled by Cloud Monitoring's alerting policies.

22
MCQmedium

A GCP project needs to allow outbound internet access from VMs that have only private IP addresses, without exposing those VMs to inbound internet traffic. Which GCP service provides this?

A.Cloud VPN connecting the VPC to the internet
B.Cloud NAT configured on the VPC's Cloud Router
C.A VPC firewall rule allowing egress to 0.0.0.0/0 on all ports
D.An internal load balancer with internet routing enabled
AnswerB

Cloud NAT, configured on a Cloud Router in the VPC, provides outbound-only internet connectivity by translating the private IPs of VMs to an external IP address pool owned by Google, while never accepting inbound connections initiated from the internet. Because the VMs retain no public IP address, they remain protected from unsolicited inbound traffic, and the Cloud Router permits the NAT functionality to be shared across all privately addressed instances in the region. This is the standard GCP solution for allowing private instances to reach the internet for updates or external API calls.

Why this answer

Cloud NAT (Network Address Translation) is the correct service because it allows VMs with only private IP addresses to initiate outbound connections to the internet while preventing any inbound connections from the internet. It works by translating the private source IP addresses of outbound packets to a set of ephemeral public IP addresses managed by Google, using the VPC's Cloud Router to dynamically allocate NAT IPs and ports. This meets the requirement of outbound-only internet access without exposing the VMs to inbound traffic.

Exam trap

The trap here is that candidates confuse egress firewall rules (which only permit traffic to leave) with the need for a NAT gateway to provide a routable public source IP for return traffic, leading them to incorrectly select the firewall rule option.

How to eliminate wrong answers

Option A is wrong because Cloud VPN creates an encrypted tunnel to an on-premises network or another cloud, not to the public internet; it does not provide outbound internet access for private VMs. Option C is wrong because a VPC firewall rule allowing egress to 0.0.0.0/0 only permits traffic to leave the VPC, but without a public IP or NAT, the VMs have no routable source IP for internet responses to return, so outbound traffic fails. Option D is wrong because an internal load balancer operates within the VPC and does not provide internet routing; it distributes traffic among backend VMs but cannot translate private IPs to public ones for outbound internet access.

23
MCQeasy

A DevOps team notices that a Compute Engine instance running a critical application has been terminated unexpectedly. The team wants to ensure the instance restarts automatically if it stops. Which configuration should they use?

A.Configure a startup script that checks for termination and restarts the instance.
B.Set the 'On host maintenance' policy to 'Migrate VM instance'.
C.Enable the 'Automatic restart' flag on the instance template.
D.Create a firewall rule to allow health check traffic from the load balancer.
AnswerC

The 'Automatic restart' flag, when enabled on the instance template, instructs Compute Engine to automatically restart the VM if it terminates for a non-user-initiated reason, such as a system crash or a hardware failure. This is a managed platform feature that works at the hypervisor level, independent of the guest OS. It is the correct configuration to recover a single Compute Engine instance from unexpected termination.

Why this answer

Enabling the 'Automatic restart' flag on the instance template ensures that Compute Engine automatically restarts the VM if it terminates due to a non-user-initiated failure (e.g., hardware failure, system crash). This is the native mechanism for automatic recovery without requiring external scripts or manual intervention.

Exam trap

Google Cloud often tests the distinction between 'Automatic restart' (for infrastructure failures) and managed instance group autohealing (for application-level health), leading candidates to confuse the two or incorrectly choose a startup script as a restart mechanism.

How to eliminate wrong answers

Option A is wrong because a startup script runs only when the instance boots, but it cannot detect termination events or trigger a restart; it would require an external monitoring system to restart the VM, which is not a built-in Compute Engine feature. Option B is wrong because the 'On host maintenance' policy (Migrate VM instance) controls behavior during host maintenance events (e.g., live migration), not automatic restart after unexpected termination. Option D is wrong because firewall rules for health check traffic are used by load balancers to determine instance health, but they do not cause an instance to restart; they only allow or deny traffic.

24
MCQhard

An organization has multiple Google Cloud projects and wants to enforce a policy that all Compute Engine instances must use a specific set of approved machine types. Which tool should be used to implement this constraint?

A.Organization policies
B.IAM custom roles
C.VPC Service Controls
D.Cloud Scheduler
AnswerA

Organization policies allow hierarchical enforcement of constraints like allowed machine types.

Why this answer

Organization policies are used to enforce constraints across projects, folders, or the entire organization. The constraint 'compute.constraints.allowMachineTypes' can be set to restrict machine types. IAM roles control access, not resource configuration.

Cloud Scheduler is for cron jobs. VPC Service Controls is for data exfiltration prevention.

25
MCQhard

A GCP organization mandates that all new Cloud SQL instances must require SSL/TLS for connections. No exceptions are allowed. Which enforcement mechanism ensures this across all projects in the organization?

A.Rely on database administrators to manually enable SSL on each new Cloud SQL instance
B.Use Security Command Center to detect SSL-disabled instances and alert the team
C.Set a Cloud Monitoring alert for new Cloud SQL instances and auto-remediate via Cloud Functions
D.Apply the org policy constraint `constraints/sql.requireSsl` at the organization level to enforce SSL on all Cloud SQL instances
AnswerD

The organization policy constraint `constraints/sql.requireSsl` is a boolean constraint that, when enforced at the org level, applies to every project in the hierarchy and prevents Cloud SQL instances from being created (or updated) unless SSL is required. Because the Cloud SQL API checks this policy during instance creation and modification, it stops non-compliant configurations before they exist, covering instances created via Console, gcloud, API, or Terraform. This provides a centralized, deterministic enforcement mechanism that scales to the entire organization without requiring per-instance automation or human intervention. Setting this constraint at the organization level also ensures all future projects automatically inherit the requirement.

Why this answer

The organization policy constraint `constraints/sql.requireSsl` is a native, enforceable policy that can be applied at the organization level in GCP. Once set, it prevents the creation of any Cloud SQL instance that does not require SSL/TLS, and it also blocks any attempt to disable SSL on existing instances. This ensures 100% compliance across all projects without relying on manual intervention or reactive detection.

Exam trap

Google Cloud often tests the distinction between preventive controls (org policies) and detective/reactive controls (Security Command Center, Cloud Monitoring), and the trap here is that candidates choose a reactive option (B or C) thinking it 'enforces' compliance, when only a preventive org policy can block non-compliant resource creation entirely.

How to eliminate wrong answers

Option A is wrong because relying on manual enablement by database administrators is error-prone and violates the 'no exceptions' mandate; it does not enforce the policy programmatically. Option B is wrong because Security Command Center can only detect and alert on non-compliant instances after they are created, but it cannot prevent creation or enforce SSL; this is a detective control, not a preventive one. Option C is wrong because Cloud Monitoring alerts and Cloud Functions auto-remediation are reactive and can have a delay, allowing non-compliant instances to exist temporarily; they also cannot block the initial creation of an instance without SSL.

26
MCQeasy

You have pushed a new container image to Artifact Registry. The image is tagged `us-central1-docker.pkg.dev/my-project/my-repo/app:v2.0`. You need to deploy this specific image version to Cloud Run in production. Which command deploys this exact image?

A.`gcloud run deploy app --image us-central1-docker.pkg.dev/my-project/my-repo/app:v2.0 --region us-central1`
B.`gcloud run services update app --tag v2.0 --region us-central1`
C.`docker push us-central1-docker.pkg.dev/my-project/my-repo/app:v2.0` followed by a Cloud Run auto-deploy.
D.`gcloud run deploy app --image app:v2.0 --region us-central1`
AnswerA

This is the correct deployment command because it supplies the fully qualified Artifact Registry image URI, including the region (us-central1), project ID (my-project), repository name (my-repo), and the specific tag (v2.0). The --region flag independently sets the Cloud Run service region, ensuring the new revision is created in us-central1. This single command builds the container reference exactly as Cloud Run expects and immediately deploys it as a new revision of the existing 'app' service.

Why this answer

The `gcloud run deploy` command with the `--image` flag explicitly specifies the exact container image URI from Artifact Registry, including the tag `v2.0`. This ensures that Cloud Run deploys that precise version of the image, and the `--region` flag targets the correct regional service. The full URI is required because Cloud Run must pull the image from the exact repository path and tag.

Exam trap

Google Cloud often tests the requirement to use the full image URI (including registry, project, repository, and tag) versus a short name, and the misconception that `docker push` or service update commands can trigger a deployment directly.

How to eliminate wrong answers

Option B is wrong because `gcloud run services update` with `--tag` does not exist; the `--tag` flag is used with `gcloud run deploy` to assign a traffic tag, not to specify an image version. Option C is wrong because `docker push` only uploads the image to the registry; it does not trigger a Cloud Run deployment, and there is no automatic 'auto-deploy' mechanism unless a Cloud Build trigger is configured separately. Option D is wrong because `--image app:v2.0` is a relative reference that omits the full registry path (`us-central1-docker.pkg.dev/my-project/my-repo/`), which Cloud Run requires to locate the image in Artifact Registry; without the full URI, the command will fail or pull from the wrong source.

27
MCQmedium

A global web application serves static assets (images, JavaScript, CSS) from a Cloud Storage bucket via an HTTPS load balancer. Users in Asia report slow load times compared to users in the US where the bucket resides. What is the most effective solution?

A.Move the Cloud Storage bucket to a multi-region bucket in Asia
B.Enable Cloud CDN on the load balancer backend pointing to the Cloud Storage bucket
C.Replicate the Cloud Storage bucket to multiple regions using storage transfer
D.Use Cloud Interconnect to provide dedicated bandwidth to Asian users
AnswerB

Cloud CDN caches content at Google's global edge PoPs. Asian users receive cached assets from the nearest edge location, drastically reducing latency without changing the origin.

Why this answer

Enabling Cloud CDN on the load balancer backend that points to the Cloud Storage bucket caches static assets at Google's globally distributed edge caches. This reduces latency for Asian users by serving content from a nearby point of presence (PoP) rather than from the origin bucket in the US, without requiring any bucket relocation or replication.

Exam trap

Google Cloud often tests the misconception that moving or replicating storage to a closer region is the best way to reduce latency, when in fact edge caching (Cloud CDN) is the most effective and cost-efficient solution for static content served globally.

How to eliminate wrong answers

Option A is wrong because moving the bucket to a multi-region bucket in Asia does not solve the latency problem for users outside Asia; it only shifts the origin location, and multi-region buckets still serve from a single geographic set of regions, not from edge caches. Option C is wrong because replicating the bucket to multiple regions using storage transfer creates separate copies of data, but the load balancer would still need to route requests to the nearest bucket, which requires additional configuration (e.g., multi-region backend buckets or DNS-based routing) and does not provide the automatic edge caching benefits of Cloud CDN. Option D is wrong because Cloud Interconnect provides dedicated private connectivity between on-premises networks and Google Cloud, not between end users and Google Cloud; it does not improve latency for general internet users in Asia accessing a public web application.

28
MCQmedium

An infrastructure team uses Terraform to manage GCP resources including API enablement. Which Terraform resource enables a GCP API for a project, equivalent to `gcloud services enable`?

A.google_project_iam_binding with the serviceusage.services.enable permission
B.google_project_service with the desired service endpoint
C.google_service_account with enabled_services block
D.google_project with the services argument listing all required APIs
AnswerB

The google_project_service resource is the canonical way to enable a specific Google Cloud API for a project; it accepts the service's fully qualified endpoint, such as 'compute.googleapis.com' or 'sqladmin.googleapis.com'. When applied, it asynchronously activates that API and updates Terraform state only after the Service Usage API confirms the enablement. This resource also respects Terraform's dependency ordering, so resources that rely on an API can be deployed only after it is active. There is no other Terraform resource that directly performs API enablement for a project.

Why this answer

The `google_project_service` resource is the direct Terraform equivalent of `gcloud services enable`, as it explicitly enables a specified GCP service API for a given project. This resource takes the service endpoint (e.g., `compute.googleapis.com`) and handles the enablement lifecycle, including dependency tracking and disabling on destroy.

Exam trap

Google Cloud often tests the distinction between IAM permissions (who can enable APIs) and the actual API enablement action, leading candidates to confuse `google_project_iam_binding` with the correct resource for enabling services.

How to eliminate wrong answers

Option A is wrong because `google_project_iam_binding` manages IAM roles and permissions, not API enablement; the `serviceusage.services.enable` permission controls who can enable APIs, but the resource itself does not enable them. Option C is wrong because `google_service_account` creates and manages service accounts, and there is no `enabled_services` block in that resource — API enablement is unrelated to service account configuration. Option D is wrong because `google_project` does not have a `services` argument; API enablement is handled by the separate `google_project_service` resource, and listing services in the project resource would be invalid syntax.

29
MCQmedium

After deploying a Kubernetes Deployment named 'web-app', a developer wants to expose it externally on a static IP address. Which kubectl command should they use?

A.kubectl create service clusterip web-app --tcp=80:8080
B.gcloud compute forwarding-rules create web-app --port=80
C.kubectl expose deployment web-app --type=LoadBalancer --port=80 --target-port=8080
D.kubectl expose deployment web-app --type=NodePort --port=80
AnswerC

This is the correct approach because `kubectl expose deployment` with `--type=LoadBalancer` automatically creates a Kubernetes Service that instructs GKE to provision a cloud load balancer and allocate an external IP address. The `--port=80` specifies the Service port, while `--target-port=8080` directs traffic to the container's actual listening port on the Pod, matching the Deployment's container specification. If a reserved static IP is needed, you would reserve it in advance and add the `--load-balancer-ip` flag or annotate the Service; GKE then assigns that address to the load balancer.

Why this answer

kubectl expose creates a service. To get an external load balancer with a static IP, the service type must be LoadBalancer. The --type flag specifies the service type.

30
MCQmedium

A company is running a Cloud SQL for MySQL instance that experiences high read traffic. They want to offload read queries to reduce load on the primary instance. Which action should they take?

A.Enable automatic storage increase on the primary instance
B.Increase the machine type of the primary instance
C.Create one or more read replicas and direct read queries to them
D.Change the instance to use private IP only
AnswerC

Creating one or more read replicas and directing read-only queries to them is the correct architectural fix for offloading read traffic from the primary instance. Cloud SQL for MySQL read replicas are read-only copies that use asynchronous replication, so they can serve SELECTs without contending with the primary's write operations. This reduces the primary's CPU utilization by distributing the query workload across additional instances, and it is a standard pattern for scaling read-heavy applications.

Why this answer

Creating one or more read replicas allows you to offload read queries from the primary Cloud SQL for MySQL instance. Read replicas are asynchronous replicas that can serve read traffic, reducing load on the primary and improving overall read throughput. This is the correct approach for scaling read-heavy workloads without modifying the primary instance.

Exam trap

Google Cloud often tests the distinction between scaling up (increasing machine type) and scaling out (adding read replicas), where candidates mistakenly choose vertical scaling for read offloading instead of horizontal read replication.

How to eliminate wrong answers

Option A is wrong because enabling automatic storage increase only prevents out-of-disk errors by expanding storage, it does not offload read queries or reduce CPU/memory load from reads. Option B is wrong because increasing the machine type of the primary instance scales up the primary itself but does not offload read traffic; it may temporarily improve performance but does not distribute the read load. Option D is wrong because changing to private IP only affects network connectivity and security, not read query distribution or load reduction.

31
MCQmedium

A team deploys an application with sensitive internal APIs on GKE. The APIs should be reachable from other GKE services in the cluster and from on-premises systems via VPN, but not from the public internet. Which load balancer configuration meets this?

A.Global external Application Load Balancer with Cloud Armor blocking non-VPN IPs
B.Internal Application Load Balancer with a VPC-private IP
C.A ClusterIP Service with an external IP range allowlist
D.NodePort Service with VPC firewall rules restricting access to VPN IP ranges
AnswerB

An Internal Application Load Balancer receives a private RFC 1918 IP address from the VPC, making it reachable only from within the VPC or from connected networks via VPC peering, Cloud VPN, or Dedicated Interconnect. It never receives a public IP and can terminate HTTPS/HTTP traffic, apply managed SSL certificates, and route to backend services, providing a clean, fully private, and scalable endpoint for on-premises systems to consume an internal API.

Why this answer

An Internal Application Load Balancer (HTTP/HTTPS) with a VPC-private IP is correct because it exposes the APIs only within the VPC network, making them reachable from other GKE services in the cluster and from on-premises systems via VPN (which extends the VPC), while blocking all public internet traffic by design. This load balancer operates at Layer 7 and uses an internal IP address that is not routable from the internet, satisfying the requirement without relying on additional access controls.

Exam trap

Google Cloud often tests the misconception that a ClusterIP Service can be made externally accessible with an allowlist, but ClusterIP is strictly cluster-internal and cannot be reached from on-premises systems via VPN without additional components like a proxy or ingress.

How to eliminate wrong answers

Option A is wrong because a Global external Application Load Balancer is inherently internet-facing, and while Cloud Armor can block non-VPN IPs, the load balancer itself still has a public IP and is exposed to the internet, violating the requirement that APIs should not be reachable from the public internet. Option C is wrong because a ClusterIP Service is only reachable within the same Kubernetes cluster (not from on-premises systems via VPN) and does not support external IP range allowlisting; it has no external IP at all. Option D is wrong because a NodePort Service exposes the application on a high port on every node's external IP, and while VPC firewall rules can restrict access to VPN IP ranges, the service is still bound to the node's public IP addresses, making it reachable from the internet if the firewall is misconfigured or bypassed, and it does not provide Layer 7 load balancing.

32
MCQhard

A company has a Compute Engine instance in the us-west1 region that does not have a public IP address. The instance is part of a VPC network that has a Cloud NAT gateway configured in the us-east1 region. The Cloud NAT gateway is configured to allow all traffic from the VPC subnet. The VPC has a default route (0.0.0.0/0) pointing to the default internet gateway. Firewall rules allow all egress traffic. The instance is unable to download updates from the internet. What is the most likely cause of this problem?

A.The instance's firewall rules block egress traffic to port 80.
B.The Cloud NAT gateway is in a different region than the instance.
C.The instance's service account does not have the compute.instances.update permission.
D.The VPC does not have a route for the instance's subnet to the internet gateway.
AnswerB

Cloud NAT is strictly regional: each Cloud NAT gateway is attached to a specific region and only serves VM instances located in that same region. An instance in us-west1 cannot use a NAT gateway configured in, say, us-central1, even if it is in the same VPC network. This regional mismatch directly explains why outbound internet access fails, making it the correct answer.

Why this answer

Cloud NAT is regional. An instance in us-west1 cannot use a Cloud NAT gateway in us-east1 because NAT is only applied to instances in the same region. The instance's traffic destined for the internet is not translated, so it cannot reach external hosts without a public IP.

33
MCQmedium

A security review identifies that service account JSON key files are stored on multiple developer laptops, posing a data exfiltration risk. What is the recommended remediation?

A.Rotate the key files every 90 days and redistribute them securely
B.Encrypt the JSON key files using Cloud KMS before distributing
C.Remove the key files and use service account impersonation or Workload Identity for workloads that need GCP access
D.Store the key files in Secret Manager and retrieve them at application startup
AnswerC

The correct approach is to eliminate service account key files entirely. For workloads on GCE or GKE, attach a service account to the resource and let the metadata server provide OAuth2 tokens automatically; GKE can use Workload Identity to bind a Kubernetes service account to a Google service account. For external or on-premises workloads, configure Workload Identity Federation to exchange tokens from an external identity provider for short-lived GCP access tokens. This removes the risk of private key material being stolen and relies on IAM to define exactly which identities get which permissions.

Why this answer

Storing service account JSON key files on developer laptops creates a persistent credential that can be exfiltrated. The recommended remediation is to remove these static keys entirely and instead use service account impersonation (via the `iamcredentials.googleapis.com` API) or Workload Identity (for GKE or GCE workloads) to obtain short-lived access tokens. This eliminates the long-lived secret and follows Google's principle of using federated identity rather than distributing static keys.

Exam trap

Google Cloud often tests the misconception that moving a secret to a more secure storage (like Secret Manager or encryption) is sufficient, when the correct answer requires eliminating the static credential entirely through impersonation or workload identity federation.

How to eliminate wrong answers

Option A is wrong because rotating keys every 90 days does not address the fundamental risk of storing static credentials on laptops; the keys remain exfiltratable between rotations and still represent a persistent attack surface. Option B is wrong because encrypting the JSON key files with Cloud KMS does not remove the static credential from the laptop; the encrypted file still contains the key material that can be decrypted by anyone with access to the encryption key, and the distribution process remains a risk. Option D is wrong because storing the key files in Secret Manager and retrieving them at startup still requires the application to possess a long-lived static credential (the JSON key) at runtime, which can be exfiltrated from memory or disk; the goal is to eliminate the static key entirely, not just move its storage location.

34
MCQmedium

You have a managed instance group (MIG) with instances that need to run a startup script to configure monitoring agents. You created the instance template without a startup script. Which action should you take to add the startup script?

A.Use gcloud compute instances add-metadata to add the startup script to each running instance.
B.Delete the MIG and recreate it with a new template; you cannot change the template of an existing MIG.
C.Edit the existing instance template and add the startup script under 'metadata'.
D.Create a new instance template with the startup script, then update the MIG to use the new template via a rolling update.
AnswerD

The correct approach is to create a new instance template that includes the desired startup script in its metadata, then update the MIG to reference this new template using a rolling update. Since instance templates are immutable, creating a new template is mandatory. A rolling update (e.g., gcloud compute instance-groups managed rolling-action start-update) recreates the managed instances incrementally with the new template, ensuring the startup script executes during their boot. This method preserves availability and aligns with the MIG's declarative management model.

Why this answer

Instance templates are immutable; you cannot modify them. You must create a new instance template with the startup script and update the MIG to use it via rolling update or by setting the template.

35
MCQmedium

To meet compliance requirements, a company must encrypt all data at rest in Cloud SQL using customer-managed encryption keys (CMEK). What is required to enable CMEK on a Cloud SQL instance?

A.Specify the key during instance creation using --disk-encryption-key, and ensure the Cloud SQL service account has encryption/decryption permissions on the key
B.Create the instance without encryption, then use gcloud sql instances patch to add CMEK later
C.Enable CMEK by setting an organization policy that requires CMEK for all Cloud SQL instances
D.Use the default encryption; CMEK is not supported for Cloud SQL
AnswerA

For Cloud SQL, customer-managed encryption keys (CMEK) must be supplied at the moment you create the instance. You specify the key with the --disk-encryption-key flag in the gcloud sql instances create command, and the Cloud SQL service account must be granted Cloud KMS CryptoKey Encrypter/Decrypter permissions so it can use the key to encrypt data at rest. If these permissions are missing, instance creation fails; the key cannot be retroactively attached to an existing instance because the encryption setting is immutable.

Why this answer

When creating the Cloud SQL instance, you must specify a Cloud KMS key using the --disk-encryption-key flag. The Cloud SQL service account must be granted the Cloud KMS CryptoKey Encrypter/Decrypter role. The key must be in the same region as the Cloud SQL instance.

36
MCQeasy

A company wants to run a stateless containerized web application that scales to zero when not in use. The application receives HTTP requests and must be billed only for the resources consumed during request processing. Which Google Cloud compute service is most appropriate?

A.Google Kubernetes Engine (GKE) Standard
B.Cloud Run
C.Cloud Functions
D.Compute Engine
AnswerB

Cloud Run is correct because it runs stateless container images on a fully managed, serverless platform that scales automatically from zero to thousands of instances based on HTTP traffic. You only pay for requests while the container is processing, and you don't manage servers or clusters, so a stateless containerized web application can be deployed with a single command.

Why this answer

Cloud Run is a serverless container platform that scales to zero and charges per request, CPU, and memory used during request processing. It is ideal for stateless HTTP-triggered workloads.

37
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.

38
MCQmedium

An organization needs to ensure that only images from their approved Container Registry (gcr.io/approved-project) can be deployed on GKE clusters in their organization. Which GCP control enforces this?

A.A VPC firewall rule blocking pulls from unauthorized registries
B.Binary Authorization with a policy requiring attestation from the approved registry
C.Cloud Armor rules blocking container pull requests from external sources
D.Manually reviewing all Docker images before deployment
AnswerB

Binary Authorization is a Google Cloud service that integrates with GKE to enforce deployment-time policy on container images. A policy can require that every image have a valid cryptographic attestation signed by a trusted authority, such as the approved registry, before the image is allowed to run on the cluster. If an image lacks the required attestation or the attestation fails verification, the deployment is denied. This provides automated, enforceable, and auditable control over which images can be deployed, directly addressing the need to block pulls/deployments from unauthorized registries.

Why this answer

Binary Authorization enforces deployment-time policies that require images to be signed by trusted authorities. By configuring a policy that requires attestations from the approved registry (gcr.io/approved-project), only images from that registry can be deployed on GKE clusters, directly meeting the requirement.

Exam trap

The trap here is that candidates confuse network-level controls (firewalls, Cloud Armor) with deployment-time policy enforcement, mistakenly believing that blocking network traffic to unauthorized registries is equivalent to restricting which images can be deployed.

How to eliminate wrong answers

Option A is wrong because VPC firewall rules control network traffic at layers 3 and 4 (IP/port), not application-layer operations like container image pulls; they cannot inspect the registry URL in a pull request. Option C is wrong because Cloud Armor is a web application firewall (WAF) that protects against HTTP/S attacks, not a mechanism to restrict container image sources; it operates at the edge, not on GKE node-to-registry traffic. Option D is wrong because manual review is a procedural control, not a GCP technical control; it is error-prone, unscalable, and does not provide automated enforcement at deployment time.

39
MCQhard

An engineer needs to migrate a large on-premises database to Cloud SQL for PostgreSQL. The database is 500 GB and can tolerate a few hours of downtime. The migration must minimize manual intervention. Which approach should the engineer use?

A.Use Database Migration Service (DMS)
B.Use pg_dump to export and pg_restore to import
C.Use gcloud sql import to import a dump file
D.Set up a Compute Engine instance to run pg_dump and then gcloud sql import
AnswerA

Database Migration Service (DMS) is a fully managed service that automates the entire migration process, including a one-time full load followed by continuous change data capture (CDC) from the source database. This approach keeps the on-premises database online and synchronized during the migration, so you can cut over with minimal downtime. For a large database, DMS handles the heavy lifting of snapshotting and applying changes without needing to manually create or transfer dump files.

Why this answer

Database Migration Service supports homogeneous migrations (including PostgreSQL to Cloud SQL) and automates the process. It supports continuous replication and minimal downtime. The others are not ideal: pg_dump requires manual steps and downtime; gcloud sql import is for file import; Compute Engine with pg_dump involves manual steps.

40
MCQmedium

A company is migrating a legacy monolithic application to Google Cloud. The application has unpredictable traffic patterns and long-running connections. The team wants to minimize operational overhead and only pay for resources when the application is processing requests. Which compute option should they choose?

A.Google Kubernetes Engine (GKE) Autopilot cluster
B.Compute Engine with managed instance groups and autoscaling
C.Google Kubernetes Engine (GKE) Standard cluster with node autoscaling
D.Cloud Run
AnswerD

Cloud Run runs stateless containers in a fully managed environment that scales from zero to the number of concurrent requests and bills only for the CPU, memory, and requests consumed during a request. There is no infrastructure to provision, no idle capacity to pay for, and the platform enforces a request deadline, making it ideal for an HTTP-driven legacy application with unpredictable traffic. Its per-request billing and automatic scaling mean you pay nothing when the service is not being called.

Why this answer

Cloud Run is a serverless compute platform that scales to zero when not in use, has a per-request billing model, and supports HTTP-triggered container workloads. It can handle long-running connections as long as they stay within the request timeout limit. Cloud Run minimizes operational overhead by eliminating server management and scaling automatically.

41
MCQhard

A GKE cluster hosts multiple teams' workloads in separate namespaces. One team's pods should not be able to make API calls to Google Cloud services (e.g., they should not call BigQuery or Cloud Storage). The pods currently use the node's service account via the Compute Engine metadata server. How do you restrict these specific pods from accessing GCP APIs while allowing other pods on the same node to continue using GCP APIs?

A.Apply a Kubernetes NetworkPolicy in the team's namespace blocking egress to `169.254.169.254` (the metadata server).
B.Revoke all IAM roles from the node's service account.
C.Set `automountServiceAccountToken: false` on the restricted team's pods.
D.Use a Kubernetes ResourceQuota to limit the team's namespace API access.
AnswerA

This is correct. A Kubernetes NetworkPolicy with an egress rule denying traffic to 169.254.169.254 blocks pods in the namespace from reaching the metadata server. Since GCP credentials for the node's service account are obtained from that server's token endpoint, the pods cannot retrieve GCP API access tokens. Other namespaces without this NetworkPolicy remain unaffected, satisfying the restriction requirement.

Why this answer

The Compute Engine metadata server (169.254.169.254) is the endpoint that provides the node's service account credentials to pods. By applying a Kubernetes NetworkPolicy that blocks egress to this IP in the team's namespace, you prevent those pods from reaching the metadata server, thus denying them access to GCP APIs. Other pods on the same node are unaffected because NetworkPolicy is namespace-scoped and does not apply to them.

Exam trap

Google Cloud often tests the misconception that `automountServiceAccountToken: false` blocks all cloud API access, but it only affects the Kubernetes API token, not the Compute Engine metadata server which provides cloud credentials.

How to eliminate wrong answers

Option B is wrong because revoking all IAM roles from the node's service account would block ALL pods on that node from accessing GCP APIs, not just the restricted team's pods. Option C is wrong because setting `automountServiceAccountToken: false` only prevents the Kubernetes API service account token from being mounted into the pod; it does not affect the pod's ability to reach the Compute Engine metadata server to obtain the node's service account credentials. Option D is wrong because a ResourceQuota limits resource consumption (CPU, memory, etc.) and cannot restrict network access to specific IP addresses or APIs.

42
MCQeasy

A Compute Engine VM's boot disk is nearly full and the application is failing. You want to snapshot the disk first (for safety), then resize it online. What is the correct sequence of gcloud commands?

A.Stop the VM, resize the disk, take a snapshot, restart the VM.
B.Snapshot the disk, resize the disk with `gcloud compute disks resize`, then grow the filesystem within the VM.
C.Resize the disk with `gcloud compute instances set-disk-auto-delete` to automatically expand the disk.
D.Create a new larger disk, attach it as a secondary disk, and move data using rsync.
AnswerB

This sequence safely grows the existing boot disk without downtime. First, snapshot the disk to preserve a rollback point; then run `gcloud compute disks resize <DISK> --size=<NEW_SIZE>` — the resize can happen while the instance is running; finally, inside the VM, extend the partition if needed and grow the filesystem using `resize2fs` for ext4 or `xfs_growfs` for XFS. Only after the filesystem grows will the application see additional free space.

Why this answer

You must snapshot the disk first to ensure data safety before making changes, then resize the disk using `gcloud compute disks resize` (which works on a running VM with live resize enabled), and finally grow the filesystem inside the VM to utilize the additional space. This sequence avoids downtime and preserves a recovery point.

Exam trap

The trap here is that candidates assume a VM must be stopped before resizing a boot disk, but Google Cloud supports live resize for most disk types, making the snapshot-then-resize-then-grow sequence the correct online approach.

How to eliminate wrong answers

Option A is wrong because stopping the VM is unnecessary for a live resize and introduces downtime; also, taking the snapshot after resizing would capture the resized disk, not the original state for safety. Option C is wrong because `gcloud compute instances set-disk-auto-delete` controls whether a disk is deleted when the instance is deleted, not disk resizing or expansion. Option D is wrong because creating a new disk and using rsync is a valid migration approach but is not the correct sequence for resizing an existing boot disk online as specified in the question.

43
MCQhard

You are managing a Cloud Functions deployment that processes messages from a Pub/Sub topic. You need to ensure the function can read messages from the topic and acknowledge them. Which IAM role should you assign to the function's service account?

A.roles/pubsub.publisher
B.roles/pubsub.subscriber
C.roles/pubsub.viewer
D.roles/iam.serviceAccountUser
AnswerB

The Pub/Sub Subscriber role (roles/pubsub.subscriber) is the correct, least-privileged role for a Cloud Functions trigger. It includes the permissions needed to pull messages (pubsub.subscriptions.consume) and acknowledge them after processing (pubsub.subscriptions.acknowledge), which is exactly what the function's runtime service account must do to read and complete each message from its subscription.

Why this answer

The Pub/Sub Subscriber role (roles/pubsub.subscriber) grants permission to pull messages and acknowledge them. The function's service account needs this role on the topic or subscription.

44
MCQeasy

An engineer needs to create a new GCP project using the Cloud SDK. They have already installed and initialized gcloud with a user account that has Billing Account Administrator and Project Creator roles. Which command creates the project 'my-new-project'?

A.gcloud config set project my-new-project
B.gcloud projects create my-new-project
C.gcloud alpha projects create my-new-project
D.gcloud init my-new-project
AnswerB

This is the canonical command for creating a new Google Cloud project via the CLI. It calls the Cloud Resource Manager projects.create API method, and requires the resourcemanager.projects.create permission (provided by the Project Creator IAM role). The command returns a project ID and number, and initially places the project in the 'ACTIVE' lifecycle state unless an organization policy restricts it. Use `--organization` or `--folder` flags to specify the parent resource.

Why this answer

The correct command to create a project is 'gcloud projects create'. It creates a new project with the specified ID.

45
MCQeasy

A developer wants to use Cloud Shell to create a Compute Engine VM but receives an error 'API not enabled'. What should the developer do first?

A.Switch to a different region
B.Enable the Compute Engine API
C.Use gcloud auth login
D.Increase project quota
AnswerB

Enabling the Compute Engine API for the project is the direct and correct fix. When running `gcloud compute instances create`, Cloud Shell invokes the Compute Engine service, which returns the error 'API [compute.googleapis.com] not enabled' if the API is not activated. You can enable it by executing `gcloud services enable compute.googleapis.com` in Cloud Shell with an authenticated, authorized user. Once enabled, the API becomes available project-wide, allowing VM creation to proceed.

Why this answer

The error 'API not enabled' indicates that the Compute Engine API has not been activated for the developer's Google Cloud project. Cloud Shell uses the gcloud CLI, which requires the Compute Engine API to be enabled before it can create VM instances. The correct first step is to enable the Compute Engine API via the Cloud Console or the `gcloud services enable compute.googleapis.com` command.

Exam trap

Google Cloud often tests the distinction between authentication (gcloud auth login) and API enablement, trapping candidates who confuse user-level permissions with project-level service activation.

How to eliminate wrong answers

Option A is wrong because switching regions does not enable the required API; the error is about API access, not regional availability. Option C is wrong because `gcloud auth login` authenticates the user but does not enable the API; the API must be enabled at the project level regardless of authentication. Option D is wrong because increasing the project quota addresses resource limits, not the fundamental requirement of having the API enabled; the API must be enabled before any quota increase would be relevant.

46
MCQeasy

An organization needs a NoSQL document database with real-time synchronization across multiple client devices. Which Google Cloud service should they use?

A.Firestore
B.Cloud SQL
C.Cloud Bigtable
D.Cloud Datastore
AnswerA

Firestore is a fully managed NoSQL document database that stores data in documents organized into collections. It provides built-in real-time synchronization through client-side listeners, automatically pushing updates to subscribed apps whenever data changes, making it ideal for live, collaborative applications. It also includes offline support and strong consistency, which are key differentiators for real-time use cases.

Why this answer

Firestore is a NoSQL document database that provides real-time listeners for syncing data across devices, making it ideal for mobile and web applications requiring live updates.

47
Multi-Selectmedium

An organization wants to enforce that all Compute Engine instances in a project use customer-managed encryption keys (CMEK) for their boot disks. Which TWO steps should the security team take?

Select 2 answers
A.Set an organization policy constraint that requires CMEK for Compute Engine disks
B.Specify the CMEK key in each instance template used for managed instance groups
C.Grant the Cloud KMS Admin role to the project's compute service account
D.Create a Cloud Audit Logs sink to monitor instances without CMEK
E.Grant the Cloud KMS CryptoKey Encrypter/Decrypter role to the Compute Engine service account
AnswersA, E

Setting an organization policy constraint (iam.disableServiceAccountKeyCreation is not relevant; here it's a custom constraint or the predefined compute.disableNestedVirtualization? Actually for CMEK, the relevant org policy is a custom constraint or the new `constraints/compute.requireCmek` that enforces CMEK on new Compute Engine disks at creation time. This is the only preventive control among the options because it blocks the disk-creation API call unless a valid CMEK key is supplied, making noncompliant instances impossible to create. It operates at the organization or folder level and is enforced by the resource manager before the Compute Engine API accepts the request.

Why this answer

To enforce CMEK, you can set an organization policy constraint (e.g., constraints/compute.requireCmek) to prevent creation of instances without CMEK. Additionally, you must grant the compute engine service account permission to use the KMS key so it can encrypt disks. Simply specifying the key in the instance template does not enforce the policy, and the Cloud KMS Admin role is too broad.

48
MCQmedium

A team wants to deploy a container image at 'gcr.io/myproject/api:v2' as a Cloud Run service named 'api-service' in us-east1, accessible without authentication. Which command is correct?

A.gcloud run deploy api-service --image=gcr.io/myproject/api:v2 --region=us-east1 --allow-unauthenticated
B.gcloud run create api-service --image=gcr.io/myproject/api:v2 --zone=us-east1 --public
C.gcloud cloud-run deploy api-service --container=gcr.io/myproject/api:v2 --region=us-east1
D.gcloud run deploy --name=api-service --image=gcr.io/myproject/api:v2 --region=us-east1 --no-auth
AnswerA

This is the correct syntax for deploying a Cloud Run service. The service name `api-service` is supplied positionally, `--image` points to the container image `gcr.io/myproject/api:v2`, `--region` selects the deployment region, and `--allow-unauthenticated` grants public access by binding the `roles/run.invoker` role to `allUsers`. This makes the service reachable via HTTP without requiring authentication credentials, which is the typical requirement for an external API.

Why this answer

It uses the `gcloud run deploy` command with the `--image` flag to specify the container image, `--region=us-east1` to target the correct region, and `--allow-unauthenticated` to make the service publicly accessible without authentication. This matches the exact requirements for deploying a Cloud Run service with public access.

Exam trap

Google Cloud often tests the distinction between `gcloud run deploy` and `gcloud run create`, and the use of `--allow-unauthenticated` versus `--no-auth`, to catch candidates who confuse command syntax or flag names.

How to eliminate wrong answers

Option B is wrong because `gcloud run create` is not a valid command; the correct command is `gcloud run deploy`. Additionally, Cloud Run uses `--region` (not `--zone`) and `--allow-unauthenticated` (not `--public`). Option C is wrong because `gcloud cloud-run deploy` is not a valid command (the correct service is `gcloud run deploy`), and `--container` is not a valid flag for `gcloud run deploy`; the correct flag is `--image`.

Option D is wrong because `--no-auth` is not a valid flag; the correct flag to allow unauthenticated access is `--allow-unauthenticated`.

49
MCQeasy

The company wants to change the storage class of these log files to Nearline to reduce costs while still retaining the ability to access them without restoration fees. Which command should be used?

A.gsutil cp -s NEARLINE gs://my-bucket/logs/*.log
B.gsutil rewrite -s NEARLINE gs://my-bucket/logs/*.log
C.gsutil setmeta -s NEARLINE gs://my-bucket/logs/*.log
D.gsutil mv -s NEARLINE gs://my-bucket/logs/*.log
AnswerB

`gsutil rewrite -s NEARLINE gs://my-bucket/logs/*.log` is the correct command because it performs a server-side rewrite of each log object, replacing the object's storage class with NEARLINE while preserving the exact same object URI, generation, and content. The rewrite operation is designed specifically to update immutable properties like storage class or encryption key in place, without a local download/upload cycle or creating a duplicate object. For the task of changing storage class on multiple existing logs, this is the only option that directly and safely updates the original objects.

Why this answer

The `gsutil rewrite` command is specifically designed to change the storage class of existing objects without incurring restoration fees. It rewrites the object metadata to the new storage class (Nearline) while keeping the object in place, and the operation does not require retrieving the object from cold storage, so no restoration charges apply.

Exam trap

The trap here is that candidates confuse `gsutil rewrite` with `gsutil cp` or `gsutil mv`, assuming any command with `-s` can change storage class, but only `rewrite` avoids restoration fees by modifying the object in place without creating a new copy.

How to eliminate wrong answers

Option A is wrong because `gsutil cp` copies objects, which would create new objects with the Nearline storage class but leave the original objects unchanged, resulting in duplicate objects and unnecessary costs. Option C is wrong because `gsutil setmeta` is used to set custom metadata on objects, not to change the storage class; the `-s` flag is not valid for this command. Option D is wrong because `gsutil mv` moves objects, which effectively copies and then deletes the original, incurring restoration fees if the original is in a cold storage class like Nearline, and it does not change the storage class of the existing object in place.

50
MCQmedium

Your application is deployed on GKE and experiencing increased latency. You suspect a memory leak causing the JVM to run frequent garbage collection cycles. Cloud Monitoring shows high memory usage but you need to understand the garbage collection behavior over time. Which GCP tool provides JVM-level profiling including memory allocation data?

A.Cloud Trace
B.Cloud Profiler with heap profiling enabled for the JVM application.
C.Cloud Monitoring with JVM MBeans metrics exported via the Ops Agent.
D.Error Reporting filtered for OutOfMemoryError exceptions.
AnswerB

Cloud Profiler with heap profiling samples every JVM object allocation and attributes each one to the exact call stack at the allocation site, turning 'memory is growing' into 'this method allocates this type.' The profiler's overhead is minimal — around 1% CPU — so it can be left on in production until the leak manifests. Comparing two profile snapshots shows which allocation site is still increasing, pinpointing the leak's source directly.

Why this answer

Cloud Profiler with heap profiling enabled captures JVM-level memory allocation data and garbage collection behavior over time, allowing you to identify memory leaks and GC frequency. Unlike generic memory monitoring, it provides per-method allocation snapshots and GC pause analysis specific to the JVM.

Exam trap

Google Cloud often tests the distinction between metric-based monitoring (Cloud Monitoring with MBeans) and profiling (Cloud Profiler), where candidates mistakenly choose Cloud Monitoring because it shows memory usage, but it lacks the allocation-level detail needed to diagnose garbage collection behavior.

How to eliminate wrong answers

Option A is wrong because Cloud Trace is a distributed tracing tool for request latency analysis, not JVM memory profiling; it cannot show garbage collection or heap allocation data. Option C is wrong because Cloud Monitoring with JVM MBeans via the Ops Agent provides metric-based memory usage (e.g., heap usage) but lacks the detailed allocation profiling and GC cycle breakdown that Cloud Profiler's heap profiling offers. Option D is wrong because Error Reporting only aggregates application errors like OutOfMemoryError; it does not provide proactive profiling of memory allocation or garbage collection behavior over time.

51
MCQmedium

An organization wants to manage GCP resources for multiple teams using a hierarchy of folders and projects. They need to apply a uniform policy that restricts the regions where VM instances can be created across all projects in a folder. Which approach should they use?

A.Apply an organization policy with the `compute.allowedExternalIpAccess` constraint
B.Apply an organization policy with the `compute.restrictResourceCreation` constraint
C.Set an IAM policy on the folder that denies compute.instances.create permission in disallowed regions
D.Use gcloud config set compute/region and enforce with a script
AnswerC

Applying a folder-level IAM deny policy that denies compute.instances.create with a condition on resource.location is the correct approach because IAM conditions are evaluated at access time against the requested resource's attributes. You can specify that the request is denied unless resource.location is one of the allowed regions, and this applies to all projects in the folder. Deny policies override any allow bindings chain-wide, providing deterministic enforcement that works for Console, CLI, and API calls.

Why this answer

The correct approach uses IAM conditions to restrict resource creation based on location. While organization policies with the 'gcp.resource-locations' constraint are the recommended method, option C is the only valid choice among the given options. IAM policies on the folder with conditions can effectively deny compute.instances.create permission in disallowed regions, enforcing uniform control across all projects in the folder.

Exam trap

Candidates may confuse organization policy constraints with IAM policies. While organization policies are designed for such restrictions, IAM conditions can also achieve the same result.

52
MCQeasy

A user wants to estimate the monthly cost of running a Compute Engine VM with 8 vCPUs, 32 GB of memory, and a 100 GB persistent disk in us-central1 for one year. They plan to use the VM 24/7. Which tool should they use?

A.Google Cloud Pricing Calculator
B.Cloud Asset Inventory
C.Cloud Billing reports
D.Cloud Monitoring
AnswerA

The Google Cloud Pricing Calculator is the correct tool for estimating monthly costs before deployment. You can select specific Google Cloud products and configure parameters such as region, VM machine type, RAM, storage class, and committed usage discounts to generate a projected total. It accepts hypothetical inputs and even provides a machine configurator for GKE and Compute Engine, producing a line-itemized estimate suitable for budgeting and capacity planning.

Why this answer

The Google Cloud Pricing Calculator allows users to estimate costs for GCP services, including Compute Engine instances with specific machine types, persistent disks, and usage duration.

53
MCQhard

A developer is deploying a Cloud Function that processes messages from a Pub/Sub topic. The function takes 10 minutes to complete each message. The developer needs to ensure that messages are not lost if the function fails. Which Cloud Function generation and configuration should they use?

A.Cloud Functions (2nd gen) with an event-driven trigger from Pub/Sub and retry on failure
B.Cloud Functions (1st gen) with an HTTP trigger and a Pub/Sub push subscription
C.Cloud Functions (2nd gen) with an HTTP trigger
D.Cloud Functions (1st gen) with a background function and retry on failure
AnswerA

Cloud Functions (2nd gen) with an event-driven trigger from Pub/Sub and retry on failure is correct because 2nd gen functions are built on Eventarc and Cloud Run, which natively subscribe to Pub/Sub topics and invoke the function asynchronously when messages arrive. The 2nd gen runtime supports a maximum timeout of 60 minutes, comfortably covering the 10-minute processing window, and when combined with a retry policy, transient failures will cause the message to be redelivered without hitting a timeout ceiling.

Why this answer

Cloud Functions (2nd gen) supports longer timeouts (up to 60 minutes) and event-driven triggers like Pub/Sub with retries. 1st gen has a max timeout of 9 minutes. Retry on failure is configured in the subscription. Background functions are 1st gen.

54
MCQmedium

A DevOps team deploys a MIG (Managed Instance Group) with autohealing configured. The health check probes `/health` on port 8080 with a 30-second initial delay. After deployment, new VMs are failing the health check and being immediately recreated — causing a restart loop. What is the most likely cause?

A.The health check HTTP path `/health` doesn't exist — the application uses `/healthz`
B.The initial delay is too short — the application hasn't finished starting before the health check probes begin
C.Autohealing is incompatible with autoscaling — they cannot be used together
D.The MIG does not support HTTP health checks — TCP checks must be used instead
AnswerB

The health check's `initialDelaySec` defines how long the MIG waits after an instance boots before sending the first probe, giving the application time to initialize. If the app takes longer to start than the configured delay, the first probe appears while the port is still closed, the instance is marked unhealthy, and autohealing immediately terminates it — causing an endless recreate/restart loop. Raising `initialDelaySec` (for example to 60–90 seconds for a slow-starting JVM or Node process) breaks the loop by allowing the app to listen before being probed.

Why this answer

The 30-second initial delay is too short for the application to complete its startup sequence. When the health check begins probing before the application is ready, it immediately fails, causing the MIG autohealing mechanism to treat the VM as unhealthy and recreate it, leading to a restart loop. The initial delay must be set to a value that exceeds the application's typical startup time.

Exam trap

Google Cloud often tests the distinction between health check path errors (which cause persistent failure) and initial delay misconfiguration (which causes a restart loop), trapping candidates who focus on the path mismatch rather than the timing issue.

How to eliminate wrong answers

Option A is wrong because even if the health check path is incorrect, the VM would not be immediately recreated; instead, the health check would consistently fail, but the MIG would not enter a restart loop unless the application eventually becomes healthy after a restart, which is not the case here. Option C is wrong because autohealing and autoscaling are fully compatible in Google Cloud MIGs; they serve different purposes (health-based repair vs. load-based scaling) and can be used together without conflict. Option D is wrong because MIGs fully support HTTP health checks; TCP checks are an alternative but not a requirement, and the issue described is unrelated to the health check protocol.

55
MCQmedium

You need to list all projects in your organization using the gcloud CLI. Which command is correct?

A.gcloud compute projects list
B.gcloud config list
C.gcloud projects list
D.gcloud resource-manager projects list
AnswerC

gcloud projects list is correct: it calls the Cloud Resource Manager API (projects.list) and returns all projects that your authenticated account has permission to view, including those from your organization if you have the appropriate IAM roles. It supports flags like --filter, --limit, and --format to narrow and shape the output. This is the standard, documented command for enumerating projects.

Why this answer

'gcloud projects list' lists projects accessible to the authenticated user. To list all projects in an organization, you need the --filter or use organizations. But 'gcloud projects list' with appropriate permissions shows all projects.

The other commands are incorrect: 'gcloud config list' shows config, 'gcloud compute projects list' doesn't exist, 'gcloud resource-manager projects list' is not a command.

56
MCQeasy

Which IAM role should be granted to a user to allow them to create and manage secrets in Secret Manager?

A.roles/secretmanager.admin
B.roles/secretmanager.secretAccessor
C.roles/editor
D.roles/secretmanager.viewer
AnswerA

roles/secretmanager.admin is the correct choice because it grants the full set of Secret Manager permissions needed to create, update, and delete secrets, versions, and their IAM policies. It includes actions such as secretmanager.secrets.create, secretmanager.secrets.update, secretmanager.secrets.delete, and secretmanager.versions.add, allowing complete lifecycle management without granting unrelated service permissions.

Why this answer

roles/secretmanager.admin provides full control over secrets, including creation, deletion, and granting access. roles/secretmanager.secretAccessor only allows reading secret payloads. roles/editor is too broad and not specific. roles/viewer is read-only.

57
MCQmedium

A data science team needs a VM with 96 vCPUs and 624 GB of RAM. No predefined GCP machine type matches these exact specifications. What is the recommended approach?

A.Select the closest larger predefined N2 machine type
B.Create a custom machine type with exactly 96 vCPUs and 624 GB RAM
C.Split the workload across multiple smaller VMs and coordinate manually
D.Contact Google Cloud support to request a new predefined machine type
AnswerB

Custom machine types on N2 let you specify vCPU count and memory independently, with memory configurable in granular steps up to 8 GB per vCPU. Setting exactly 96 vCPUs and 624 GB RAM satisfies the workload's memory footprint without over-allocation, and you are billed only for those specific resources. This is the only option that precisely matches the stated requirement while avoiding the cost and waste of a larger predefined instance.

Why this answer

Google Cloud allows you to create custom machine types when predefined machine types do not meet your exact requirements. Custom machine types let you specify the exact number of vCPUs (up to 96) and memory (up to 624 GB) for a VM, providing flexibility without over-provisioning resources.

Exam trap

The trap here is that candidates may assume predefined machine types are the only option, overlooking the custom machine type feature that GCP provides for exact resource matching.

How to eliminate wrong answers

Option A is wrong because selecting the closest larger predefined N2 machine type would result in over-provisioning resources, leading to unnecessary costs and potential performance inefficiencies. Option C is wrong because splitting the workload across multiple smaller VMs introduces complexity, coordination overhead, and may not be feasible for workloads that require a single large memory address space or high vCPU count. Option D is wrong because Google Cloud does not create new predefined machine types on demand for individual requests; custom machine types are the designed solution for such scenarios.

58
MCQmedium

A new engineer joins the team and needs access to GCP. The company uses Google Workspace for identity management. The GCP admin needs to add the engineer and grant them access to one project. What is the correct order of steps?

A.Create a service account for the engineer in GCP, then share the key file
B.Create the user in Google Workspace Admin Console, then grant their account IAM roles on the GCP project
C.Create a GCP project for the engineer, then add their personal Gmail as a project owner
D.Create an API key for the engineer in the GCP Console and share it securely
AnswerB

Users are provisioned outside of GCP in the Google Workspace Admin Console (or Cloud Identity), which creates the user’s Google identity. Once that identity exists, you can grant IAM roles on the project, folder, or organization, giving the engineer access to the Console and APIs. This pattern enables centralized lifecycle management, SSO, MFA, and audit for corporate users, and it is the only correct way to create a human user for GCP access.

Why this answer

Google Workspace is the identity provider (IdP) for the organization, so the engineer must first be created as a user in the Google Workspace Admin Console. Once the user exists, the GCP admin can then grant IAM roles (e.g., roles/viewer, roles/editor) on the specific project, which maps the Workspace user identity to GCP permissions. This follows the principle that GCP IAM relies on existing identities from the Cloud Identity or Workspace domain, not on separate user creation within GCP.

Exam trap

Google Cloud often tests the misconception that GCP users are created inside the GCP Console itself, when in fact human identities must be provisioned through the organization's identity provider (Google Workspace or Cloud Identity) before they can be assigned IAM roles.

How to eliminate wrong answers

Option A is wrong because service accounts are intended for applications and automated workloads, not for human users; sharing a key file violates security best practices and does not provide proper identity-based access control. Option C is wrong because creating a new project for the engineer is unnecessary and wasteful; the engineer should be added to an existing project, and personal Gmail accounts are not part of the corporate Google Workspace domain, so they cannot be managed centrally. Option D is wrong because API keys are used to authenticate calls to GCP APIs for applications, not to grant human users access to the GCP Console or project resources; they lack identity context and cannot enforce IAM roles.

59
MCQhard

A company is designing a globally distributed application with a web tier and a database tier that requires low-latency communication within the same region but can tolerate eventual consistency across regions. The database must be fully managed and scale globally. Which combination of networking and database is most appropriate?

A.Global VPC with Cloud Spanner
B.Global VPC with Cloud Bigtable
C.VPC peering with Cloud SQL
D.Shared VPC with Cloud Datastore
AnswerB

Cloud Bigtable is a fully managed, highly scalable NoSQL wide-column database that is designed for low-latency, high-throughput operations and supports eventual consistency across replicas. It can be configured with multiple clusters in different regions, enabling global read and write access through a global VPC while remaining operationally simple and cost-effective. The data model and access patterns of a multi-tier application often align well with Bigtable's key-based lookups, making it the appropriate choice when strong relational semantics are not required.

Why this answer

Cloud Bigtable is a fully managed, globally scalable NoSQL database that provides low-latency access within a region and eventual consistency across regions, making it ideal for the described workload. A Global VPC allows the web and database tiers to communicate privately and with low latency within the same region, while Bigtable's native replication handles cross-region eventual consistency without application complexity.

Exam trap

Google Cloud often tests the distinction between strong consistency (Spanner) and eventual consistency (Bigtable) in globally distributed systems, and the trap here is assuming that 'fully managed and scale globally' always means Spanner, ignoring the explicit requirement for eventual consistency.

How to eliminate wrong answers

Option A is wrong because Cloud Spanner offers strong consistency across regions, not eventual consistency, and its global synchronous replication adds latency and cost that are unnecessary for a system that tolerates eventual consistency. Option C is wrong because Cloud SQL is a regional database that does not scale globally or support cross-region replication for eventual consistency, and VPC peering does not create a single global network for low-latency intra-region communication. Option D is wrong because Cloud Datastore (Firestore in Datastore mode) is a regional NoSQL database that does not natively support global scaling with eventual consistency across regions, and Shared VPC is designed for multi-project networking within an organization, not for global low-latency communication.

60
MCQmedium

You need to prevent developers from creating Compute Engine VMs with external IP addresses in a specific folder. Developers must still be able to create VMs with internal IPs only. Which org policy constraint enforces this?

A.Create a VPC firewall rule blocking all outbound internet traffic.
B.Apply the `compute.vmExternalIpAccess` org policy constraint set to deny all VMs.
C.Remove the `compute.instanceAdmin` role from developers so they cannot configure network interfaces.
D.Configure the default VPC network to use internal-only routes.
AnswerB

The `compute.vmExternalIpAccess` organization policy constraint is a list constraint that specifically governs whether Compute Engine VMs can be provisioned with external IP addresses. When you set the `allowedValues` list to empty (`[]`), the constraint denies external IP assignment for all VMs under the folder, enforced at VM creation time by the Compute Engine API. This directly meets the requirement to allow VM creation while prohibiting public IP addresses, unlike network-level controls that only affect traffic.

Why this answer

The `compute.vmExternalIpAccess` organization policy constraint is specifically designed to control whether Compute Engine VMs can be assigned external IP addresses. By setting this constraint to deny all VMs in the folder, developers are prevented from creating VMs with external IPs while still being able to create VMs with only internal IPs. This is the correct, native Google Cloud mechanism for enforcing this requirement at the folder level.

Exam trap

The trap here is that candidates often confuse network-layer controls (firewall rules) with resource-level policies (org policy constraints), leading them to choose a firewall rule instead of the correct org policy constraint that directly governs VM creation.

How to eliminate wrong answers

Option A is wrong because a VPC firewall rule blocks traffic at the network layer, not the creation of VMs with external IPs; developers could still assign an external IP to a VM, and the firewall rule would only block outbound internet traffic after the VM is created. Option C is wrong because removing the `compute.instanceAdmin` role would prevent developers from creating any VMs at all, not just those with external IPs, and it does not selectively restrict external IP assignment. Option D is wrong because configuring the default VPC network to use internal-only routes does not prevent a developer from explicitly assigning an external IP when creating a VM; it only affects routing, not the IP assignment itself.

61
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.

62
MCQeasy

A developer has a Kubernetes Deployment manifest in a file named 'api-deployment.yaml'. Which command creates the Deployment if it doesn't exist, or updates it if it does?

A.kubectl create -f api-deployment.yaml
B.kubectl run api-deployment.yaml
C.kubectl apply -f api-deployment.yaml
D.kubectl deploy -f api-deployment.yaml
AnswerC

`kubectl apply -f api-deployment.yaml` is the correct declarative approach: it reads the manifest, compares the desired state against the current cluster state, and creates or patches the resource as needed. This idempotent operation is safe to run repeatedly, making it the standard way to deploy and update resources in CI/CD pipelines and day-to-day kubectl workflows. It also records the last-applied configuration in the object's annotation for automatic conflict resolution.

Why this answer

`kubectl apply -f api-deployment.yaml` uses a declarative approach: it creates the Deployment if it does not exist, or performs a rolling update if it already exists, by applying the desired state defined in the YAML manifest. This command leverages the Kubernetes API's server-side apply logic, merging changes without requiring the resource to be deleted first.

Exam trap

Google Cloud often tests the distinction between `create` (imperative, fails on existing resources) and `apply` (declarative, idempotent), trapping candidates who think `create` can also update or who confuse `run` with `apply`.

How to eliminate wrong answers

Option A is wrong because `kubectl create -f api-deployment.yaml` will fail with an error if the Deployment already exists, as it only creates new resources and does not support updates. Option B is wrong because `kubectl run api-deployment.yaml` is not a valid command; `kubectl run` is used to create a Pod or Deployment from an image, not from a YAML file. Option D is wrong because `kubectl deploy -f api-deployment.yaml` is not a valid kubectl subcommand; the correct verb for updating existing resources is `apply`, not `deploy`.

63
MCQmedium

You need to create a dashboard in Cloud Monitoring that shows: (1) Cloud Run request count per second, (2) Cloud Run p99 latency, (3) GKE pod CPU utilization, and (4) Cloud SQL query duration — all on a single screen. Which Cloud Monitoring feature enables this multi-service overview?

A.Create four separate alerting policies and pin them to a shared alerting page.
B.Create a Cloud Monitoring custom dashboard with chart widgets for each metric across the different services.
C.Use BigQuery to query the metrics export and build a Looker Studio dashboard.
D.Use Cloud Logging to create a log-based dashboard with all four metrics.
AnswerB

Custom dashboards support heterogeneous metric widgets from any GCP service. Each widget is independently configured, creating a unified operational view across Cloud Run, GKE, and Cloud SQL.

Why this answer

Cloud Monitoring custom dashboards allow you to combine chart widgets from multiple monitored services (Cloud Run, GKE, Cloud SQL) into a single screen. This feature supports heterogeneous metric queries using the Monitoring Query Language (MQL) or metric selectors, enabling a unified view without needing separate tools or exports.

Exam trap

Google Cloud often tests the distinction between monitoring (dashboards) and alerting (policies), and the trap here is assuming that alerting policies can serve as a dashboard or that logging tools can natively display numeric metrics without additional configuration.

How to eliminate wrong answers

Option A is wrong because alerting policies are designed for threshold-based notifications, not for displaying real-time metric data on a dashboard; pinning alerts to a shared page does not create a visual dashboard with time-series charts. Option C is wrong because while BigQuery metrics export can feed Looker Studio, this adds unnecessary complexity and latency, and is not the native Cloud Monitoring feature for a single-screen overview. Option D is wrong because Cloud Logging is for log data, not numeric metrics like request count or latency; log-based dashboards cannot natively chart metric time-series such as p99 latency or CPU utilization.

64
MCQmedium

A billing report shows a Compute Engine VM has been running unused for 3 months. The team wants to stop it to save costs but needs the VM's disk data preserved for potential future use. What should they do?

A.Delete the VM to avoid all compute charges
B.Stop (shut down) the VM — compute charges stop but disk storage charges continue
C.Snapshot the VM disk and delete the VM
D.Set the VM to a smaller machine type to reduce costs
AnswerB

Stopping (shutting down) a VM transitions it to the TERMINATED state, which immediately halts billing for vCPUs, memory, and other compute resources, though persistent disk storage, static IPs, and other resources continue to incur charges. All data on the boot and data disks remains intact, and the VM can be restarted with the same configuration at any time. This is the simplest and most cost-effective way to pause an unused VM without data loss, because it eliminates the only charges you can fully remove without destroying anything.

Why this answer

Stopping (shutting down) a Compute Engine VM immediately halts all compute charges (vCPU, memory, GPU) while preserving the persistent disk and its data. The disk continues to incur storage costs, which is acceptable since the team wants to retain the data for potential future use. This is the most cost-effective approach that meets the requirement of preserving disk data without paying for idle compute resources.

Exam trap

Google Cloud often tests the misconception that stopping a VM eliminates all costs, but the trap here is that persistent disk storage charges continue even when the VM is stopped, which candidates may overlook when focusing only on compute savings.

How to eliminate wrong answers

Option A is wrong because deleting the VM removes the instance and its attached persistent disks by default, which would destroy the disk data unless a snapshot or disk backup was taken beforehand. Option C is wrong because while snapshotting the disk and deleting the VM does preserve the data, it introduces unnecessary complexity and additional snapshot storage costs; stopping the VM is simpler and directly meets the goal without extra steps. Option D is wrong because resizing to a smaller machine type reduces but does not eliminate compute charges, and the VM would still be running unused, wasting resources; the goal is to stop compute charges entirely.

65
MCQeasy

A company wants to run a stateful application that requires persistent storage on individual VMs. The VMs are not part of a managed instance group. Which Google Cloud storage option is best for this use case?

A.Local SSD
B.Cloud Storage
C.Filestore
D.Persistent Disk
AnswerD

Persistent Disk provides durable, block-level storage that behaves like a physical disk attached to your VM. It survives VM stops and deletions, supports snapshots, and offers zonal or regional redundancy for high availability. With performance tiers like pd-standard, pd-balanced, and pd-ssd, Persistent Disk directly meets the persistence and I/O requirements of a stateful application.

Why this answer

Persistent disks are durable block storage that can be attached to a single VM and persist independently of the VM lifecycle. Cloud Storage is object storage; Filestore is file storage; local SSDs are ephemeral and lose data on VM stop/termination.

66
MCQhard

An organization with multiple teams needs to provision separate, isolated environments (e.g., development, test, production) while sharing common services like Cloud NAT and VPC firewall rules. Which VPC networking pattern is most suitable?

A.Network Service Tiers (Premium vs Standard)
B.Shared VPC (XPN)
C.VPC Network Peering between team VPCs
D.Single VPC with per-team firewall rules
AnswerB

Shared VPC (XPN) is the correct solution because it separates teams into distinct service projects while allowing a central host project to own the VPC network, subnets, and all networking resources. Each team project can be administered independently by its own IAM roles, yet they all use the same shared subnets, firewall policies, and routes managed centrally. This gives project-level isolation for compute resources and data, while enabling a central network team to control connectivity, NAT, and firewall rules uniformly — exactly what multi-team separation requires.

Why this answer

Shared VPC (XPN) allows an organization to create a single, centrally managed VPC network that hosts common services like Cloud NAT and firewall rules, while enabling multiple project teams to provision their own isolated environments (dev, test, prod) within that same VPC. This pattern meets the requirement for separate, isolated environments with shared services without needing individual VPCs for each team.

Exam trap

The trap here is that candidates often confuse VPC Network Peering with Shared VPC, thinking peering provides shared services, but peering only connects networks without allowing shared NAT or centralized firewall rules.

How to eliminate wrong answers

Option A is wrong because Network Service Tiers (Premium vs Standard) control the quality of network transit and egress pricing, not the isolation or sharing of VPC resources like Cloud NAT or firewall rules. Option C is wrong because VPC Network Peering connects separate VPCs but does not allow them to share a single Cloud NAT or a common set of firewall rules; each VPC would need its own NAT and firewall configuration. Option D is wrong because a single VPC with per-team firewall rules does not provide the separate, isolated environments (e.g., separate projects or VPCs) that the question requires; it only offers logical isolation within one network, which is insufficient for true environment separation.

67
MCQmedium

A team uses Cloud Shell for all GCP CLI operations. A developer notices that files they create in Cloud Shell's home directory persist between sessions, but files in other directories do not. What explains this behavior?

A.Cloud Shell saves all files to Cloud Storage automatically
B.Only $HOME (~) has persistent 5 GB storage; other directories use ephemeral container storage
C.Cloud Shell stores files in Firestore, which only retains home directory paths
D.Files outside $HOME are deleted after 24 hours automatically
AnswerB

This is correct because Cloud Shell provisions a 5 GB persistent disk that is always mounted at $HOME (~), so files there survive session restarts. Every other path, such as /tmp or /opt, resides in the container's ephemeral storage, which is created fresh each time and loses all changes when the Cloud Shell VM is reset. This is why best practice is to keep important work inside the home directory or push it to Cloud Storage or a Git repository.

Why this answer

Cloud Shell provides each user with a persistent 5 GB home directory ($HOME) backed by Cloud Storage. Files created outside this directory reside in the container's ephemeral storage, which is discarded when the Cloud Shell session ends or is restarted. This design ensures user configurations and scripts are preserved while maintaining a clean, temporary environment for other operations.

Exam trap

The trap here is that candidates may assume Cloud Shell behaves like a traditional persistent VM where all files survive, or they may confuse the persistent home directory with automatic full-disk backup, leading them to choose option A or D.

How to eliminate wrong answers

Option A is wrong because Cloud Shell does not automatically save all files to Cloud Storage; only the $HOME directory is backed by persistent storage, and users must explicitly copy files elsewhere if they want them saved. Option C is wrong because Cloud Shell uses Cloud Storage (specifically a persistent disk mounted as the home directory), not Firestore, which is a NoSQL document database and not used for file storage in this context. Option D is wrong because files outside $HOME are not deleted after a fixed 24-hour period; they are removed when the Cloud Shell container is recycled or the session ends, which can happen sooner than 24 hours depending on inactivity or manual restart.

68
MCQmedium

A Cloud Run service needs to access a database password at runtime. Where should the password be stored according to GCP security best practices?

A.As a plain-text environment variable in the Cloud Run service configuration
B.In a Cloud Storage bucket accessible to the service account
C.In Secret Manager, referenced as a mounted secret or accessed via the API at runtime
D.Baked into the container image at build time
AnswerC

Secret Manager stores secret values encrypted at rest and in transit, and Cloud Run can inject them either as mounted volume files or environment variables without ever displaying the actual value in the service definition or console. Runtime API access via the Secret Accessor role also lets your code fetch secrets on demand, while IAM policies and Cloud Audit Logs provide fine-grained control and full access trails. Versioning supports seamless rotation, making this the only option that combines encryption, least-privilege access, and operational transparency.

Why this answer

Secret Manager is the GCP-native service designed to securely store sensitive data like database passwords. It provides encryption at rest and in transit, fine-grained access control via IAM, and supports both mounting secrets as volumes and accessing them via the API at runtime. This aligns with GCP security best practices by avoiding exposure of secrets in plain text, configuration files, or container images.

Exam trap

Google Cloud often tests the misconception that environment variables are secure for secrets because they are not visible in the source code, but the trap here is that environment variables are still exposed in the runtime environment and logs, making them insecure for sensitive data.

How to eliminate wrong answers

Option A is wrong because storing a password as a plain-text environment variable exposes it in the Cloud Run console, logs, and any process that can read environment variables, violating the principle of least privilege and secure secret management. Option B is wrong because Cloud Storage buckets are designed for object storage, not secret management; they lack built-in encryption key rotation, audit logging for secret access, and fine-grained access control specific to secrets, and storing a password there would require additional complexity to secure it. Option D is wrong because baking secrets into a container image at build time embeds them in the image layers, making them accessible to anyone with image pull access and preventing rotation without rebuilding and redeploying the image.

69
Multi-Selectmedium

A team wants to export GCP billing data for detailed analysis using SQL. Which three steps are necessary? (Choose THREE)

Select 3 answers
A.Enable Cloud Billing API
B.Create a Cloud Storage bucket
C.Create a BigQuery dataset
D.Set up billing export in the Cloud Console
E.Enable BigQuery API
AnswersC, D, E

Creating a BigQuery dataset is the necessary container that receives the exported billing tables. When you configure billing export, you must specify an already-existing dataset in the selected project; the export then creates and manages the underlying tables (e.g., `gcp_billing_export_v1_*`) within that dataset. Without a dataset, the billing export setup page in the Cloud Console will not allow you to proceed.

Why this answer

Billing export to BigQuery requires enabling BigQuery, creating a dataset, and configuring the export from billing.

70
MCQmedium

A DevOps engineer is using the Google Cloud Pricing Calculator to estimate the monthly cost of a Compute Engine VM running 24/7 for one month. The engineer selects a machine type and adds sustained use discounts. What is the correct way to apply sustained use discounts in the calculator?

A.Manually enter a discount percentage
B.The calculator automatically applies sustained use discounts based on monthly usage
C.Select 'Sustained Use Discount' checkbox
D.Sustained use discounts are not applicable to Compute Engine
AnswerB

When you configure Compute Engine resources in the Google Cloud Pricing Calculator, the tool estimates the monthly run time for each VM and automatically applies the applicable sustained use discount. SUD tiers are calculated without any user action: resources running more than 25% of the month receive a discount that increases incrementally until reaching a maximum of 20% off for the portion of the month after a full month of usage. This auto-application makes the estimate reflect actual billing.

Why this answer

Sustained use discounts are automatically applied by Google Cloud based on the number of hours a VM runs per month. The calculator includes them automatically when you specify the monthly usage.

71
MCQmedium

A developer frequently switches between three GCP projects and accounts throughout the day. They want to avoid rerunning `gcloud init` each time. Which gcloud feature lets them save and switch between pre-configured project/account/region combinations?

A.gcloud environments — a built-in workspace manager
B.gcloud named configurations created with `gcloud config configurations create`
C.Separate gcloud installations — one per project
D.A .gcloudrc file in each project directory that gcloud reads automatically
AnswerB

Named configurations are the official mechanism for managing multiple Google Cloud contexts in a single gcloud installation. Created with `gcloud config configurations create [NAME]`, each configuration stores a distinct combination of account, project, region, and zone. `gcloud config configurations activate [NAME]` instantly switches to a different context, and `gcloud config list` shows the active configuration. This avoids repeatedly setting `--project` flags or juggling credentials manually.

Why this answer

`gcloud config configurations` allow a developer to create, save, and switch between named sets of gcloud properties (project, account, region, zone) without re-running `gcloud init`. Each configuration stores its own active account, project ID, and default compute region/zone, and can be activated instantly with `gcloud config configurations activate <name>`, making it ideal for frequent context switching between multiple GCP projects and accounts.

Exam trap

The trap here is that candidates may confuse `gcloud config configurations` with a non-existent feature like 'gcloud environments' or assume that gcloud supports per-directory configuration files (like `.env` files), when in fact it relies on explicit named configurations stored globally.

How to eliminate wrong answers

Option A is wrong because `gcloud environments` is not a real gcloud feature; the correct mechanism for managing multiple sets of properties is `gcloud config configurations`, not a built-in workspace manager. Option C is wrong because maintaining separate gcloud installations for each project is unnecessary and inefficient; gcloud is designed to handle multiple projects and accounts within a single installation using configurations. Option D is wrong because gcloud does not automatically read a `.gcloudrc` file from project directories; it uses the active configuration (or the default configuration) and does not support per-directory property files.

72
MCQmedium

An administrator needs to create a Cloud SQL for PostgreSQL instance with 16 vCPUs and 60 GB of memory. Which tier should they specify?

A.db-custom-16-60
B.db-custom-16-61440
C.db-n1-standard-16
D.db-custom-16-60000
AnswerB

This is the correct custom tier string because it conforms to the required db-custom-<vCPUs>-<memory_in_MB> format for Cloud SQL custom machine types. It specifies 16 vCPUs and 61,440 MB of memory, which is exactly 60 GB when applying the binary conversion factor of 1024 MB per GB. This string accurately represents the administrator's desired 16 vCPU / 60 GB configuration in the unit that Cloud SQL actually uses.

Why this answer

Cloud SQL tiers follow the pattern db-custom-#vcpus-#memoryMB. 16 vCPUs and 60 GB (61440 MB) uses db-custom-16-61440.

73
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.

74
MCQeasy

An engineer needs to create a Cloud Storage bucket for storing archival data that will be accessed less than once a year. The data must be stored durably and cost-effectively. Which storage class should the engineer use?

A.Coldline
B.Standard
C.Archive
D.Nearline
AnswerC

Archive is correct because it is the only Google Cloud storage class specifically designed for data accessed less than once a year, offering the lowest storage cost. It is ideal for long-term retention, regulatory archives, or disaster recovery backups, with the trade-off of higher retrieval fees and a 365-day minimum storage duration before deletion or class change.

Why this answer

Archive storage class is designed for data accessed less than once a year, with the lowest storage cost but higher retrieval costs and a 365-day minimum storage duration. It is ideal for long-term archival.

75
MCQhard

A managed instance group (MIG) is configured with autohealing using a health check. During a rolling update, several VMs become unhealthy before the new application version starts responding to health checks. The MIG deletes and recreates these VMs repeatedly, causing a deployment loop. How should you fix this?

A.Disable autohealing during rolling updates by removing the health check.
B.Increase the `initialDelaySec` in the autohealing policy to give VMs time to start before health checks are evaluated.
C.Switch from rolling update to canary update to reduce the number of affected VMs.
D.Reduce the health check interval and timeout to detect unhealthy VMs faster.
AnswerB

When a VM is created in a managed instance group, the autohealing health check begins evaluating it immediately after the initial delay elapses. If that delay is shorter than the actual boot and initialization time, the VM is still starting and may fail the check, causing the autohealer to delete and recreate it repeatedly. Setting `initialDelaySec` to exceed the longest expected startup time—including startup scripts and application readiness—prevents healthy but not-yet-ready VMs from being wrongly terminated during creation or rolling update.

Why this answer

Increasing `initialDelaySec` in the autohealing policy gives the new application version sufficient time to start and become healthy before the health check begins evaluating the VM. This prevents the MIG from prematurely marking VMs as unhealthy during the rolling update, breaking the deployment loop where VMs are repeatedly deleted and recreated.

Exam trap

The trap here is that candidates often confuse autohealing health checks with load balancer health checks, assuming that reducing intervals or timeouts will speed up recovery, when in fact it exacerbates the deployment loop by triggering autohealing before the new version is ready.

How to eliminate wrong answers

Option A is wrong because disabling autohealing entirely removes the ability to recover from genuine failures during the update, leaving the MIG vulnerable to stuck deployments without automatic recovery. Option C is wrong because switching to a canary update does not address the root cause—the health check timing—and can still result in a deployment loop if the new version is slow to start. Option D is wrong because reducing the health check interval and timeout would make the problem worse by evaluating health more aggressively, increasing the likelihood of premature unhealthy detection and loop amplification.

Page 1 of 11

Page 2

All pages