Courseiva

Google Associate Cloud Engineer (ACE) — Questions 76150

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

Page 1

Page 2 of 11

Page 3
76
MCQeasy

A GCP project has three service accounts. A developer wants to list all service accounts in the project using the gcloud CLI. Which command is correct?

A.gcloud service-accounts list
B.gcloud iam list service-accounts
C.gcloud iam service-accounts list
D.gcloud projects list-service-accounts
AnswerC

The command `gcloud iam service-accounts list` is the correct and canonical way to list all service accounts in the active project. It returns a table of service account emails, display names, and unique IDs by querying the IAM Service Accounts API. You can specify a non-default project with `--project` or `--filter` to narrow results, making it a reliable and standard administrative operation.

Why this answer

The `gcloud iam service-accounts list` command is the standard gcloud CLI command to list all service accounts in a GCP project. It uses the IAM API to retrieve the service accounts associated with the current project (or a specified project via the `--project` flag). This command is part of the `gcloud iam` group, which manages IAM resources, and the `service-accounts` sub-group specifically handles service account operations.

Exam trap

Google Cloud often tests the exact hierarchical structure of gcloud commands, and the trap here is that candidates may confuse the `gcloud iam` subcommand syntax (where the resource type comes before the verb) with other command groups (like `gcloud compute` where the verb often comes first), leading them to choose Option B or D.

How to eliminate wrong answers

Option A is wrong because `gcloud service-accounts list` is not a valid gcloud command; the correct command structure requires the `iam` group before `service-accounts`. Option B is wrong because `gcloud iam list service-accounts` uses an incorrect subcommand order — the verb `list` must come after the resource type `service-accounts`, not before. Option D is wrong because `gcloud projects list-service-accounts` does not exist; the `gcloud projects` command group is for managing project metadata, not for listing service accounts.

77
MCQeasy

You need to allow inbound HTTP traffic to a set of Compute Engine instances that have the tag 'web-server'. All other inbound traffic should be denied. Which firewall rule configuration should you create?

A.Create an allow rule for tcp:80 with target tags 'web-server' and source range 0.0.0.0/0, and a deny rule for all other traffic.
B.Create an allow rule for tcp:80 with source range 0.0.0.0/0 and apply to all instances.
C.Create a deny rule for all ports except tcp:80 with target tags 'web-server'.
D.Create an allow rule for tcp:80 with source range 0.0.0.0/0 and target tags 'web-server'. No deny rule is needed.
AnswerD

This is correct because VPC networks include an implicit deny-all rule for inbound traffic, so the only rule needed is an explicit allow for HTTP traffic (TCP port 80) from all source IP addresses (0.0.0.0/0) to instances tagged with 'web-server'. Target tags let you apply the rule selectively, ensuring only web server VMs accept inbound HTTP while all other instances remain blocked by the implicit deny. No additional deny rule is required or advisable.

Why this answer

Firewall rules are stateful; you should create an allow rule for HTTP (tcp:80) with source range 0.0.0.0/0 and target tag 'web-server'. Implicit deny all inbound traffic is the default, so no explicit deny is needed.

78
MCQhard

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

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

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

Why this answer

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

79
MCQeasy

A developer wants to deploy a containerized application that can scale to zero when not in use and only pay for resources consumed during request processing. Which compute option should they choose?

A.App Engine Flexible Environment
B.Cloud Run
C.Compute Engine with managed instance groups
D.Google Kubernetes Engine
AnswerB

Cloud Run is Google's serverless container platform that executes containerized applications in a fully managed environment, with automatic scaling based on incoming HTTP requests. When there is no traffic, Cloud Run scales the number of instances to zero, completely shutting down the service and charging you nothing for idle resources. This makes it the only option among the four that truly supports scale-to-zero for a containerized app.

Why this answer

Cloud Run is a fully managed serverless compute platform that automatically scales your containerized applications from zero instances up to handle traffic, and scales back down to zero when there are no requests. You only pay for the resources (CPU, memory, and networking) consumed during request processing, with no charges when the service is idle. This makes it the ideal choice for the described use case of scaling to zero and pay-per-request billing.

Exam trap

Google Cloud often tests the misconception that 'containerized' implies Kubernetes or Compute Engine, but the key differentiator here is the requirement to 'scale to zero' and 'pay only for request processing,' which is a serverless property unique to Cloud Run among the listed options.

How to eliminate wrong answers

Option A is wrong because App Engine Flexible Environment runs containers on managed VMs that cannot scale to zero; it requires at least one instance to be running at all times, incurring costs even when idle. Option C is wrong because Compute Engine with managed instance groups requires at least one running VM instance to serve traffic; while you can configure autoscaling to a minimum of one, it cannot scale to zero instances, and you pay for the underlying VMs regardless of request volume. Option D is wrong because Google Kubernetes Engine (GKE) with Autopilot or Standard mode requires at least one node to run pods; even with cluster autoscaling, you cannot scale to zero nodes, and you incur costs for the node infrastructure even when no requests are being processed.

80
MCQmedium

A company needs to provide outbound internet access to private Compute Engine instances that do not have external IP addresses. The instances must be able to download updates from the internet. Which service should be configured?

A.VPC peering
B.Cloud VPN
C.Cloud NAT
D.Private Google Access
AnswerC

Cloud NAT is a managed source network address translation service that enables instances without external IP addresses to make outbound connections to the internet while allowing only corresponding return traffic. It works with Cloud Router to automatically configure NAT for a VPC network and supports mapping of private IPs to a set of external IP addresses, making it the correct solution for this requirement.

Why this answer

Cloud NAT enables private instances to access the internet for outbound connections while blocking inbound connections from the internet.

81
MCQmedium

A GCP organization has recently experienced a credential theft incident involving a service account key. The CISO requires that all service account keys in the organization be inventoried and those older than 90 days be rotated. Which tool identifies old service account keys across all projects?

A.Security Command Center — it audits service account key age automatically
B.Cloud Asset Inventory querying all IAM ServiceAccountKey assets across the organization
C.Cloud Monitoring metric for service account key creation date
D.Manually check each service account in each project's IAM & Admin > Service Accounts page
AnswerB

Cloud Asset Inventory is the correct tool because it supports organization-scoped queries for the `iam.googleapis.com/ServiceAccountKey` asset type, returning every service account key with its creation timestamp. For example, `gcloud asset search-all-resources --asset-types=iam.googleapis.com/ServiceAccountKey --scope=organizations/ORG_ID` lists all keys, and you can filter by age using `--query` or post-process with `jq` to identify keys older than your rotation policy. This approach provides a complete, auditable, and automated way to detect stale keys across all projects.

Why this answer

Cloud Asset Inventory (CAI) is the correct tool because it can query all IAM ServiceAccountKey assets across the entire organization, including all projects, using a single API call or gcloud command. This allows you to filter by the `validAfterTime` field to identify keys older than 90 days, meeting the CISO's requirement for a comprehensive, automated inventory without manual per-project inspection.

Exam trap

Google Cloud often tests the misconception that Security Command Center handles IAM key lifecycle audits, when in fact Cloud Asset Inventory is the correct service for querying metadata like key creation dates across all projects.

How to eliminate wrong answers

Option A is wrong because Security Command Center (SCC) does not automatically audit service account key age; it focuses on vulnerability and threat detection, not asset inventory of key creation dates. Option C is wrong because Cloud Monitoring metrics do not expose service account key creation dates; metrics are for performance and usage, not IAM resource metadata. Option D is wrong because manually checking each service account in each project's IAM & Admin page is not a tool and is impractical for an organization-wide inventory, violating the requirement for an automated, scalable solution.

82
MCQhard

A financial trading platform must support globally distributed, strongly consistent SQL transactions at thousands of writes per second, with no downtime for planned maintenance. Which GCP database service meets all these requirements?

A.Cloud SQL with synchronous read replicas
B.Cloud Bigtable
C.Cloud Firestore
D.Cloud Spanner
AnswerD

Cloud Spanner is the only Google Cloud database that natively combines SQL semantics, ACID transactions with external consistency (linearizable), and horizontal write scalability across regions, all backed by a 99.999% availability SLA. Its TrueTime API synchronizes globally distributed replicas so that transactions appear in a single, globally consistent order, which is exactly what a financial trading platform needs for order book updates, ledger entries, and risk management. This unique blend of relational structure, global consistency, and virtually unlimited write scaling makes Spanner the correct choice for mission-critical transactional systems.

Why this answer

Cloud Spanner is the only GCP database service that provides globally distributed, strongly consistent SQL transactions with horizontal scaling, supporting thousands of writes per second. It uses synchronous replication across regions and TrueTime-based clock synchronization to ensure external consistency, while also offering 99.999% availability with no planned downtime for maintenance.

Exam trap

The trap here is that candidates often confuse Cloud Spanner's global strong consistency with Cloud SQL's regional strong consistency, or mistakenly think that NoSQL services like Bigtable or Firestore can support SQL transactions and global writes at scale.

How to eliminate wrong answers

Option A is wrong because Cloud SQL with synchronous read replicas is not globally distributed; it is a single-region service with read replicas that do not support writes, and it cannot scale to thousands of writes per second without downtime for maintenance. Option B is wrong because Cloud Bigtable is a NoSQL wide-column database that does not support SQL transactions or strong consistency across regions; it is designed for high-throughput analytical workloads, not transactional SQL. Option C is wrong because Cloud Firestore is a NoSQL document database that does not support SQL transactions; it provides strong consistency only within a single region and cannot handle thousands of writes per second globally with SQL semantics.

83
Multi-Selectmedium

A developer wants to use Cloud Shell for managing GCP resources. Which three statements about Cloud Shell are true? (Choose THREE.)

Select 3 answers
A.It allows unlimited session duration without any timeout
B.It can be used only for projects that have billing enabled
C.It provides a web-based terminal in the GCP Console
D.It provides 5 GB of persistent disk storage in the user's home directory
E.It has gcloud, kubectl, and terraform pre-installed
AnswersC, D, E

Cloud Shell is a web-based terminal that launches directly from the Google Cloud Console, giving you authenticated command-line access to your GCP environment without needing to install the Google Cloud SDK locally. It automatically authenticates you using the same credentials as the console, and it also sets the current project so you can immediately run gcloud commands. This integration makes it the quickest way to test API calls, run kubectl against GKE clusters, or inspect resources while staying in the browser.

Why this answer

Cloud Shell provides a browser-based terminal with persistent 5GB home directory, and comes pre-installed with common tools like gcloud, kubectl, and terraform. It also includes a code editor.

84
MCQmedium

A developer wants to deploy a containerized application on Google Cloud that automatically scales to zero when not in use and charges only for request processing time. The application is stateless and can be triggered by HTTP requests. Which compute option meets these requirements?

A.Compute Engine with managed instance groups
B.Cloud Functions
C.Cloud Run
D.Google Kubernetes Engine (GKE) with cluster autoscaling
AnswerC

Cloud Run is a fully managed serverless platform that runs stateless HTTP-triggered containers directly from a container image. It automatically scales down to zero when there are no incoming requests, so you incur no charges while idle, and bills only for request duration (CPU, memory, and concurrency metered during request handling). You can deploy any container that listens on HTTP, making it the ideal low-overhead choice for a containerized web application. Unlike GKE or Compute Engine, there is no infrastructure to manage or minimum charge for a running VM.

Why this answer

Cloud Run is a fully managed serverless platform that scales to zero and charges per request. It is ideal for stateless HTTP-triggered containers. Compute Engine and GKE do not scale to zero (idle resources incur cost).

Cloud Functions is also serverless but is for event-driven code, not containerized apps.

85
MCQmedium

An organization stores sensitive data in Cloud Storage. They need to ensure that objects are encrypted at rest using a key that they manage and rotate themselves. Which Cloud Storage encryption option should they use?

A.Use customer-supplied encryption keys (CSEK)
B.Use customer-managed encryption keys (CMEK)
C.Use client-side encryption
D.Use Google-managed encryption keys
AnswerB

CMEK lets you create and manage encryption keys in Cloud KMS, and Cloud Storage uses them to encrypt your objects server-side. You control the key lifecycle, including automatic rotation periods, and can grant or revoke access through IAM identities and conditions. This provides a central audit trail and the ability to disable or destroy keys instantly, which is exactly what the organization needs for sensitive data.

Why this answer

Customer-managed encryption keys (CMEK) allow you to manage your own keys via Cloud KMS. Google-managed keys are default. Client-side encryption is done before upload.

Supplied keys are also customer-provided but not managed via KMS.

86
MCQeasy

You run `kubectl get pods` and see a pod in `ImagePullBackOff` state. What are the two most common causes of this error?

A.Incorrect image name/tag, or missing pull credentials for a private registry.
B.Insufficient CPU/memory on the node, or the pod's resource requests are too high.
C.The pod's liveness probe is failing, causing the container to restart.
D.The container's entrypoint command is failing, causing the image pull to abort.
AnswerA

ImagePullBackOff means the kubelet could not successfully fetch the container image from the registry. An incorrect image name or tag causes a 404 Not Found response from the registry, while missing or invalid pull credentials for a private registry result in a 403 Forbidden response. Both failure modes prevent the image from being downloaded, so the kubelet enters ImagePullBackOff and retries with an exponential backoff. To resolve this, correct the image reference or create an imagePullSecret and attach it to the Pod.

Why this answer

The `ImagePullBackOff` state indicates that the kubelet is unable to pull the container image from the registry. The two most common causes are an incorrect image name or tag (e.g., a typo or a non-existent tag), which results in a `404 Not Found` from the registry, and missing or invalid pull credentials for a private registry, which results in a `401 Unauthorized` or `403 Forbidden` response. Both prevent the image from being downloaded, causing the pod to enter a backoff loop.

Exam trap

Google Cloud often tests the distinction between `ImagePullBackOff` (image retrieval failure) and `CrashLoopBackOff` (container runtime failure) — candidates confuse the two because both involve backoff logic, but the root cause and timing differ.

How to eliminate wrong answers

Option B is wrong because insufficient CPU/memory on the node or high resource requests cause `Pending` or `OutOfcpu`/`OutOfmemory` states, not `ImagePullBackOff`; the image pull itself is not affected by resource constraints. Option C is wrong because a failing liveness probe causes container restarts (CrashLoopBackOff) or pod termination, but does not affect the image pull process; `ImagePullBackOff` occurs before the container even starts. Option D is wrong because a failing entrypoint command causes the container to exit immediately after starting (CrashLoopBackOff), not an image pull failure; the image pull completes successfully before the entrypoint runs.

87
MCQeasy

A company is running a batch processing job on Compute Engine every night. The job usually completes in 2 hours, but recently it has been taking over 4 hours. The CPU utilization on the VM is consistently below 20%. What is the most likely cause?

A.The VM is using a shared-core machine type.
B.The VM's machine type is too small.
C.The VM is running out of memory and swapping to disk.
D.The VM's persistent disk is in a different zone.
AnswerC

When physical memory is exhausted, the Linux kernel moves cold pages to swap space on the attached persistent disk. Every swapped-in/out page causes block I/O, while the CPU idles waiting on disk, so overall CPU utilization stays low even though the job crawls. Combined with high disk I/O, this pattern is a classic signature of memory thrashing, not a CPU shortage.

Why this answer

When CPU utilization is below 20% but job execution time has doubled, the bottleneck is likely I/O, not compute. Swapping to disk occurs when the VM runs out of memory, causing the kernel to page memory to the persistent disk, which is orders of magnitude slower than RAM. This I/O wait directly increases job duration without raising CPU utilization.

Exam trap

Google Cloud often tests the misconception that low CPU utilization always means the machine is over-provisioned, but the trap here is that I/O-bound workloads (like memory swapping) can cause severe performance degradation while CPU remains idle, leading candidates to incorrectly choose a machine type or disk zone issue.

How to eliminate wrong answers

Option A is wrong because shared-core machine types (e.g., e2-micro) can cause CPU throttling under sustained load, but the symptom would be high CPU credit exhaustion and visible CPU throttling, not consistently low CPU utilization. Option B is wrong because if the machine type were too small, CPU utilization would be high (near 100%) as the job struggles to complete, not below 20%. Option D is wrong because a persistent disk in a different zone than the VM is not supported; Compute Engine requires the disk to be in the same zone as the VM, so this configuration would cause an immediate launch failure, not a gradual performance degradation.

88
MCQhard

A security team wants to prevent authorized users from copying BigQuery query results to a dataset in a different GCP project that is outside the team's security boundary — even if the user has valid IAM permissions. Which control enforces this?

A.IAM deny policies restricting cross-project BigQuery operations
B.VPC Service Controls with a perimeter enclosing BigQuery
C.An organization policy preventing resource creation outside specific projects
D.Cloud Armor rules blocking outbound API requests to BigQuery in other projects
AnswerB

VPC Service Controls is the only option that enforces context-aware access at the BigQuery API layer by placing the API inside a service perimeter. Any request to BigQuery from outside that perimeter, or any attempt by an internal client to access a resource outside the perimeter, is denied regardless of IAM roles, because the perimeter uses a deny-by-default egress/ingress model. This directly prevents an authorized user from copying BigQuery data to an external project, since the destination project is outside the perimeter and the API call is blocked even if the user has permissions in both projects.

Why this answer

VPC Service Controls (VPC-SC) create a security perimeter around Google Cloud services, including BigQuery, that prevents data exfiltration to projects outside the perimeter regardless of IAM permissions. By configuring a service perimeter that includes BigQuery and the authorized project, any attempt to copy query results to a dataset in a project outside the perimeter is blocked, even if the user has valid IAM roles. This enforces a data boundary that overrides IAM-based access.

Exam trap

The trap here is that candidates assume IAM deny policies can block data movement across projects, but VPC Service Controls are the only mechanism that enforces data exfiltration boundaries at the network layer, overriding IAM permissions.

How to eliminate wrong answers

Option A is wrong because IAM deny policies can restrict specific operations but they operate at the IAM level and cannot override valid permissions granted to a user; they also do not provide a network-level data exfiltration control that prevents copying results across projects. Option C is wrong because an organization policy preventing resource creation outside specific projects only controls where new resources can be created, not the movement of existing data or query results between projects. Option D is wrong because Cloud Armor is a web application firewall that protects HTTP(S) traffic, not BigQuery API calls, and it cannot block outbound API requests to BigQuery in other projects.

89
MCQmedium

A developer wants to allow a Compute Engine instance to access Cloud Storage without using a service account key file. What is the recommended approach?

A.Use Application Default Credentials with a user account.
B.Download a service account key and store it on the instance.
C.Create a service account, grant it the required roles, and attach it to the instance using the --service-account flag.
D.Set up a VPN connection to Cloud Storage.
AnswerC

Create a service account, grant it the required IAM roles (for example, roles/storage.objectViewer for Cloud Storage read access), and attach it to the instance using the --service-account flag at instance creation time. The instance then automatically authenticates to Google Cloud APIs through the instance's metadata server, which provides OAuth 2.0 access tokens on behalf of the service account without storing any secret material on the disk. This is the standard, secure pattern for granting a Compute Engine instance access to other GCP resources, as it leverages the cloud-native identity and avoids managing static credentials.

Why this answer

The recommended approach is to create a service account, grant it the necessary roles, and attach it to the instance. The instance can then use the service account via the metadata server without needing keys.

90
Multi-Selecthard

You are designing a resource hierarchy for a company with three departments: Engineering, Sales, and HR. Each department should have its own projects, and policies should be applied at the department level. Which THREE steps should you take? (Choose three.)

Select 3 answers
A.Create a folder for each department
B.Use labels to separate departments
C.Create an organization node
D.Create a project for each department
E.Apply IAM policies at the project level only
AnswersA, C, D

Folders allow grouping projects per department.

Why this answer

Create an organization node (if not already present). Under it, create a folder for each department. Then create projects within each folder.

Apply IAM policies at the folder level.

91
MCQmedium

A team wants to grant three developers access to view Cloud SQL instance details and connection strings, but not create, delete, or modify any Cloud SQL instances. Which predefined IAM role is the most appropriate?

A.Cloud SQL Editor
B.Cloud SQL Client
C.Cloud SQL Viewer
D.Project Viewer
AnswerC

Cloud SQL Viewer (roles/cloudsql.viewer) is the exact least-privilege role for read-only inspection of Cloud SQL instances. It grants the ability to list and get instance details, including machine configuration, IP addresses, and connection information, without permitting any write operations, deletions, or modifications. This role satisfies the requirement to view instance details while preventing changes, making it the correct choice.

Why this answer

The Cloud SQL Viewer role (roles/cloudsql.viewer) grants read-only permissions to view Cloud SQL instance details, including connection strings, without allowing any create, delete, or modify operations. This matches the requirement precisely, as it provides the necessary visibility while preventing any changes to the instances.

Exam trap

Google Cloud often tests the distinction between roles that grant operational access (like Cloud SQL Client) versus read-only access (like Cloud SQL Viewer), and the trap here is that candidates may confuse 'Client' with 'Viewer' because both sound like they provide access, but only Viewer grants the ability to see instance details and connection strings without modification permissions.

How to eliminate wrong answers

Option A is wrong because Cloud SQL Editor (roles/cloudsql.editor) includes permissions to create, update, and delete Cloud SQL instances, which exceeds the required read-only access. Option B is wrong because Cloud SQL Client (roles/cloudsql.client) primarily grants permissions to connect to Cloud SQL instances (e.g., using the Cloud SQL Proxy or client libraries) but does not include the ability to view instance metadata or connection strings in the console. Option D is wrong because Project Viewer (roles/viewer) provides read-only access to all resources in the project, which is overly broad and not scoped specifically to Cloud SQL; it also does not grant the precise permissions needed for viewing Cloud SQL instance details and connection strings.

92
MCQmedium

Your Cloud Build pipeline needs to reference environment-specific configuration: `PROJECT_ID`, `REGION`, and `IMAGE_TAG` (generated from the Git commit SHA). Where should you define these values in `cloudbuild.yaml`?

A.Hardcode the values directly in each build step's `args` field.
B.Use built-in substitutions (`$PROJECT_ID`, `$COMMIT_SHA`) and define custom substitutions (`$_REGION`) in the trigger or `--substitutions` flag.
C.Store all values in Cloud Secret Manager and retrieve them in each build step.
D.Use a `.env` file committed to the repository and source it in build steps.
AnswerB

Cloud Build provides built-in substitutions like $PROJECT_ID and $COMMIT_SHA that are automatically populated for every build, while custom substitutions such as $_REGION are defined in the trigger configuration or passed via the --substitutions flag. This allows a single cloudbuild.yaml to remain environment-agnostic, with environment-specific values injected at build runtime, enabling the same pipeline to promote across dev/staging/prod without code changes. Because these substitutions are a native Cloud Build feature, they are evaluated before each step executes, making them reliable and auditable.

Why this answer

Cloud Build provides built-in substitutions like `$PROJECT_ID` and `$COMMIT_SHA` that automatically resolve to the current project ID and the Git commit SHA, respectively. Custom substitutions like `$_REGION` can be defined in the trigger configuration or passed via the `--substitutions` flag, allowing environment-specific values to be injected without hardcoding. This approach keeps the `cloudbuild.yaml` reusable across environments and avoids exposing sensitive or variable data in the build file.

Exam trap

Google Cloud often tests the distinction between built-in and custom substitutions, and the trap here is that candidates assume all environment-specific values must be hardcoded or stored in secrets, overlooking Cloud Build's native substitution mechanism for non-sensitive configuration.

How to eliminate wrong answers

Option A is wrong because hardcoding values in `args` makes the pipeline environment-specific, requiring manual edits for each environment and violating the principle of configuration externalization. Option C is wrong because Cloud Secret Manager is designed for sensitive data (e.g., API keys, passwords), not for non-sensitive environment variables like `PROJECT_ID`, `REGION`, or `IMAGE_TAG`; retrieving secrets in every build step adds unnecessary latency and complexity. Option D is wrong because a `.env` file committed to the repository exposes environment-specific values in version control, creating security risks and maintenance overhead, and Cloud Build does not natively source `.env` files without custom scripting.

93
MCQhard

An organization has a hierarchy: Organization -> Folder A -> Project 1. An IAM policy at the organization level grants roles/editor to user@example.com. A policy at Folder A denies roles/editor to the same user. What is the effective role for the user in Project 1?

A.The user has the editor role only in resources directly under the organization, not under Folder A.
B.The user does not have the editor role in Project 1 because the deny policy at the folder level blocks it.
C.The user has the editor role because organization-level grants override folder-level denials.
D.The user has the editor role in Project 1 unless there is a specific project-level deny.
AnswerB

IAM deny policies are evaluated with higher precedence than allow policies, so a deny rule on Folder A explicitly blocks any inherited editor grant from reaching resources below that folder. Project 1, being a child of Folder A, inherits both the organization-level editor role and the folder-level deny, but deny rules win. As a result, even though the user was granted editor at the organization, the user's effective permissions in Project 1 do not include editor; the deny policy specifically prevents that role from being granted.

Why this answer

IAM policies are additive, but deny policies can override allow policies. If a deny policy is set at a higher level and applies to the user, it denies the permission even if granted at a lower level. However, if the deny policy is at the folder level, it denies the role in all resources under that folder, including Project 1.

94
MCQhard

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

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

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

Why this answer

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

95
MCQmedium

You need to grant a third-party monitoring vendor's service account `roles/monitoring.viewer` on your project, but only for the next 90 days. After 90 days, the access should automatically expire. Which IAM feature enables time-limited access?

A.Set a session duration limit in the vendor's service account settings.
B.Add an IAM Condition with a date/time expression that expires the binding after 90 days.
C.Grant the role and set a reminder to manually revoke it in 90 days.
D.Use a temporary service account that is automatically deleted after 90 days via a Cloud Scheduler job.
AnswerB

Attaching an IAM Condition with a date/time expression such as `request.time < timestamp('2025-08-01T00:00:00Z')` to the role binding makes the permission valid only until that timestamp. When a service account attempts to access a resource after the expiry, Cloud IAM evaluates the condition and returns `PERMISSION_DENIED` because the condition is false. This enforces the 90-day limit automatically at authorization time, without manual steps or separate cleanup jobs.

Why this answer

IAM Conditions allow you to attach a time-based expression to a role binding, such as `request.time < timestamp('2025-01-01T00:00:00Z')`, which automatically revokes the binding after the specified date. This is the native, auditable, and policy-driven way to enforce time-limited access in Google Cloud without manual intervention or resource lifecycle management.

Exam trap

Google Cloud often tests the misconception that session duration limits or service account lifecycle management can enforce time-bound permissions, when in fact only IAM Conditions provide a native, policy-based expiration mechanism for role bindings.

How to eliminate wrong answers

Option A is wrong because session duration limits apply to the maximum time a service account can use a token before re-authentication, not to the overall validity of the IAM role binding; they do not expire the permission itself after 90 days. Option C is wrong because manually revoking access is error-prone, not automated, and violates the requirement for automatic expiration; it is not an IAM feature. Option D is wrong because deleting a service account does not automatically remove its IAM role bindings (orphaned bindings remain), and Cloud Scheduler cannot delete a service account without additional custom logic; this approach is unnecessarily complex and not a built-in IAM feature.

96
MCQeasy

What is the purpose of Cloud Audit Logs' Data Access audit logs, and why are they NOT enabled by default for most services?

A.They record authentication events; they are disabled by default due to privacy regulations.
B.They log API calls that read or write user data; they are off by default due to very high log volume and associated storage costs.
C.They log VM instance creation and deletion; they are disabled by default to avoid noise.
D.They provide real-time threat detection; they are experimental and not yet generally available.
AnswerB

Data Access audit logs capture every API call that reads or writes user data, such as when a BigQuery job reads table contents or a Cloud Storage object is downloaded. They are disabled by default because on heavily used services the sheer volume of these calls can generate terabytes of logs, making storage costs prohibitive. Administrators can selectively enable them per bucket, project, or folder to balance compliance needs against cost and performance impact.

Why this answer

Data Access audit logs record every API call that reads or writes user-provided data (e.g., reading a Cloud Storage object or updating a BigQuery table). They are disabled by default because the sheer volume of these operations can generate terabytes of logs per day, leading to significant Cloud Logging storage costs and potential budget overruns. Administrators must explicitly enable them per service or per resource to control cost and log retention.

Exam trap

Google Cloud often tests the misconception that Data Access logs are enabled by default for all services, when in fact they are off by default specifically to prevent runaway storage costs from high-volume user data operations.

How to eliminate wrong answers

Option A is wrong because Data Access logs do not record authentication events; those are captured by Admin Activity logs (for IAM policy changes) and System Event logs (for GCP actions). Option C is wrong because VM instance creation and deletion are recorded by Admin Activity logs, not Data Access logs, and they are enabled by default for free. Option D is wrong because Data Access logs are not experimental—they are GA—and they do not provide real-time threat detection; that is the role of services like Security Command Center or Event Threat Detection.

97
MCQmedium

An engineer needs to grant an external auditor read-only access to a subset of Cloud Storage buckets in a project. The auditor's identity is a Google account. Which IAM approach should the engineer use?

A.Add the auditor's email as a member with the Storage Admin role on the project.
B.Use a signed URL for each object the auditor needs to see.
C.Add the auditor's email as a member with the Storage Object Viewer role on each individual bucket.
D.Add the auditor's email as a member with the Storage Object Viewer role on the project, and use IAM Conditions to restrict access to specific bucket resources.
AnswerD

Assigning Storage Object Viewer at the project level grants read-only access to all objects in all buckets by default, but binding that grant with an IAM Condition that checks the resource name (e.g., resource.name.startsWith("projects/_/buckets/audit-")) restricts the access to exactly the intended buckets at access time. The auditor can then list and read objects only within those matches, while the project-level policy remains a single, centrally managed binding that can be audited and adjusted without touching each bucket. This delivers the least-privilege read-only guarantee the auditor needs while keeping operations scalable and governance clean.

Why this answer

The best practice is to grant the Storage Object Viewer role at the project level and then use IAM Conditions to restrict access to specific bucket resources. This avoids managing multiple bindings per bucket while ensuring the auditor only sees the intended buckets. Granting at the bucket level is possible but less scalable; granting Storage Admin is too permissive; using ACLs is legacy and more complex to audit.

98
MCQmedium

A company organizes its GCP projects by business unit — Finance, Engineering, and Sales. Which resource is best suited to group these projects while applying shared IAM policies to all projects in each group?

A.Apply labels to each project to identify the business unit
B.Apply resource tags to each project for policy enforcement
C.Create GCP Folders for each business unit and add the relevant projects
D.Create a Shared VPC host project for each business unit
AnswerC

Folders are dedicated nodes in the GCP resource hierarchy (Organization → Folders → Projects) designed for grouping projects under a common administrative boundary. IAM policies, Organization Policies, and other settings bound to a Folder are inherited by every project in that subtree, enabling uniform access control and regulatory constraints for a business unit. Using Folders also supports delegated administration, such as granting a Project Creator role scoped to that Folder, and is the only mechanism that provides genuine hierarchical policy inheritance across multiple projects.

Why this answer

C is correct because GCP Folders are the hierarchical resource designed to group projects under an organization node, allowing you to apply shared IAM policies at the folder level that automatically propagate to all projects within that folder. This aligns with the requirement to organize projects by business unit and enforce consistent access controls across each group.

Exam trap

The trap here is that candidates often confuse labels or tags with hierarchical grouping, assuming metadata-based organization can substitute for the IAM inheritance provided by Folders, but only Folders (or Organization nodes) support policy propagation across projects.

How to eliminate wrong answers

Option A is wrong because labels are key-value metadata used for resource organization and cost tracking, but they do not support inheritance of IAM policies across projects. Option B is wrong because resource tags (now called 'tags' in GCP) are used for conditional policy enforcement and network firewall rules, not for hierarchical grouping with IAM policy inheritance. Option D is wrong because a Shared VPC host project allows multiple service projects to share a common VPC network, but it does not group projects for IAM policy inheritance across unrelated projects; it only provides network-level isolation and sharing.

99
MCQmedium

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

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

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

Why this answer

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

100
MCQmedium

A company wants to migrate an on-premises MySQL database to Cloud SQL. They need to import an existing SQL dump file stored in a Cloud Storage bucket. Which command should they use?

A.gcloud compute ssh my-instance --command='mysql < dump.sql'
B.gcloud sql import sql my-instance gs://my-bucket/dump.sql --database=mydb
C.gcloud sql databases create mydb --instance=my-instance --import=gs://my-bucket/dump.sql
D.gsutil cp gs://my-bucket/dump.sql | mysql -h my-instance -u root -p
AnswerB

This is the correct command to import a SQL dump file into a Cloud SQL MySQL instance. The `gcloud sql import sql` command takes the instance name, the Cloud Storage URI of the dump, and the `--database` flag to specify the target database. The Cloud SQL instance's service account must have `storage.objectViewer` permission on the bucket, and the database must already exist. This is the supported, asynchronous import method for managed Cloud SQL.

Why this answer

gcloud sql import sql is the correct command to import a SQL dump file into a Cloud SQL instance. The command specifies the instance, the bucket path, and the database name.

101
MCQeasy

A Cloud Run service handles payment processing. A monitoring alert shows the service is experiencing 3-second P99 latency, up from its normal 200ms. The team wants to find the slowest individual requests in the last hour. Which tool provides per-request latency data?

A.Cloud Monitoring — check the request_latencies metric distribution
B.Cloud Trace — sort traces by latency in the last hour
C.Cloud Logging — filter for requests with duration > 3s
D.Cloud Profiler — view the slowest functions in the last hour
AnswerB

Cloud Trace is the correct choice because it is a distributed tracing system that records each incoming request as a trace, composed of individual spans for every operation within that request. The Trace list view allows you to filter by a specific time range, such as the last hour, and directly sort traces by total latency. This surface immediately surfaces the slowest end-to-end requests, and you can click into a trace to see a detailed waterfall breakdown of where time is spent in the request path.

Why this answer

Cloud Trace is designed to capture end-to-end latency for individual requests, allowing you to sort and identify the slowest requests in a specific time range. The P99 latency increase indicates a tail-latency problem, and Trace provides per-request granularity to pinpoint the exact slow requests. This makes it the correct tool for finding the slowest individual requests in the last hour.

Exam trap

Google Cloud often tests the distinction between aggregated metrics (Cloud Monitoring) and per-request tracing (Cloud Trace), trapping candidates who assume a metric distribution can identify individual slow requests.

How to eliminate wrong answers

Option A is wrong because Cloud Monitoring's request_latencies metric is a distribution (e.g., histogram) that shows aggregated percentiles like P99, not individual request latencies. Option C is wrong because Cloud Logging does not natively include a 'duration' field for HTTP requests unless you explicitly log it; even then, filtering for >3s would show all requests exceeding that threshold, not the slowest ones sorted by latency. Option D is wrong because Cloud Profiler samples function call stacks and CPU/memory usage, not per-request latency data; it identifies slow functions, not slow individual requests.

102
MCQmedium

A developer works across five different GCP projects daily and wants to switch their active project in the gcloud CLI without rerunning `gcloud init`. Which command should they use?

A.gcloud projects switch [PROJECT_ID]
B.gcloud config set project [PROJECT_ID]
C.gcloud auth set-project [PROJECT_ID]
D.gcloud init --project=[PROJECT_ID]
AnswerB

Correct: `gcloud config set project [PROJECT_ID]` modifies the `project` property inside the current gcloud configuration. This persistently changes the default project for subsequent commands without rerunning the interactive `gcloud init` wizard. The change takes effect immediately, and it can be verified with `gcloud config get-value project` or overridden per-command using the `--project` flag.

Why this answer

The `gcloud config set project [PROJECT_ID]` command updates the `core/project` property in the active gcloud CLI configuration, allowing the developer to switch the active project without re-running `gcloud init`. This is the standard method for changing the project context in the current configuration, which persists across sessions until changed again.

Exam trap

Google Cloud often tests the distinction between `gcloud config set` and `gcloud init`, trapping candidates who think they must reinitialize the CLI to change the active project, when in fact only a property update is needed.

How to eliminate wrong answers

Option A is wrong because `gcloud projects switch` is not a valid gcloud command; the correct verb for switching context is `config set`, not a subcommand under `projects`. Option C is wrong because `gcloud auth set-project` does not exist; authentication and project configuration are separate concerns — `gcloud auth` handles credentials, not project settings. Option D is wrong because `gcloud init --project=[PROJECT_ID]` would reinitialize the entire configuration, which is unnecessary and slower than simply updating the project property; it also overwrites other settings like region and zone, which the developer likely wants to preserve.

103
MCQmedium

A Go service is consuming significantly more CPU than expected. The team suspects an inefficient function but doesn't know which one. Which Cloud Operations tool identifies CPU hotspots in production code?

A.Cloud Debugger
B.Cloud Trace
C.Cloud Profiler
D.Cloud Monitoring custom dashboards
AnswerC

Cloud Profiler is the correct choice because it continuously samples production applications with low overhead, recording call stacks and generating flame graphs. Those flame graphs visually rank functions by CPU utilization, letting you identify exactly which code paths consume the most CPU even in a distributed environment.

Why this answer

Cloud Profiler is the correct tool because it continuously gathers CPU and heap usage data from production services using statistical sampling, then presents a flame graph or call tree that pinpoints which functions consume the most CPU. Unlike debugging or tracing tools, Profiler is designed specifically for identifying performance bottlenecks like CPU hotspots with minimal overhead, making it ideal for diagnosing an inefficient function in a Go service running in production.

Exam trap

Google Cloud often tests the distinction between latency-focused tools (Trace) and resource-usage-focused tools (Profiler), and the trap here is that candidates confuse 'slow function' (latency) with 'CPU-hungry function' (resource consumption), leading them to pick Cloud Trace instead of Cloud Profiler.

How to eliminate wrong answers

Option A is wrong because Cloud Debugger is used for inspecting application state (variables, stack traces) at a specific point in time without stopping the service, but it does not collect or aggregate CPU usage data over time to identify hotspots. Option B is wrong because Cloud Trace focuses on latency analysis of requests and spans, measuring how long operations take, not CPU consumption; it can show slow operations but cannot attribute CPU usage to specific functions. Option D is wrong because Cloud Monitoring custom dashboards display metrics like CPU utilization at the instance or container level, but they cannot drill down into function-level CPU hotspots within the application code.

104
MCQeasy

Which console page would you use to create and manage custom IAM roles?

A.IAM & Admin > Audit Logs
B.IAM & Admin > Roles
C.IAM & Admin > Organization Policies
D.IAM & Admin > Service Accounts
AnswerB

IAM & Admin > Roles is the correct page because it is the dedicated console surface for managing both predefined and custom roles within a project, folder, or organization. From this page you can click "Create Role" to assign a title, description, ID, and select specific permissions to build a custom role, or you can clone and edit existing roles that you own. This page directly supports the lifecycle of custom IAM roles, including editing role permissions, deleting custom roles, and managing role bindings.

Why this answer

The IAM & Admin > Roles page in the Google Cloud Console is the dedicated interface for creating, editing, and managing custom IAM roles. Custom roles allow you to define a precise set of permissions that are not available in predefined roles, giving you granular control over access to Google Cloud resources. This page also lists all predefined and custom roles, and allows you to clone, delete, or update role definitions.

Exam trap

Google Cloud often tests the distinction between managing IAM roles (which is done in the Roles page) and managing service accounts (which is done in the Service Accounts page), leading candidates to confuse the two because both involve identity and access management.

How to eliminate wrong answers

Option A is wrong because Audit Logs is used to view and configure audit logs for tracking admin activity, data access, and system events, not for creating or managing IAM roles. Option C is wrong because Organization Policies are used to set constraints on Google Cloud resources at the organization, folder, or project level (e.g., restricting resource locations or disabling service creation), not for defining IAM roles. Option D is wrong because Service Accounts is the page for managing service account identities and their keys, not for creating or managing IAM roles.

105
MCQmedium

A company is using Cloud Storage to store sensitive data. They want to enforce that objects are automatically deleted after 90 days. Which configuration should they use?

A.Configure Object Lifecycle Management with a Delete action after 90 days.
B.Set a retention policy on the bucket for 90 days.
C.Enable bucket locking with a retention period of 90 days.
D.Enable object versioning and set a lifecycle rule to delete noncurrent versions.
AnswerA

Object Lifecycle Management is the native Cloud Storage mechanism for automatically deleting objects when they reach a specific age. A lifecycle rule with a Delete action after 90 days triggers the deletion of all current objects that have existed for more than 90 days, without requiring manual intervention or further scripted processes. This precisely matches the requirement to remove sensitive data after the 90-day retention window.

Why this answer

Object Lifecycle Management allows you to set rules that automatically perform actions on objects after a specified number of days. By configuring a rule with a Delete action set to trigger after 90 days, objects in the bucket will be automatically removed, meeting the requirement without manual intervention.

Exam trap

Google Cloud often tests the distinction between retention policies (which protect data from deletion) and lifecycle rules (which automate deletion), leading candidates to confuse a retention policy with a deletion policy.

How to eliminate wrong answers

Option B is wrong because a retention policy on a bucket prevents objects from being deleted or overwritten until the retention period expires, which is the opposite of automatically deleting objects after 90 days. Option C is wrong because bucket locking with a retention period enforces a write-once-read-many (WORM) policy that prevents object deletion or modification, not automatic deletion. Option D is wrong because enabling object versioning and setting a lifecycle rule to delete noncurrent versions only removes older versions of objects, not the current live objects, and does not guarantee deletion of all objects after 90 days.

106
MCQmedium

A developer wants to authenticate to GCP from their local machine using their own user account to run gcloud commands that interact with a project. They have already installed the Cloud SDK. Which command should they use to authenticate with their Google account?

A.gcloud init
B.gcloud auth activate-service-account
C.gcloud auth login
D.gcloud auth application-default login
AnswerC

gcloud auth login is the correct command because it launches an OAuth 2.0 authorization flow, typically opening a browser where the developer signs in with their Google account and grants consent to GCP scopes. Upon successful authentication, it saves the resulting user credentials in the credentials directory and sets them as the active account for subsequent gcloud CLI operations. This is the standard, direct way for a human developer to authenticate the gcloud command-line tool with their personal or Google Workspace user identity from a local machine.

Why this answer

`gcloud auth login` authenticates using a user account (OAuth 2.0) and is appropriate for interactive use. `gcloud auth application-default login` is for application credentials.

107
MCQhard

A company runs a big data processing pipeline on a Dataproc cluster. To reduce costs, they use a primary cluster with one master node (standard) and 20 worker nodes all using preemptible VMs. Recently, jobs running during peak business hours are failing with 'Task failed' errors. You notice that many preemptible VMs are reclaimed during the middle of these jobs. The jobs are long-running MapReduce tasks that write intermediate results to the cluster's HDFS. What should you do to improve job reliability without significantly increasing costs?

A.Enable graceful decommissioning for the preemptible instances.
B.Increase the number of preemptible worker nodes to 40.
C.Use a higher preemptible instance type (e.g., n1-highmem-2 instead of n1-standard-2).
D.Switch to standard worker nodes with committed use discounts.
AnswerA

Enable graceful decommissioning so Dataproc marks a preempted node as decommissioning before shutting it down. YARN then stops placing new containers on that node and waits up to `dataproc:yarn.preemptible.graceful-decommission.timeout` for in-flight tasks to finish or spill shuffle data elsewhere. This prevents sudden task loss because YARN's NodeManager is given time to complete ongoing work instead of being killed immediately.

Why this answer

Enabling graceful decommissioning for preemptible instances allows YARN to handle node loss more gracefully. When a preemptible VM is reclaimed, YARN can wait for running containers to finish before shutting down the node, reducing task failures. This improves job reliability without adding cost, as it leverages existing preemptible VMs more effectively.

Exam trap

Google Cloud often tests the misconception that simply adding more preemptible nodes or upgrading instance types will solve reliability issues, when the real solution is to configure graceful decommissioning to handle preemption gracefully.

How to eliminate wrong answers

Option B is wrong because simply increasing the number of preemptible worker nodes to 40 does not address the root cause of task failures due to VM reclamation; it only spreads the risk but still results in lost intermediate data and failed tasks. Option C is wrong because using a higher preemptible instance type (e.g., n1-highmem-2) does not prevent preemption; it only provides more memory, which does not solve the reliability issue of task failures during reclamation. Option D is wrong because switching to standard worker nodes with committed use discounts would significantly increase costs, contradicting the requirement to not significantly increase costs.

108
MCQhard

Your Dataflow streaming pipeline is consuming messages from Pub/Sub but the pipeline's throughput has dropped significantly. Cloud Monitoring shows the `pubsub/subscription/oldest_unacked_message_age` metric is growing. The pipeline has enough workers. What is the most likely bottleneck, and how should you address it?

A.Increase the number of Dataflow workers to process messages faster.
B.Inspect Dataflow job graph metrics to identify the slow stage, then optimize that stage's logic or address data skew.
C.Increase the Pub/Sub subscription's ack deadline to 600 seconds.
D.Switch from Dataflow to Pub/Sub Lite for lower cost and higher throughput.
AnswerB

The Dataflow monitoring UI's job graph exposes per-stage counted metrics (element counts, throughput, and execution time). Pinpointing the stage with the highest processing lag or a hot key reveals whether the slowness comes from a transform's computational cost, external API latency, or data skew, enabling a targeted fix like partitioning by key or batching I/O calls instead of a blind capacity change.

Why this answer

The growing `oldest_unacked_message_age` metric indicates that messages are not being processed and acknowledged quickly enough, even though the pipeline has enough workers. This points to a bottleneck within a specific stage of the Dataflow pipeline, such as a transformation or grouping operation that is slow or suffering from data skew. Option B is correct because inspecting the job graph metrics (e.g., wall time, backlog, and throughput per stage) allows you to identify the slow stage and then optimize its logic or address data skew, which directly resolves the processing delay.

Exam trap

Google Cloud often tests the misconception that adding more workers or increasing timeouts always solves throughput issues, but the correct approach is to diagnose the specific bottleneck stage using Dataflow's built-in metrics.

How to eliminate wrong answers

Option A is wrong because the question explicitly states the pipeline has enough workers, so adding more workers would not address the root cause of a slow stage or data skew; it could even increase cost without improving throughput. Option C is wrong because increasing the ack deadline to 600 seconds only gives workers more time to process messages but does not fix the underlying bottleneck; it may delay the detection of stuck messages and could lead to duplicate processing if workers fail. Option D is wrong because switching to Pub/Sub Lite does not address a Dataflow pipeline bottleneck; Pub/Sub Lite is designed for lower cost and predictable throughput but does not resolve slow stage logic or data skew within Dataflow.

109
MCQmedium

What action does the condition in the IAM policy restrict the user from performing?

A.Deleting disks that do not start with 'disk-'
B.Performing any action on compute instances
C.Performing any compute.admin action on disks in us-central1-a with names starting with 'disk-'
D.Creating disks in any zone other than us-central1-a
AnswerA

The IAM policy grants the compute.disks.delete permission only when the condition `resource.name.startsWith('disk-')` evaluates to true. For a disk with a name that does not begin with 'disk-', the condition fails and the delete request is implicitly denied. This means the effect is exactly restricting deletion only to disks with the 'disk-' prefix, so any disk not matching that prefix cannot be deleted. That is the action the condition restricts.

Why this answer

The condition in the IAM policy restricts the user from performing actions on disks that do not meet the specified criteria. Specifically, the condition `resource.name.startsWith('disk-')` combined with the zone constraint `us-central1-a` means that only disks whose names start with 'disk-' in that zone are allowed for the granted action (e.g., `compute.disks.delete`). Therefore, the policy restricts the user from deleting disks that do not start with 'disk-'.

Option A correctly identifies this restricted action.

Exam trap

The trap is that the question asks 'what action does the condition restrict the user from performing?' Many candidates mistakenly select the allowed action (option C) instead of the restricted action (option A). The condition explicitly permits an action, so the restricted action is the complement of what is allowed.

How to eliminate wrong answers

Option A is wrong because the policy condition `resource.name.startsWith('disk-')` actually allows deletion of disks starting with 'disk-', not restricts it; the user is restricted from deleting disks that do NOT start with 'disk-', so the statement is reversed. Option B is wrong because the policy only restricts `compute.disks.delete` on disks, not all actions on compute instances; the user can still perform other actions like `compute.instances.list` or `compute.disks.create` on disks that match the condition. Option D is wrong because the policy restricts deletion to disks in `us-central1-a` only, but it does not restrict creating disks in other zones; the `compute.disks.delete` action is zone-scoped, but creation is a separate action not covered by this policy.

110
MCQmedium

A developer needs to forward traffic from their local port 5432 to a PostgreSQL service running in GKE on port 5432, to test database queries locally without exposing the database externally. Which kubectl command achieves this?

A.kubectl expose pod postgres-pod --type=LoadBalancer --port=5432
B.kubectl port-forward svc/postgres-service 5432:5432
C.kubectl tunnel --local=5432 --remote=postgres-service:5432
D.gcloud container ssh postgres-pod --port-forward=5432:5432
AnswerB

This is the correct command because `kubectl port-forward` creates a direct, temporary tunnel from the developer's localhost port 5432 to the postgres Service's port 5432 inside the cluster. It does not expose the Service externally, does not create any Service or Ingress resource, and the bind is to localhost by default, so only the developer's machine can reach it. This matches the requirement for a secure, private way to connect to the database without altering the cluster's networking. The command is also the standard way to debug or access a private Kubernetes resource from a workstation.

Why this answer

`kubectl port-forward` creates a local tunnel from port 5432 on the developer's machine to the specified service's port 5432 inside the GKE cluster. This allows the developer to connect to the PostgreSQL service as if it were running locally, without exposing it to the internet via a LoadBalancer or Ingress.

Exam trap

Google Cloud often tests the distinction between exposing a service externally (LoadBalancer) and creating a local tunnel (port-forward), and candidates may mistakenly choose a LoadBalancer option thinking it is required for connectivity, ignoring the 'without exposing externally' constraint.

How to eliminate wrong answers

Option A is wrong because `kubectl expose pod postgres-pod --type=LoadBalancer` creates an external LoadBalancer service, which exposes the database to the internet, contradicting the requirement to avoid external exposure. Option C is wrong because `kubectl tunnel` is not a valid kubectl command; the correct command for port forwarding is `kubectl port-forward`. Option D is wrong because `gcloud container ssh` is used to SSH into a GKE node, not to forward ports, and the syntax `--port-forward=5432:5432` is invalid; port forwarding is done via `kubectl port-forward`.

111
MCQhard

A company uses VPC Service Controls to protect Cloud Storage. They have a service perimeter that includes the storage API and the project where the stored data resides. Users inside the perimeter can access the data, but users outside cannot. However, a group of users outside the perimeter are able to access the data using a signed URL generated by a service inside the perimeter. Why does this happen?

A.VPC Service Controls do not apply to signed URLs.
B.Signed URLs bypass VPC Service Controls.
C.The service perimeter is misconfigured, missing signed URL restrictions.
D.The users have been granted IAM roles that override the perimeter.
AnswerA

VPC Service Controls set a security perimeter around Google Cloud APIs, but they only evaluate requests authenticated via Google identity credentials. Signed URLs are an alternative access method that authorizes access through time-limited query parameter signatures embedded in the URL, so the request never triggers VPC SC context. Therefore, VPC SC simply does not apply to signed URLs.

Why this answer

VPC Service Controls are designed to restrict access to Google Cloud resources based on the network origin of requests, but they do not evaluate or block requests made using signed URLs. Signed URLs are authenticated via cryptographic signatures, not IAM or network context, so they bypass the perimeter check entirely. This is by design, as signed URLs are intended for temporary, out-of-band access.

Exam trap

Google Cloud often tests the misconception that VPC Service Controls are a universal access control mechanism, when in fact they do not apply to signed URLs or public buckets, leading candidates to incorrectly assume a misconfiguration or override.

How to eliminate wrong answers

Option B is wrong because signed URLs do not 'bypass' VPC Service Controls in a technical sense; rather, VPC Service Controls simply do not apply to signed URL requests, as the access decision is based on the signature, not the requester's network or identity. Option C is wrong because there is no 'signed URL restriction' setting in VPC Service Controls; the service perimeter configuration is correct, and the behavior is expected. Option D is wrong because IAM roles are not the mechanism at play here; signed URLs do not require IAM roles to be granted to the end user, and the perimeter does not evaluate IAM for signed URL requests.

112
MCQmedium

You need to deploy a containerized application to GKE that stores user session data. The application has 3 replicas. Session data must not be lost if a replica is restarted. All replicas share the same session store. Which architecture handles this correctly?

A.Store sessions in each pod's memory; use session affinity on the load balancer to route users to the same pod.
B.Store sessions in Cloud Memorystore (Redis) shared by all replicas.
C.Use an emptyDir volume shared between replicas for session storage.
D.Store sessions in a Cloud SQL table with a connection pool per replica.
AnswerB

Store sessions in Google Cloud Memorystore for Redis, a fully managed, in-memory data store that provides sub-millisecond read/write latency. By keeping session data in a single shared Redis instance external to the pods, all replicas can read and write the same session state without coupling to a specific pod. Because the data lives outside the pod, rolling updates, autoscaling, and pod restarts do not invalidate user sessions. Memorystore also supports native TTL expiration for session keys and can be configured with persistence or high availability to protect against cache loss.

Why this answer

Cloud Memorystore (Redis) provides a centralized, persistent, and highly available session store that all replicas can access. This ensures session data survives pod restarts and is shared across all replicas, meeting the requirement for no data loss and shared access.

Exam trap

Google Cloud often tests the misconception that session affinity alone ensures session persistence, but the trap here is that session affinity only routes traffic to the same pod, not that the pod's memory survives restarts, so candidates must recognize that shared external storage is required for data durability.

How to eliminate wrong answers

Option A is wrong because storing sessions in each pod's memory means data is lost if a pod restarts, and session affinity only routes users to the same pod but does not prevent data loss on restart. Option C is wrong because an emptyDir volume is ephemeral and tied to a pod's lifecycle; it is deleted when the pod is deleted or restarted, and it cannot be shared across replicas in different pods. Option D is wrong because while Cloud SQL can persist data, using a connection pool per replica does not address session storage efficiently; sessions are transient and high-frequency, making a relational database like Cloud SQL less suitable than an in-memory store like Redis for performance and cost.

113
MCQmedium

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

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

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

Why this answer

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

114
MCQmedium

A company has a Cloud SQL instance with CMEK enabled. The Cloud KMS key used for encryption is accidentally disabled. What is the impact on the Cloud SQL instance?

A.The instance will be automatically deleted after 30 days.
B.The instance becomes unavailable and cannot be started until the key is re-enabled.
C.A read replica can be promoted to replace the primary.
D.The instance continues to operate normally, but new data cannot be encrypted.
AnswerB

Cloud SQL with CMEK uses the customer-managed key for every data-plane operation, including reads and writes to the database, logs, and system tables. When the key is disabled, the instance loses access to the key material, causing the database engine to fail all I/O requests immediately. Consequently, the instance becomes unavailable and cannot be started or used until the key is re-enabled in Cloud KMS; re-enabling the key automatically restores normal operation without manual intervention.

Why this answer

When a CMEK key is disabled, the Cloud SQL instance becomes unavailable because the database cannot encrypt or decrypt data. The instance cannot be started or used until the key is re-enabled.

115
MCQmedium

A company wants to use Cloud Functions to process events from Cloud Storage when new objects are uploaded. They need the function to run in a specific VPC network for tight security. Which Cloud Functions generation supports VPC connectivity?

A.Cloud Functions (2nd gen) with VPC connector
B.Cloud Functions (1st gen) with VPC connector
C.Cloud Functions (2nd gen) with Cloud VPN
D.Cloud Functions (1st gen) with Cloud NAT
AnswerA

Cloud Functions (2nd gen) is built on Cloud Run and supports a Serverless VPC Access connector that makes the function a first-class citizen inside your VPC. With 2nd gen you can attach a VPC connector and set egress settings to route all outbound traffic through it, so the function can reach private resources using internal IPs. This also enables private inbound triggers, meaning the function can be invoked internally within the VPC, which is exactly what is needed to process events from a private resource.

Why this answer

Cloud Functions (2nd gen) is built on Cloud Run and supports VPC connectivity via connectors or direct VPC. 1st gen does not support VPC connectors for ingress/egress in the same way. 2nd gen is recommended for VPC network integration.

116
Multi-Selecteasy

Which THREE actions are recommended to ensure the successful operation of a Compute Engine instance running a production workload?

Select 3 answers
A.Enable deletion protection on the instance.
B.Set up a health check and autohealing policy for the instance group.
C.Use a custom VPC with a subnet in a single zone.
D.Configure snapshots with a retention policy.
E.Attach a GPU for machine learning inference.
AnswersA, B, D

Enabling deletion protection prevents accidental deletion of the instance, which is critical for production workloads.

Why this answer

Enabling deletion protection (A) prevents accidental deletion of the instance. Configuring snapshots with a retention policy (D) ensures data backup and recovery. Setting up a health check and autohealing policy (B) automatically recreates unhealthy instances, improving availability.

Option C (using a custom VPC with a single-zone subnet) reduces fault tolerance, which is not recommended for production workloads. Option E (attaching a GPU) is only needed for specific workloads like machine learning, not a general best practice.

117
Multi-Selecteasy

A new developer is setting up their first Google Cloud project. They need to perform initial project configuration. Which TWO actions are necessary before they can create any resources? (Choose TWO.)

Select 1 answer
A.Create a custom IAM role.
B.Set up Identity Platform.
C.Create a VPC network.
D.Enable billing for the project.
E.Enable the Cloud Billing API.
AnswersD

Billing must be enabled for the project to create any resources that incur costs; this is a necessary step.

Why this answer

To create any resources in a Google Cloud project, billing must be enabled for the project. This is the only essential step among the options. Enabling the Cloud Billing API is not required because billing can be enabled through the Cloud Console without API calls.

The other options—creating a custom IAM role, setting up Identity Platform, or creating a VPC network—are optional and not prerequisites for initial resource creation. While some resources may require specific APIs, enabling the Cloud Billing API itself is not a necessary step.

Exam trap

Candidates often mistakenly think that enabling the Cloud Billing API is the same as enabling billing, but billing can be enabled without the API.

118
MCQhard

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

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

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

Why this answer

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

119
MCQmedium

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

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

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

Why this answer

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

120
MCQeasy

You need to view the current IAM policy for a project named 'my-project' in JSON format. Which command should you use?

A.gcloud projects add-iam-policy-binding my-project --format json
B.gcloud projects get-iam-policy my-project --format json
C.gcloud iam service-accounts list --project my-project
D.gcloud projects set-iam-policy my-project policy.json
AnswerB

`gcloud projects get-iam-policy my-project --format json` is the correct command for viewing the current IAM policy of a project. It retrieves the full policy, including all role bindings, conditions, and the etag, and returns it in a structured JSON format. The `--format json` flag ensures the output is machine-readable, which is useful for auditing, scripting, or feeding into other tools like `jq`. This command performs no mutation and is the standard way to inspect IAM policy state.

Why this answer

The correct command is 'gcloud projects get-iam-policy my-project --format json'. The 'add-iam-policy-binding' command is for adding bindings, 'set-iam-policy' is for setting from a file, and 'list' is not a valid subcommand for IAM policies.

121
MCQmedium

A company needs to run a batch job every hour on a Compute Engine VM. The VM should be terminated after the job completes to save costs. The job is run from a script inside a custom container image stored in Container Registry. Which approach is the most cost-effective?

A.Create a VM with a preemptible instance setting and a startup script that runs the container, then shuts down the VM
B.Use a managed instance group with autoscaling and a target CPU load of 0%
C.Use a regular VM and stop it manually when the job finishes
D.Use Cloud Run with a scheduled job
AnswerA

This is correct because a preemptible VM costs significantly less than a standard VM and is ideal for fault-tolerant batch processing. The startup script automatically runs the container when the VM boots, and once the job completes, the script shuts down the VM to stop compute billing. Although preemptible VMs can be reclaimed by Google at any time, a job running hourly can simply retry on the next scheduled run. You still pay for the persistent disk while the VM exists, but the compute cost savings far outweigh that.

Why this answer

Compute Engine preemptible VMs are up to 60-91% cheaper than regular VMs. For batch jobs that can be interrupted, they are highly cost-effective. Combining with a startup script that pulls and runs the container, and having the script shut down the VM after the job, minimizes costs.

122
MCQmedium

An operations team wants to count how many times the string 'PaymentFailure' appears in application logs per minute and alert when it exceeds 10 occurrences. Cloud Monitoring doesn't have a native metric for this log pattern. What is the correct approach?

A.Create a Cloud Monitoring custom metric and write values via the application's exception handler
B.Create a log-based metric in Cloud Logging with a filter matching 'PaymentFailure', then alert on it in Cloud Monitoring
C.Export logs to BigQuery and run a scheduled query counting PaymentFailure entries
D.Enable Cloud Trace and look for PaymentFailure in trace annotations
AnswerB

A log-based metric in Cloud Logging lets you define a filter, such as 'jsonPayload.message="PaymentFailure"', and Cloud Logging automatically counts matching entries as a time-series metric with minimal latency. This metric appears directly in Cloud Monitoring, where you can set an alerting policy to trigger when the count crosses a threshold. Because it uses the log stream the application already writes, it requires no code changes and monitors all services that emit matching logs, making it the correct solution for real-time error rate alerting.

Why this answer

Cloud Logging log-based metrics allow you to define a filter (e.g., `textPayload:"PaymentFailure"`) that counts matching log entries in real time, and Cloud Monitoring can directly create an alerting policy on that metric with a threshold of 10 occurrences per minute. This approach avoids custom code, external exports, or additional services, and it leverages the native integration between Cloud Logging and Cloud Monitoring.

Exam trap

Google Cloud often tests the distinction between native log-based metrics (which require no code or external services) and custom metrics or export-based solutions, leading candidates to overcomplicate the answer by choosing BigQuery or custom code.

How to eliminate wrong answers

Option A is wrong because creating a custom metric via the application's exception handler requires modifying application code and introduces latency and reliability issues, whereas a log-based metric is serverless and automatically counts log entries without code changes. Option C is wrong because exporting logs to BigQuery and running a scheduled query adds unnecessary complexity, cost, and delay (minutes to hours) compared to near-real-time log-based metrics. Option D is wrong because Cloud Trace is designed for distributed tracing of request latency, not for counting log patterns; it does not provide a metric for the frequency of a string in logs.

123
MCQmedium

A developer reports that a Cloud Function is failing with '403 Forbidden' when calling the BigQuery API. The function's service account has the BigQuery Data Viewer role. What is a likely additional requirement that may be missing?

A.The Cloud Function must be deployed in the same region as the BigQuery dataset
B.The BigQuery API may not be enabled in the Cloud Functions' project
C.Cloud Functions cannot call BigQuery — it must use Dataflow or BigQuery scheduled queries instead
D.The service account needs the BigQuery Admin role instead of Data Viewer to make API calls
AnswerB

Google Cloud requires the BigQuery API (bigquery.googleapis.com) to be explicitly enabled on the project where the Cloud Function runs. Even if the function's service account has BigQuery Data Viewer or Admin permissions, calls to bigquery.googleapis.com will fail with an error such as 'API has not been used in project X before or it is disabled' when the API is off. Enabling the API in the Cloud Functions project is a prerequisite that developers often overlook when debugging 'permission denied' messages.

Why this answer

The 403 Forbidden error indicates that the Cloud Function's service account lacks the necessary permissions to call the BigQuery API. Even with the correct IAM role (BigQuery Data Viewer), the BigQuery API must be explicitly enabled in the project where the Cloud Function is running, as Google Cloud requires APIs to be activated per project before they can be used. Without enabling the API, any API call from the function will be rejected with a 403, regardless of IAM roles.

Exam trap

Google Cloud often tests the distinction between IAM permissions and API enablement, trapping candidates who assume a 403 always means a missing IAM role rather than a disabled API.

How to eliminate wrong answers

Option A is wrong because Cloud Functions and BigQuery datasets can be in different regions; cross-region access is supported via the BigQuery API, and region mismatch does not cause a 403 error. Option C is wrong because Cloud Functions can directly call the BigQuery API using client libraries or REST requests; Dataflow or scheduled queries are alternative tools, not mandatory replacements. Option D is wrong because the BigQuery Data Viewer role is sufficient for read-only API calls like queries; the 403 is not due to insufficient IAM permissions but because the API itself is not enabled.

124
MCQeasy

You want to receive email notifications when your GCP project's billing reaches 50%, 80%, and 100% of a monthly budget. Which GCP feature should you configure?

A.Cloud Monitoring alerting policies on billing metrics.
B.Cloud Billing Budget with alert thresholds at 50%, 80%, and 100%.
C.Set a project spending limit in the Cloud Console billing settings.
D.Enable billing export to BigQuery and create a scheduled query that sends alert emails.
AnswerB

Cloud Billing Budget is the purpose-built feature for monitoring spend: it lets you set a budget amount and define multiple percentage-based alert thresholds (50%, 80%, 100%) that trigger notifications when actual or forecasted costs cross each threshold. Alerts are delivered either to billing account contacts via email or programmatically through Pub/Sub, enabling immediate, low-cost monitoring without custom tooling. Importantly, the budget itself never stops spending; it only notifies you, which is exactly what the question asks for.

Why this answer

Cloud Billing Budgets allow you to set a budget amount for a GCP project and define alert threshold percentages (e.g., 50%, 80%, 100%). When the actual cost or forecasted cost reaches any threshold, Cloud Billing automatically sends email notifications to Billing Administrators and users you specify. This is the native, purpose-built feature for budget-based billing alerts.

Exam trap

The trap here is that candidates may confuse Cloud Monitoring alerting policies (which can monitor billing metrics but require manual setup for percentage thresholds) with the simpler, built-in Cloud Billing Budget feature that directly supports percentage-based email alerts.

How to eliminate wrong answers

Option A is wrong because Cloud Monitoring alerting policies can monitor billing metrics exported to Cloud Monitoring, but they do not natively support percentage-based budget thresholds or automatic email notifications for budget milestones without custom configuration. Option C is wrong because setting a project spending limit in the Cloud Console billing settings only caps the spend (and disables the project if exceeded), but it does not provide alert notifications at specific percentage thresholds. Option D is wrong because enabling billing export to BigQuery and creating a scheduled query that sends alert emails is a complex, custom workaround; it is not a built-in feature for simple threshold-based email alerts and requires additional scripting and infrastructure.

125
MCQhard

A data warehouse team queries a 10 TB BigQuery table containing billions of events with a date column. Most queries filter by a date range (e.g., last 30 days). Without any partitioning, queries scan the full 10 TB every time. Which BigQuery feature eliminates unnecessary data scanning for date-range queries?

A.BigQuery table clustering on the date column
B.Creating a materialized view for the last 30 days
C.Date/timestamp partitioned table on the date column
D.Increasing BigQuery slot reservations for faster full-table scans
AnswerC

Partitioning by a DATE/TIMESTAMP column physically organizes the table into discrete segments (e.g., per day, month, or year). A query that filters on that column with a range predicate triggers partition pruning, so BigQuery scans only the segments that match the filter rather than the entire table. This directly cuts the number of bytes billed, which is the primary cost driver in BigQuery, making it the most effective solution for frequent date-range analysis.

Why this answer

Partitioning a BigQuery table by the date column allows the query engine to prune entire partitions that fall outside the specified date range, so only the relevant partitions (e.g., last 30 days) are scanned instead of the full 10 TB. This directly reduces data scanned and cost, making option C the correct choice for eliminating unnecessary scanning in date-range queries.

Exam trap

Google Cloud often tests the distinction between partitioning (physical data separation) and clustering (logical sorting within a table), leading candidates to mistakenly choose clustering as a cost-saving measure when only partitioning actually prunes data at the storage level.

How to eliminate wrong answers

Option A is wrong because clustering sorts data within a table but does not physically separate data into partitions; queries still scan all blocks unless combined with partitioning, so it does not eliminate full-table scans on its own. Option B is wrong because a materialized view stores precomputed results but still requires the base table to be scanned for incremental refreshes unless the view is also partitioned, and it adds storage and maintenance overhead without solving the core scanning issue. Option D is wrong because increasing slot reservations only allocates more compute resources for faster processing of full-table scans; it does not reduce the amount of data scanned, so it fails to address the root problem of scanning 10 TB unnecessarily.

126
MCQmedium

A mobile app needs a managed database to store user profiles with flexible nested structures that evolve frequently — new fields are added without schema migrations. Which GCP database service is most appropriate?

A.Cloud SQL for PostgreSQL
B.Cloud Bigtable
C.Cloud Firestore
D.Cloud Spanner
AnswerC

Cloud Firestore is a serverless, document-oriented NoSQL database that stores data as flexible JSON-like documents with nested fields. It supports schema evolution automatically—new fields can be added without migrations or downtime—and its real-time listeners and client SDKs are purpose-built for mobile/web app backends. Firestore also provides ACID transactions at the document level and auto-scaling, making it the ideal choice for storing app user profiles that change shape frequently.

Why this answer

Cloud Firestore is a NoSQL document database that supports flexible, nested data structures and automatically handles schema evolution. New fields can be added to documents at any time without requiring migrations, making it ideal for user profiles that change frequently. It also provides real-time synchronization and offline support, which are common requirements for mobile apps.

Exam trap

The trap here is that candidates often confuse Cloud Firestore with Cloud Bigtable, assuming both are NoSQL and therefore interchangeable, but Bigtable is designed for flat, wide-column data and lacks support for nested documents and real-time queries.

How to eliminate wrong answers

Option A is wrong because Cloud SQL for PostgreSQL is a relational database that requires a fixed schema; adding new fields would require ALTER TABLE migrations, which contradicts the requirement for flexible, evolving nested structures. Option B is wrong because Cloud Bigtable is a wide-column NoSQL database optimized for high-throughput, low-latency analytical workloads (e.g., time-series, IoT), not for storing complex nested documents with frequent schema changes. Option D is wrong because Cloud Spanner is a globally distributed relational database that enforces strong schema constraints and ACID transactions; while it supports some schema changes, it is not designed for flexible nested structures and would require migrations for new fields.

127
MCQmedium

A GKE cluster hosts both a public-facing web application and an internal data processing service. The data processing service should only accept traffic from the web application Pods, not from the internet. Which Kubernetes feature enforces this policy?

A.A VPC firewall rule blocking external traffic to the data service's Node IPs
B.Kubernetes NetworkPolicy restricting ingress to the data service to only Pods with the web app label
C.IAP (Identity-Aware Proxy) configured on the data service
D.Using a private ClusterIP Service for the data service — it's automatically private
AnswerB

A Kubernetes NetworkPolicy with an ingress rule that selects Pods carrying the web app label provides exactly the required Pod-level isolation, filtering traffic at the source and destination Pod regardless of node placement. Because the policy's podSelector matches only those web app Pods, all other Pods are denied by default, and GKE enforces this via its network policy engine (e.g., Dataplane V2 or Calico), making it the correct solution.

Why this answer

Kubernetes NetworkPolicy is the native Kubernetes resource that controls traffic flow at the IP address or port level (OSI layer 3 or 4). By defining an ingress rule that allows traffic only from Pods with a specific label (e.g., 'app: web-app'), you can restrict access to the data processing service exclusively to the web application Pods, regardless of whether the service is exposed via ClusterIP, NodePort, or LoadBalancer. This is the correct and recommended approach for pod-level network segmentation within a cluster.

Exam trap

Google Cloud often tests the misconception that a ClusterIP Service is inherently private and restricts access to only certain Pods, but in reality, ClusterIP only limits external exposure; any Pod in the cluster can reach it unless a NetworkPolicy explicitly denies or allows traffic based on labels.

How to eliminate wrong answers

Option A is wrong because VPC firewall rules operate at the infrastructure level (VM/node network interfaces) and cannot distinguish traffic between Pods on the same node or across nodes within the cluster; they would block all external traffic to the node's IPs but would not prevent other Pods (or even the web app Pods) from reaching the data service if it's exposed via NodePort. Option C is wrong because IAP (Identity-Aware Proxy) is a Google Cloud service for controlling access to applications based on user identity and context, not for pod-to-pod network traffic within a GKE cluster; it operates at the application layer and requires an HTTPS load balancer, not a Kubernetes-native policy. Option D is wrong because a private ClusterIP Service is only private in the sense that it is not exposed outside the cluster, but any Pod within the cluster can still reach it by default; it does not restrict which Pods can initiate connections to the service.

128
MCQhard

A team needs to export all Cloud Logging entries from a production GCP project to a BigQuery dataset for long-term analysis and compliance. The export must be near-real-time and include future log entries automatically. Which approach achieves this?

A.Schedule a daily Cloud Function to query the Logging API and write results to BigQuery
B.Create a log sink (Log Router) that routes all logs from the project to the BigQuery dataset
C.Use BigQuery Data Transfer Service to pull logs from Cloud Logging on a schedule
D.Enable VPC Flow Logs and stream them directly to BigQuery
AnswerB

A log sink configured in the Log Router provides a managed, continuous export path: every matching log entry is streamed to the specified BigQuery dataset in near-real-time, with no further manual steps or custom code required. Because the sink is evaluated at ingestion time, all future logs are automatically routed as they are written, including newly created log streams and resource types. This is the recommended and only fully managed way to achieve ongoing, low-latency Cloud Logging export to BigQuery.

Why this answer

A log sink (Log Router) in Cloud Logging can be configured to route log entries in near-real-time to a BigQuery dataset. This approach automatically includes all future log entries without requiring any scheduled jobs or manual intervention, making it ideal for long-term analysis and compliance.

Exam trap

The trap here is that candidates may confuse BigQuery Data Transfer Service with a general-purpose data ingestion tool, but it does not support Cloud Logging as a source, leading them to choose option C instead of the correct log sink approach.

How to eliminate wrong answers

Option A is wrong because scheduling a daily Cloud Function to query the Logging API and write results to BigQuery introduces latency (up to 24 hours) and is not near-real-time; it also requires custom code to handle pagination and deduplication. Option C is wrong because BigQuery Data Transfer Service does not support Cloud Logging as a source; it is designed for transferring data from services like Google Ads, Amazon S3, or Teradata, not for streaming log entries. Option D is wrong because VPC Flow Logs only capture network traffic metadata, not all Cloud Logging entries (e.g., application logs, audit logs), and they cannot be streamed directly to BigQuery without an intermediary sink or export.

129
MCQhard

A company runs a batch processing workload on Compute Engine that completes in 30 minutes. The workload is CPU-intensive and runs once daily. The company wants to minimize costs while maintaining performance. Which of the following is the most cost-effective compute option?

A.Use a preemptible custom machine type with 4 vCPUs and 8 GB memory.
B.Use a sole-tenant node with a machine type that matches the workload.
C.Use an N1 standard-4 machine without discounts.
D.Purchase a 1-year committed use discount for the appropriate machine type.
AnswerA

Preemptible instances are subject to termination by Compute Engine at any time (within 24 hours) but cost up to 60-91% less than standard VMs, making them ideal for idempotent or restartable batch work that runs only 30 minutes per day. A custom machine type with 4 vCPUs and 8 GB memory precisely matches your workload's resource requirements, avoiding the cost of the unused 8 GB included in a standard machine. This combination delivers the lowest effective cost while still being fault-tolerant: if a preemptible instance is reclaimed mid-job, you simply retry on a newly created instance.

Why this answer

A preemptible custom machine type with 4 vCPUs and 8 GB memory is the most cost-effective option because the workload is batch, CPU-intensive, fault-tolerant (runs once daily and can be restarted), and completes in 30 minutes — well within the 24-hour maximum preemptible VM lifetime. Preemptible instances offer up to 80% cost savings over standard instances, and a custom machine type avoids paying for unused resources, making this the cheapest viable compute option.

Exam trap

The trap here is that candidates assume committed use discounts (CUDs) are always the cheapest option, but they fail to recognize that preemptible instances are significantly cheaper for short, fault-tolerant batch workloads that do not require sustained usage.

How to eliminate wrong answers

Option B is wrong because sole-tenant nodes are designed for workloads requiring physical server isolation (e.g., licensing or compliance), which adds significant cost without any performance benefit for a standard batch job. Option C is wrong because an N1 standard-4 machine without discounts is a standard (on-demand) instance, which costs more than a preemptible instance for the same vCPU and memory capacity, and the workload is fault-tolerant so preemptible is appropriate. Option D is wrong because a 1-year committed use discount (CUD) requires a financial commitment for a full year, which is not cost-effective for a workload that runs only once daily for 30 minutes; the savings from CUDs are outweighed by the much lower cost of preemptible instances for such a short, infrequent job.

130
MCQhard

Your organization policy at the root level sets `gcp.resourceLocations` to allow only `us-central1` and `us-east1`. A business unit needs to deploy resources in `europe-west1` for GDPR compliance. How can you grant this exception without affecting other business units?

A.Create a separate GCP organization for the business unit and configure its own resource location policy.
B.Set a `gcp.resourceLocations` policy on the business unit's folder with `inheritFromParent: false`, allowing `us-central1`, `us-east1`, and `europe-west1`.
C.Add a `europe-west1` exception to the root org policy using the `exceptions` field.
D.Remove the `gcp.resourceLocations` org policy from the root and apply it to each business unit's folder individually.
AnswerB

Setting a folder-level policy with inheritFromParent:false replaces the inherited root policy entirely for that folder, so the business unit's projects can explicitly allow us-central1, us-east1, and europe-west1 without changing the restriction for other business units. This is the native org-policy mechanism for granting location exceptions, because the folder becomes the effective enforcement point for its descendants. The root policy remains in place as the default for all other resources, maintaining a secure baseline.

Why this answer

Organization Policies support hierarchical inheritance, and setting `inheritFromParent: false` on the business unit's folder allows you to override the root-level `gcp.resourceLocations` constraint. This enables you to define a custom list of allowed locations (including `europe-west1`) for that specific folder without affecting other business units, as the policy is scoped to that folder only.

Exam trap

Google Cloud often tests the misconception that you can add exceptions to list constraints like `gcp.resourceLocations` using an exceptions field, but in reality, list constraints only support allow or deny lists with inheritance override, not per-value exceptions.

How to eliminate wrong answers

Option A is wrong because creating a separate GCP organization is unnecessary overhead and violates the principle of least privilege; you can achieve the exception with folder-level policy inheritance. Option C is wrong because the `gcp.resourceLocations` constraint does not support an `exceptions` field; exceptions are not a feature of this specific constraint type. Option D is wrong because removing the root-level policy would remove the baseline restriction for all business units, forcing you to reapply policies to every folder, which is inefficient and error-prone.

131
MCQhard

A team is using Terraform to manage Google Cloud resources. They want to store the Terraform state file in a Cloud Storage bucket to enable collaboration. Which Terraform backend configuration should be used?

A.provider "google" { backend "gcs" { bucket = "my-tf-state" } }
B.terraform { backend "cloud-storage" { bucket = "my-tf-state" path = "prod" } }
C.terraform { backend "gcs" { bucket = "my-tf-state" folder = "prod" } }
D.terraform { backend "gcs" { bucket = "my-tf-state" prefix = "prod" } }
AnswerD

This is the correct way to configure remote state storage for Google Cloud using Terraform. The `terraform` block wraps the backend declaration, the type is `gcs` for Google Cloud Storage, and the `bucket` and `prefix` arguments accurately define the bucket name and the object key within that bucket. Using a distinct prefix like `"prod"` allows multiple environments or components to share the same bucket while keeping their state files isolated and easily retrievable.

Why this answer

The 'gcs' backend in Terraform stores state in a Cloud Storage bucket. The 'bucket' attribute specifies the bucket name, and 'prefix' is optional for folder structure.

132
MCQmedium

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

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

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

Why this answer

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

133
MCQeasy

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

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

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

Why this answer

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

134
MCQeasy

Which gcloud command creates a regional GKE cluster named 'my-cluster' with 3 nodes per zone in the 'us-central1' region?

A.gcloud container clusters create my-cluster --zone us-central1 --num-nodes 3
B.gcloud container clusters create my-cluster --zone us-central1-a --num-nodes 3
C.gcloud container clusters create my-cluster --region us-central1 --nodes 3
D.gcloud container clusters create my-cluster --region us-central1 --num-nodes 3
AnswerD

This is the correct command because it uses --region us-central1 to designate a regional cluster, which GKE deploys across multiple zones within that region for redundancy and high availability. The --num-nodes 3 flag sets the number of nodes per zone in the default node pool, ensuring each zone gets three nodes. Together, these flags meet the requirement for a regional GKE cluster named my-cluster.

Why this answer

To create a regional cluster, use --region (not --zone). The --num-nodes flag sets nodes per zone.

135
MCQmedium

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

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

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

Why this answer

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

136
MCQeasy

A company wants to create a Cloud Storage bucket to store archival data that is accessed infrequently (less than once a year). The data must be stored at the lowest possible cost. Which storage class should they choose?

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

Archive is the correct choice because it is the lowest-cost Cloud Storage class for data that is accessed less than once a year, offering the cheapest per-gigabyte monthly price for long-term retention. It does incur retrieval fees and a 365-day minimum storage duration, but for true archival data with infrequent access these trade-offs are acceptable. This class also has no availability SLA, which is fine for this access pattern but means it should only be used for durable, rarely accessed data.

Why this answer

Archive storage class is the lowest-cost option for long-term archival data accessed less than once a year. Nearline and Coldline have higher retrieval costs but are for data accessed less frequently than standard, not as low as Archive. Standard is for frequently accessed data.

137
MCQhard

An enterprise requires a private connection between its on-premises data center and Google Cloud VPC that does NOT traverse the public internet and provides dedicated 10 Gbps bandwidth. Which connectivity option meets these requirements?

A.Cloud VPN with high-availability configuration
B.Partner Interconnect
C.Dedicated Interconnect
D.Direct Peering
AnswerC

Dedicated Interconnect is the only option that provides a direct physical connection from your enterprise data center to Google's network. You must contract with a colocation provider like Equinix or Digital Realty, and Google installs a cross-connect in that facility to your router. It is available in 10 Gbps or 100 Gbps increments, offers a 99.99% uptime SLA, and allows you to access private VPC resources (e.g., Compute Engine instances) without traversing the public internet, making it ideal for high-throughput, low-latency hybrid workloads.

Why this answer

Dedicated Interconnect provides a direct, private physical connection between your on-premises network and Google Cloud VPC, offering bandwidth up to 10 Gbps per circuit (or 100 Gbps with multiple circuits) without traversing the public internet. This meets the requirement for a private connection with dedicated 10 Gbps bandwidth, as it uses a colocation facility and a Google-supported router.

Exam trap

The trap here is that candidates often confuse Partner Interconnect with Dedicated Interconnect, assuming both offer dedicated bandwidth, but Partner Interconnect relies on a third-party provider's network and may not guarantee the same level of isolation or dedicated 10 Gbps per circuit.

How to eliminate wrong answers

Option A is wrong because Cloud VPN uses IPSec tunnels over the public internet, which cannot provide dedicated 10 Gbps bandwidth and does not guarantee a private connection that avoids the public internet. Option B is wrong because Partner Interconnect offers bandwidth up to 10 Gbps but relies on a third-party service provider's network, not a direct dedicated connection, and may involve shared infrastructure. Option D is wrong because Direct Peering is a direct connection to Google's edge network but is not a private connection to a VPC; it uses BGP peering over the public internet and does not support dedicated bandwidth guarantees or SLA-backed private connectivity.

138
MCQhard

A security team wants to enable audit logging for all Data Access (ADMIN_READ, DATA_READ, DATA_WRITE) on a specific Google Cloud project. They plan to use gcloud commands to configure this. What is the correct approach?

A.Use gcloud compute firewall-rules update to enable logging on firewall rules.
B.Use gcloud logging sinks to export data access logs to a BigQuery dataset.
C.Use gcloud projects set-iam-policy to set the auditConfig on the project.
D.Use gcloud services enable to enable the Cloud Audit Logs API.
AnswerC

This is correct because Data Access audit logs are controlled by the auditConfig field of the project's IAM policy. You retrieve the policy, add an auditConfig specifying the services and log types (ADMIN_READ, DATA_READ, DATA_WRITE), then set it back with gcloud projects set-iam-policy. After that, Cloud Audit Logs will start recording data access operations for the enabled services.

Why this answer

Audit log configuration is set at the organization, folder, or project level using the 'gcloud projects get-iam-policy' and 'gcloud projects set-iam-policy' commands with audit configs. The correct method is to modify the IAM policy to include auditConfigs. The other options either use wrong commands or wrong scopes.

139
MCQmedium

You are designing a GKE cluster for a workload that requires high-memory instances (768 GB RAM) for in-memory analytics. Standard machine types in GCP don't offer this configuration. Which machine family should you select for the node pool?

A.N2 machine family with custom vCPU and memory configuration
B.Memory-optimized (M1 or M2) machine family
C.Compute-optimized (C2) machine family
D.Accelerator-optimized (A2) machine family
AnswerB

The M1 and M2 machine families are the correct choice because they are explicitly engineered for high-memory workloads like SAP HANA, large in-memory databases, and real-time analytics. M1 offers m1-megamem (up to 1.75 TB) and m1-ultramem (up to 3.75 TB), while M2 adds m2-hypermem with up to 12 TB of RAM, all using Intel Xeon Scalable processors with twice the memory bandwidth of general-purpose families. These machines are priced per GB of memory at a lower rate than custom N2 or C2 configurations, making them the most cost-effective option when you need hundreds of GB to terabytes of RAM. Additionally, M-series VMs support live migration and sole-tenant nodes, giving you the same operational flexibility as other families while delivering the required 768 GB+ capacity.

Why this answer

The M1 and M2 memory-optimized machine families are specifically designed for workloads requiring large amounts of RAM, such as in-memory analytics, with configurations offering up to 12 TB of memory. Standard machine types like N2 do not provide 768 GB RAM instances, making memory-optimized families the correct choice for this high-memory requirement.

Exam trap

Google Cloud often tests the misconception that custom machine types (like N2) can be scaled arbitrarily for memory, but GCP imposes hard limits on custom configurations (e.g., max 624 GB for N2), making memory-optimized families the only viable option for RAM-intensive workloads like 768 GB in-memory analytics.

How to eliminate wrong answers

Option A is wrong because N2 machine families, even with custom vCPU and memory configurations, are limited to a maximum of 624 GB RAM (with 224 vCPUs), which cannot meet the 768 GB requirement. Option C is wrong because compute-optimized (C2) machine families prioritize high CPU performance over memory, offering a maximum of 60 GB RAM per instance, far below the needed 768 GB. Option D is wrong because accelerator-optimized (A2) machine families are designed for GPU-intensive workloads like machine learning, not for high-memory analytics, and their maximum RAM is 340 GB (with GPUs), insufficient for 768 GB.

140
MCQhard

An engineer is configuring a Cloud NAT to allow private Compute Engine instances to access the internet. After creating the Cloud Router and NAT gateway, the instances still cannot connect to the internet. What is the most likely missing configuration?

A.The VPC does not have a default route (0.0.0.0/0) to the default internet gateway.
B.The firewall rules do not allow egress traffic.
C.The Cloud Router is in a different region.
D.The instances are not assigned a network tag used by the NAT.
AnswerA

For Cloud NAT to work, the VPC network must contain a default route (0.0.0.0/0) whose next hop is the default internet gateway. This route is what causes outbound packets from instances to be sent to the gateway, where Cloud NAT performs the source IP translation. Without this route, packets destined for the internet have no valid next hop and are dropped, so the instances cannot reach the internet at all—Cloud NAT alone does not create routing logic.

Why this answer

Cloud NAT requires that the subnet has Private Google Access enabled for certain Google APIs, but for general internet access, the instances must have a default route to the internet gateway (0.0.0.0/0 next hop to default internet gateway). If this route is missing, traffic won't be sent to NAT. The other options are possible but less common.

141
MCQeasy

A deployment pipeline runs `kubectl logs` to capture output from a crashed Pod's previous container instance. Which flag retrieves logs from the previous (terminated) container instance rather than the current one?

A.kubectl logs api-pod --terminated
B.kubectl logs api-pod --previous
C.kubectl logs api-pod --all-containers --since-crash
D.kubectl describe pod api-pod | grep -A 50 'Last State'
AnswerB

The `--previous` flag (or `-p`) instructs kubectl to fetch the log output of the last, now-terminated container instance in the pod, rather than the current (possibly restarting) one. This is precisely the right tool when a container crashes before it can be readied, because its startup error output is preserved in the terminated instance's logs. For pods with multiple containers, combine it with `-c <container-name>` to isolate the right container, and it works for both regular and init containers.

Why this answer

The `--previous` flag in `kubectl logs` retrieves logs from the previous (terminated) container instance of a Pod. This is essential for debugging crashes where the current container has restarted, as the logs from the failed instance are preserved and accessible only with this flag.

Exam trap

Google Cloud often tests the `--previous` flag as the only way to access logs from a terminated container, and candidates mistakenly choose `--terminated` or `--since-crash` because they sound plausible but do not exist in the kubectl command syntax.

How to eliminate wrong answers

Option A is wrong because `--terminated` is not a valid flag for `kubectl logs`; the correct flag is `--previous`. Option C is wrong because `--all-containers` streams logs from all containers in the Pod, and `--since-crash` is not a valid flag; there is no `--since-crash` option in kubectl. Option D is wrong because `kubectl describe pod` shows the 'Last State' field with exit details but does not retrieve the actual log output from the terminated container; it only provides metadata about the previous termination.

142
Multi-Selecthard

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

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

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

Why this answer

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

143
MCQmedium

Your company uses Google Workspace for email. You need to set up GCP for a new team that includes contractors who use non-Google email addresses. Which identity solution allows contractors to authenticate to GCP without a Google Workspace license?

A.Issue each contractor a Gmail account and add it directly to IAM.
B.Provision contractor accounts using Cloud Identity Free, independent of Google Workspace.
C.Create service accounts for each contractor and share the key JSON files.
D.Add contractor email addresses as external users and grant them project-level IAM roles.
AnswerB

Cloud Identity Free provides a standalone managed identity directory for your domain, so contractors receive Google accounts that your organization fully controls—without paying for Google Workspace licenses or email. From the Admin console you can enforce 2-Step Verification, password length, and session settings, and you can suspend or delete a contractor's account at contract end to instantly revoke access across all Google Cloud projects. These accounts can also be integrated with an external SAML/OIDC identity provider, and because they exist within your organization's Cloud Identity service, they follow your resource hierarchy and org policies.

Why this answer

Cloud Identity Free provides identity management for users without requiring a Google Workspace license. It allows contractors with non-Google email addresses to authenticate to GCP using their existing email as a Google account, enabling IAM role assignment without additional licensing costs. This is the correct solution because it decouples identity from Google Workspace, supporting external users while maintaining centralized access control.

Exam trap

The trap here is that candidates confuse 'external user' (which requires a pre-existing Google identity) with the ability to create a new Google identity via Cloud Identity Free, leading them to incorrectly select Option D, which fails because GCP IAM does not automatically create Google accounts from arbitrary email addresses.

How to eliminate wrong answers

Option A is wrong because issuing each contractor a Gmail account violates the requirement to use their existing non-Google email addresses and introduces unnecessary overhead, as Gmail accounts are personal and not designed for enterprise identity management. Option C is wrong because service accounts are intended for applications and automated workloads, not for individual human users; sharing key JSON files creates a severe security risk with no ability to enforce MFA or revoke access granularly. Option D is wrong because adding contractor email addresses as external users (e.g., via Google Groups or direct IAM) without a Cloud Identity or Workspace license does not create a Google account for them; they would be unable to authenticate because GCP IAM requires a Google identity (either a Google account or a Cloud Identity managed account) to sign in.

144
MCQmedium

A company has a VPC with several Compute Engine instances that only have internal IPs. These instances need to download updates from the internet. What is the recommended method to provide internet access without assigning external IPs to each instance?

A.Use VPC Network Peering with a public network.
B.Set up a Cloud VPN gateway to route traffic to on-premises.
C.Place the instances behind an external HTTP(S) load balancer.
D.Configure Cloud NAT in the same region and subnet.
AnswerD

Cloud NAT (Network Address Translation) is the correct Google Cloud service for enabling outbound internet access from Compute Engine instances that have only private IP addresses. When you configure Cloud NAT on a Cloud Router for a specific region and subnet, it provides a set of external IP addresses that are used to translate the private source IPs of outbound packets. This allows the instances to reach the internet while remaining private and secure, without the need for individual external IPs. Cloud NAT is also region-scoped, so configuring it for the same region and subnet as the instances is both necessary and sufficient for this VPC requirement.

Why this answer

Cloud NAT (Network Address Translation) allows instances with only internal IPs to initiate outbound connections to the internet, while preventing inbound connections from the internet. It translates the internal IPs to a shared external IP address, enabling secure internet access without assigning external IPs to each instance. This is the recommended method for providing internet access to private instances in Google Cloud.

Exam trap

Google Cloud often tests the misconception that an external load balancer can provide outbound internet access, but it only handles inbound traffic; candidates confuse inbound load balancing with outbound NAT.

How to eliminate wrong answers

Option A is wrong because VPC Network Peering connects two VPC networks, but does not provide internet access; it only allows private communication between the peered networks. Option B is wrong because Cloud VPN is used for secure connectivity to on-premises networks, not for general internet access; it would route traffic to on-premises, not to the internet. Option C is wrong because an external HTTP(S) load balancer is designed to distribute incoming traffic from the internet to backend instances, not to provide outbound internet access for those instances; it does not perform source NAT for outbound connections.

145
MCQhard

An organization policy at the organization level sets `constraints/compute.requireOsLogin` to enforced (true) on all projects. A specific project needs an exception — VMs there should not require OS Login. How can this exception be configured?

A.Removing the VM from the VPC will bypass the organization policy
B.Set a project-level organization policy overriding `compute.requireOsLogin` to not enforced (if the constraint allows override)
C.Grant the VM's service account the OS Login Admin role to bypass the policy
D.Move the project to a folder that doesn't inherit the organization policy
AnswerB

The correct approach is to set a project-level organization policy for `compute.requireOsLogin` with the 'not enforced' status, provided the constraint's inheritance allows per-project overrides. This creates an exception that overrides the inherited org-level policy, allowing new VM instances in that project to be created without OS Login enabled. However, the org policy must still permit the override; if the constraint is locked with a custom value, the org administrator may need to adjust the policy hierarchy.

Why this answer

Organization policies can be overridden at a lower level (project, folder) if the constraint's `inheritFromParent` setting allows it. The `compute.requireOsLogin` boolean constraint supports per-project override, so setting it to `false` at the project level exempts that project's VMs from requiring OS Login while the organization-level policy remains enforced for all other projects.

Exam trap

Google Cloud often tests the misconception that organization policies are absolute and cannot be overridden at lower levels, but many boolean constraints explicitly allow per-project or per-folder overrides when configured correctly.

How to eliminate wrong answers

Option A is wrong because removing a VM from its VPC does not bypass the organization policy; the policy applies to all VMs in the project regardless of VPC membership, and a VM without a VPC cannot function. Option C is wrong because granting the VM's service account the OS Login Admin role does not bypass the `compute.requireOsLogin` policy; that role only allows managing OS Login settings on instances, not overriding the enforcement of OS Login itself. Option D is wrong because moving the project to a folder that doesn't inherit the organization policy is not possible—organization policies at the organization level are inherited by all folders and projects unless explicitly excluded via a policy with `inheritFromParent: false`, and a project cannot be moved outside the organization hierarchy.

146
MCQmedium

Your organization has multiple GCP projects and wants to implement least privilege access for operations teams. Each operations team manages a specific set of projects. You have created custom roles that grant permissions to start and stop Compute Engine instances, view logs, and monitor resources. You are using Google Groups to assign roles to users. Recently, a user from the network operations team was able to modify firewall rules in a project managed by the compute operations team, causing a security incident. During the root cause analysis, you discover that the user is a member of both the network operations group and the compute operations group. The compute operations group is assigned a custom role that does not include firewall permissions. The network operations group is assigned a role that includes firewall admin permissions. How should you redesign the IAM structure to prevent cross-team access while maintaining required permissions?

A.Create a separate project for each team and use VPC Service Controls to isolate.
B.Use IAM conditions to restrict the network operations role to only the network team's projects.
C.Implement organization policies to deny firewall modifications unless a specific condition is met.
D.Remove the user from the network operations group.
AnswerB

Use IAM conditions to restrict the network operations role to only the network team's projects. In the IAM policy binding that grants the role to the network operations group, add a condition using Common Expression Language (CEL), such as resource.name.startsWith("projects/network-team-project") or resource.tag for a specific project tag. This ensures the role is only effective when the request targets resources within the allowed projects, directly preventing the user from using the role in unrelated projects while preserving legitimate access.

Why this answer

IAM conditions allow you to restrict the network operations team's firewall admin permissions to only their designated projects, preventing a user who is a member of both groups from using those permissions in the compute operations team's projects. This enforces least privilege by scoping the role's effectiveness based on resource attributes, without requiring project-level separation or removing the user from necessary groups.

Exam trap

The trap here is that candidates think removing the user from the group (Option D) or using organization policies (Option C) solves the problem, but they fail to recognize that IAM conditions can scope permissions to specific projects or resources without altering group membership or applying blanket restrictions.

How to eliminate wrong answers

Option A is wrong because creating separate projects and using VPC Service Controls does not address the cross-team access issue; the user would still be a member of both groups and could inherit permissions across projects if roles are assigned at the organization or folder level. Option C is wrong because organization policies deny or allow actions broadly across all projects, and they cannot conditionally restrict permissions based on group membership or project ownership; they are not a substitute for IAM conditions. Option D is wrong because removing the user from the network operations group would break their legitimate need to manage firewall rules in their own projects, violating the principle of least privilege by over-restricting access.

147
MCQmedium

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

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

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

Why this answer

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

148
Multi-Selectmedium

A company has a Compute Engine instance that needs to access the internet for software updates, but the instance only has an internal IP address. Which TWO steps are required to enable outbound internet connectivity while keeping the instance private?

Select 2 answers
A.Create a VPC peering connection to a network with internet access
B.Create a firewall rule that allows egress traffic to the internet
C.Create a Cloud NAT gateway in the same region and VPC as the instance
D.Attach the instance to a load balancer
E.Assign a public IP address to the instance
AnswersB, C

A firewall rule that allows egress traffic to the internet is mandatory for any outbound connectivity, even when Cloud NAT is used. Cloud NAT only translates the source IP, but the VPC firewall still evaluates all traffic and drops it unless a rule permits traffic to destination 0.0.0.0/0 with a source tag or service account you apply to the instance. Without an egress allow rule, the NAT translation never gets the chance to send packets, because the firewall is applied before the packet leaves the instance's VPC network.

Why this answer

Cloud NAT allows instances with only internal IP addresses to access the internet for outbound connections. You also need to configure firewall rules to allow egress traffic (e.g., allow HTTP/HTTPS). A NAT gateway without firewall rules will not work.

149
MCQeasy

Which kubectl command lists all pods in the current namespace?

A.kubectl list pods
B.kubectl describe pods
C.kubectl get pods
D.kubectl get all
AnswerC

'kubectl get pods' is the canonical command to list pods in the current namespace. It queries the Kubernetes API and returns a table with columns such as NAME, READY, STATUS, RESTARTS, and AGE, one row per pod. This is the expected answer because the question asks for a command that lists pods, and 'get' is the standard verb for retrieving resource lists.

Why this answer

The command 'kubectl get pods' lists all pods. 'kubectl get all' includes services, deployments, etc. 'kubectl describe pods' shows detailed info. 'kubectl list pods' is invalid.

150
MCQeasy

A team has a Docker container image locally and wants to push it to Google Artifact Registry. They've already authenticated Docker with GCP. The registry host is 'us-central1-docker.pkg.dev'. Which commands correctly tag and push the image?

A.docker tag myimage us-central1-docker.pkg.dev/myproject/myrepo/myimage:v1 && docker push us-central1-docker.pkg.dev/myproject/myrepo/myimage:v1
B.gcloud artifacts docker push myimage --location=us-central1 --repository=myrepo
C.docker push gcr.io/myproject/myimage:v1
D.gcloud container images push myimage:v1 --region=us-central1
AnswerA

This is the correct approach because it fully specifies the Artifact Registry destination in the Docker image tag. The format `[REGION]-docker.pkg.dev/[PROJECT]/[REPO]/[IMAGE]:[TAG]` tells Docker exactly which regional Artifact Registry repository to use. First `docker tag` creates a new tag pointing to the local image, then `docker push` uploads the image to that fully-qualified repository path. This is the required pattern for pushing images to Artifact Registry.

Why this answer

It uses the standard Docker CLI workflow: first tagging the local image with the full Artifact Registry path (including the registry host, project, repository, and image name with tag), then pushing it. Since the team has already authenticated Docker with GCP, the `docker push` command will authenticate via the Docker credential helper and upload the image to the specified Artifact Registry repository.

Exam trap

Google Cloud often tests the distinction between Google Container Registry (gcr.io) and Artifact Registry (LOCATION-docker.pkg.dev), and candidates mistakenly use gcr.io commands or syntax for Artifact Registry, or assume gcloud commands can replace standard Docker CLI commands for pushing images.

How to eliminate wrong answers

Option B is wrong because `gcloud artifacts docker push` is not a valid command; the correct gcloud command for pushing Docker images is `gcloud artifacts docker upload`, but even that requires a different syntax and does not use `--location` and `--repository` flags in the way shown. Option C is wrong because it pushes to `gcr.io` (Google Container Registry), not to Artifact Registry (`us-central1-docker.pkg.dev`), and the registry host must match the target Artifact Registry location. Option D is wrong because `gcloud container images push` is a command for Google Container Registry (gcr.io), not Artifact Registry, and the `--region` flag is not valid for that command.

Page 1

Page 2 of 11

Page 3

All pages