Courseiva

Google Professional Cloud Database Engineer (PCDE) — Questions 151225

1446 questions total · 20pages · All types, answers revealed

Page 2

Page 3 of 20

Page 4
151
MCQmedium

Your Firestore database in Native mode contains a collection with millions of documents. You need to query documents where the 'tags' field (an array) contains the string 'urgent'. What must you ensure in your index configuration?

A.No additional index configuration is required; Firestore automatically creates the necessary index for array fields.
B.Ensure the 'tags' field is not indexed, and then create a composite index with the array-contains filter.
C.Create an index exemption for the 'tags' field to enable array queries.
D.Create a composite index on 'tags' and '__name__' for the collection.
AnswerA

Firestore automatically indexes array fields for array-contains queries.

Why this answer

Firestore automatically creates a single-field index for array fields. However, to query array-contains, you need an index on the field with the array-contains filter. Firestore automatically creates a single-field index for the 'tags' field, so no additional index is needed.

If the query includes additional equality clauses, a composite index may be required, but for a simple array-contains, it's automatic.

152
MCQeasy

A DevOps engineer needs to monitor Cloud SQL for MySQL replication lag on a read replica to ensure data freshness. Which Cloud Monitoring metric should they create an alert on?

A.cloudsql.googleapis.com/database/replication/lag
B.cloudsql.googleapis.com/database/replica/state
C.cloudsql.googleapis.com/database/postgresql/replication/lag
D.cloudsql.googleapis.com/database/mysql/replication/seconds_behind_master
AnswerA

Correct. The metric for replication lag in Cloud SQL is 'replication_lag'.

Why this answer

The metric 'replication_lag' in Cloud SQL measures the seconds behind the primary. Cloud SQL for MySQL uses 'seconds_behind_master' internally, but the exposed metric is 'replication_lag'.

153
MCQhard

A retail company uses Cloud Spanner to handle global transaction processing. The database has a single regional instance in us-central1. The company expects a 10x increase in write traffic from a new mobile app. The database engineer needs to design for low latency writes globally and high availability. What should the Database Engineer do?

A.Shard the database across multiple regional instances based on user geography.
B.Create read replicas in other regions to offload read traffic and keep writes in the primary region.
C.Change the instance configuration to a multi-region configuration like nam3 (us-central1, us-east1, us-west1) and configure a dedicated write region.
D.Increase the number of nodes in the existing regional instance to handle the increased write capacity.
AnswerC

Multi-region configurations provide low-latency writes by placing processing close to users and ensure high availability.

Why this answer

A multi-region configuration like nam3 (us-central1, us-east1, us-west1) with a dedicated write region provides low-latency writes globally by using Google's managed replication and automatic failover. This design ensures high availability and meets the 10x write traffic increase without sacrificing write performance, as writes are processed in the designated write region and asynchronously replicated to other regions.

Exam trap

The trap here is that candidates often confuse scaling nodes (Option D) with geographic distribution, or assume read replicas (Option B) can handle write scaling, when in fact Cloud Spanner requires a multi-region configuration to achieve both global write low latency and high availability.

How to eliminate wrong answers

Option A is wrong because sharding across multiple regional instances would require manual application-level logic and does not leverage Cloud Spanner's built-in distributed transaction support, leading to increased complexity and potential consistency issues. Option B is wrong because read replicas do not offload write traffic; writes must still go to the primary region, which would become a bottleneck under a 10x write increase, and read replicas do not improve write latency or availability for writes. Option D is wrong because increasing nodes in a single regional instance only scales capacity within that region, failing to provide global low-latency writes or multi-region high availability, and does not address geographic distribution requirements.

154
MCQmedium

A DevOps engineer is optimizing a Cloud Run service that performs background data processing tasks triggered by Pub/Sub messages. The tasks are CPU-intensive and can run up to 10 minutes each. The service currently experiences cold starts causing delays. Which configuration should the engineer apply to minimize cold starts and ensure the background tasks are not throttled?

A.Set min instances to 1, CPU always-on, concurrency to 1
B.Set min instances to 1, CPU throttled, concurrency to 80
C.Set min instances to 0, CPU always-on, concurrency to 1000
D.Set min instances to 0, CPU always-on, concurrency to 1
AnswerA

min instances = 1 keeps at least one instance warm, CPU always-on ensures background tasks are not throttled, and concurrency = 1 dedicates the instance to a single task.

Why this answer

Setting a minimum number of instances ensures that at least one instance is always warm, eliminating cold starts. Setting CPU always-on prevents the CPU from being throttled during background processing, which is necessary for tasks that are not triggered by an HTTP request. Concurrency should be set to 1 to avoid multiple tasks competing for CPU on the same instance.

155
MCQhard

A BI team needs to analyze user behavior with sessionization. Each event has a timestamp and session ID. The table 'sessions' contains columns: session_id, user_id, event_time, event_name. The team wants the first event time per session. Which query is most efficient?

A.SELECT session_id, ARRAY_AGG(event_time ORDER BY event_time LIMIT 1) FROM sessions GROUP BY session_id
B.SELECT a.session_id, a.event_time FROM sessions a INNER JOIN (SELECT session_id, MIN(event_time) min_ts FROM sessions GROUP BY session_id) b ON a.session_id = b.session_id AND a.event_time = b.min_ts
C.SELECT session_id, MIN(event_time) FROM sessions GROUP BY session_id
D.SELECT session_id, event_time FROM sessions QUALIFY ROW_NUMBER() OVER (PARTITION BY session_id ORDER BY event_time) = 1
AnswerC

Correct: Uses MIN and GROUP BY, which is the most efficient method for retrieving the first event time per session.

Why this answer

The most efficient query for this requirement. It uses the MIN aggregate function with GROUP BY, which leverages the database's optimized aggregation engine. This approach requires scanning the table once and grouping by session_id, computing the minimum event_time per group.

It is both concise and performant. Option D with QUALIFY and ROW_NUMBER is more complex and may be less efficient because it involves window function processing and sorting within each partition, which is unnecessary when only the minimum time is needed.

Exam trap

Many candidates assume that using QUALIFY with ROW_NUMBER is the standard modern pattern for sessionization, but for the simple requirement of retrieving the first event time per session, a straightforward GROUP BY with MIN is more efficient and is the recommended approach in BigQuery and similar platforms. The trap is over-engineering the solution.

How to eliminate wrong answers

Option A is wrong because ARRAY_AGG with LIMIT 1 returns an array containing a single element, not a scalar value, and is less efficient than MIN or ROW_NUMBER. Option B is wrong because it performs a self-join on both session_id and event_time, which is redundant and less efficient than a simple GROUP BY or window function; it also requires an exact match on the timestamp, which can fail if there are duplicate timestamps for the same session. Option C is wrong because although it correctly returns the first event time per session, it is not the most efficient option in the context of the PCDE exam, which often tests window functions and QUALIFY as a more modern and flexible approach.

156
Multi-Selecteasy

An engineer is using Database Migration Service to migrate a MySQL database to Cloud SQL. They need to set up a source connection profile. Which TWO methods can the engineer use to allow DMS to connect to the source database? (Choose 2 correct answers.)

Select 2 answers
A.VPC peering for private IP
B.No public endpoint
C.IP allowlisting for public IP
D.Cloud SQL Auth Proxy
E.Cloud VPN
AnswersA, C

If the source uses private IP, use VPC peering to connect.

Why this answer

VPC peering allows DMS to connect to a source database using private IP addresses without traversing the public internet, which is a secure and recommended method for connectivity within Google Cloud. This method establishes a direct, low-latency connection between the DMS service's VPC and the source database's VPC, provided the IP ranges do not overlap. It is particularly suitable when the source database is hosted in a different VPC or on-premises via a VPN-connected VPC.

Exam trap

Google Cloud DMS supports two direct connection methods for source connection profiles: VPC peering (private IP) and IP allowlisting (public IP). Candidates may mistakenly select Cloud VPN or Cloud SQL Auth Proxy, which are supporting infrastructure or unrelated services, not valid profile methods.

157
Multi-Selectmedium

Which two practices are characteristic of a blameless postmortem? (Choose TWO.)

Select 2 answers
A.Creating action items with owners and deadlines
B.Assigning punitive measures to prevent recurrence
C.Identifying the employee who made the error
D.Focusing on contributing factors in the system and process
E.Keeping the postmortem confidential within the incident response team
AnswersA, D

Action items drive improvement.

Why this answer

Blameless postmortems focus on systemic causes and create action items to prevent recurrence. They avoid blaming individuals.

158
MCQmedium

An organization needs a multi-region database deployment with strong consistency and an RPO of zero in normal operation. They expect a regional outage and require automatic failover within seconds. Which database service and configuration meets these requirements?

A.Cloud Firestore in multi-region mode
B.Cloud Bigtable with multi-cluster routing and replication
C.Cloud SQL with cross-region read replica
D.Cloud Spanner multi-region configuration
AnswerD

Spanner multi-region provides synchronous replication across regions, zero RPO, and automatic failover within seconds.

Why this answer

Cloud Spanner multi-region configurations provide strong consistency, zero RPO during normal operation, and automatic failover within <1 minute (typically seconds) in case of regional failure.

159
Multi-Selecthard

A global retail company uses Cloud Spanner to manage product inventory. They need to apply a schema change to add a new column to a table that has 10 billion rows. Which THREE strategies should they consider to minimize downtime?

Select 3 answers
A.Schedule the schema change during a period of low traffic.
B.Disable the table, add the column, then re-enable.
C.Add the column with a NULL default value to avoid backfilling existing rows.
D.Use ALTER TABLE ADD COLUMN with IF NOT EXISTS to avoid errors if the column already exists.
E.Create a new table with the column, then copy data in batches.
AnswersA, C, D

Even though Spanner DDL is online, performing it during low traffic minimizes any potential performance impact.

Why this answer

Scheduling schema changes during low traffic reduces the risk of contention and performance impact on the live database. Cloud Spanner applies schema changes online without locking the entire table, but heavy write traffic can still cause transaction conflicts or increased latency; performing the change during a quiet period minimizes these risks.

Exam trap

Google Cloud often tests the misconception that large tables require data migration or table recreation for schema changes, but Cloud Spanner's online DDL handles column additions without backfilling, making options like B and E unnecessary and counterproductive.

160
MCQeasy

A financial services company runs a MySQL database on Compute Engine. They want to migrate to Cloud SQL for MySQL to reduce operational overhead. The current schema includes a table 'transactions' with a composite primary key on (transaction_id, account_id) and a secondary index on account_id for account lookups. The database also uses foreign key constraints to ensure referential integrity between 'transactions' and 'accounts'. During migration testing, they observe that INSERT operations on 'transactions' are slower than expected. What schema change should they implement to improve INSERT performance in Cloud SQL?

A.Remove the foreign key constraints and enforce referential integrity in the application logic instead.
B.Remove the secondary index on account_id because it adds write overhead.
C.Change the primary key to (account_id, transaction_id) to avoid secondary index overhead.
D.Convert the table to a temporal table with system-versioning to avoid constraint checking.
AnswerA

Foreign key constraints require a lookup on the parent table for every INSERT, causing latency. Removing them reduces write overhead, though integrity must be ensured by the application.

Why this answer

Foreign key constraints in MySQL (including Cloud SQL) require an internal check on every INSERT to verify that the referenced parent key exists. This adds a latency penalty proportional to the size of the parent table. Removing the constraint and moving referential integrity to the application eliminates this per-row check, directly improving INSERT throughput.

Exam trap

Google Cloud often tests the misconception that secondary indexes are the primary cause of write slowdowns, when in reality foreign key constraint checks are far more expensive per row than index maintenance.

How to eliminate wrong answers

Option B is wrong because removing the secondary index on account_id would degrade SELECT performance for account lookups, and the index's write overhead is negligible compared to the cost of foreign key checks. Option C is wrong because changing the primary key order does not eliminate foreign key validation overhead; it only affects index clustering and does not address the root cause of slow INSERTs. Option D is wrong because temporal tables with system-versioning add additional metadata and version-row writes on every INSERT, which would further degrade performance, not improve it.

161
MCQmedium

A team wants to reduce toil by automating a manual process that generates a report from Cloud Logging logs and emails it weekly. Which solution is most cost-effective and requires minimal operational overhead?

A.Cloud Scheduler + Cloud Functions
B.Cloud Run job manually started
C.Cloud Build trigger on schedule
D.Cloud Composer (Airflow) DAG
AnswerA

Cloud Scheduler triggers a Cloud Function that queries logs and sends email. Minimal overhead.

Why this answer

Cloud Scheduler triggers a Cloud Function or runs a query in BigQuery, but the most straightforward serverless option is a Cloud Function triggered by Cloud Scheduler. Cloud Composer is heavy for a simple report. Cloud Run requires containerization.

Cloud Build is for CI/CD.

162
MCQeasy

An engineer is designing a global inventory system that requires strong consistency across continents, with the ability to handle write conflicts and ensure ACID transactions. The system expects millions of reads and writes per second. Which Google Cloud database service meets these requirements?

A.Cloud Bigtable
B.Cloud SQL
C.Firestore
D.Cloud Spanner
AnswerD

Spanner offers global strong consistency, ACID transactions, and horizontal scaling.

Why this answer

Cloud Spanner is the correct choice because it provides ACID transactions and strong consistency across globally distributed regions, using TrueTime and synchronous replication to handle write conflicts at scale. It is designed for millions of reads and writes per second while maintaining external consistency, making it ideal for a global inventory system.

Exam trap

The trap here is that candidates often confuse Firestore's strong consistency within a single region with global consistency, overlooking the need for ACID transactions and conflict resolution at planetary scale, which only Cloud Spanner provides.

How to eliminate wrong answers

Option A is wrong because Cloud Bigtable is a NoSQL wide-column database that offers only eventual consistency and does not support ACID transactions or strong consistency across regions. Option B is wrong because Cloud SQL is a relational database limited to a single region, cannot handle millions of writes per second globally, and lacks built-in conflict resolution for multi-region deployments. Option C is wrong because Firestore provides strong consistency only within a single region and uses optimistic locking that can lead to write conflicts under high concurrency, not designed for ACID transactions at global scale.

163
MCQhard

A Cloud SQL for SQL Server instance has been running for months. Recently, the database size grew significantly and now query performance has degraded. The DBA checks the query execution plan and sees index scans. The current storage is 500GB SSD. What is the most likely cause and solution?

A.Increase storage capacity to 1TB SSD
B.Index fragmentation; rebuild or reorganize indexes
C.Enable query insights to analyze performance
D.Enable read replicas to offload queries
AnswerB

Index fragmentation increases scan cost; rebuilding reorganizes data pages.

Why this answer

Index fragmentation occurs over time as data is inserted, updated, or deleted, causing indexes to become inefficient. The query execution plan showing index scans (instead of seeks) is a classic symptom of fragmented indexes. Rebuilding or reorganizing the indexes will defragment them, restoring query performance without requiring additional storage or infrastructure changes.

Exam trap

Google Cloud often tests the misconception that performance degradation from data growth is always a storage capacity issue, leading candidates to choose a storage increase instead of recognizing index fragmentation as the root cause when execution plans show index scans.

How to eliminate wrong answers

Option A is wrong because increasing storage capacity does not address index fragmentation; it only provides more space, which does not improve query performance if the indexes are fragmented. Option C is wrong because enabling query insights helps analyze performance but does not fix the root cause of index scans; it is a diagnostic tool, not a solution. Option D is wrong because read replicas offload read queries but do not resolve index fragmentation on the primary instance; the degraded performance would persist on the primary instance.

164
MCQmedium

A team is designing a Spanner schema for an online gaming leaderboard. The leaderboard stores player scores and requires high write throughput. Which primary key design is BEST to avoid write hotspots?

A.Primary key: (HashOfPlayerId, Timestamp)
B.Primary key: (PlayerId, Timestamp)
C.Primary key: (Score, PlayerId)
D.Primary key: (Timestamp, PlayerId)
AnswerA

Hash prefix distributes writes evenly. Timestamp as second part allows ordering.

Why this answer

Monotonically increasing keys (like score or timestamp) cause hotspotting. Using a random prefix (e.g., hash of player ID) ensures writes are distributed across splits. Player ID alone might also cause hotspotting if many players write simultaneously.

165
MCQeasy

A data analyst needs to run a one-time SQL query on a dataset stored in CSV files in Cloud Storage. The query will scan the entire dataset, and the analyst wants to minimize cost. Which Google Cloud service should they use?

A.Cloud SQL
B.BigQuery
C.Dataproc
D.Cloud Spanner
AnswerB

Serverless and pay-per-query; ideal for ad-hoc queries on data in Cloud Storage.

Why this answer

BigQuery can query external data directly from Cloud Storage; using query-on-demand billing, they only pay for the data scanned. It is serverless and requires no infrastructure.

166
MCQmedium

A company needs to perform disaster recovery testing for their Cloud SQL for PostgreSQL instance. They want to validate that a cross-region failover works without affecting production. What is the BEST approach?

A.Promote a cross-region read replica to a standalone instance in the same project and test connectivity.
B.Create a clone of the primary instance in another region and test failover to the clone.
C.Use the gcloud sql instances failover command on the primary instance.
D.Stop the primary instance and promote the read replica, then later re-promote the original primary.
AnswerA

Promoting a read replica creates a new primary instance without affecting the original primary. This is a safe way to test failover.

Why this answer

A read replica can be promoted to a standalone instance, which does not affect the primary instance. This allows testing read/write operations on the promoted instance. After testing, the promoted instance can be deleted or kept.

Rolling back a promoted replica is not possible. Performing a failover on the primary would cause downtime. Creating a clone does not test the replication path.

Testing in a separate project is not necessary.

167
MCQmedium

A team runs a Cloud SQL MySQL instance serving an e-commerce application. Read traffic is growing and causing increased latency on the primary instance. They want to offload read queries with minimal application changes. Which solution should they implement?

A.Upgrade the primary instance to a higher machine type
B.Optimize slow queries using EXPLAIN ANALYZE and add indexes
C.Enable connection pooling with Cloud SQL Auth Proxy and PgBouncer
D.Create Cloud SQL read replicas and direct read-only queries to them
AnswerD

Read replicas serve read traffic without impacting primary instance performance, and minimal application changes are needed.

Why this answer

Cloud SQL read replicas are designed to offload read traffic from the primary instance. The application can be configured to send read-only queries to the replica endpoint. Connection pooling with PgBouncer helps with connection management but does not offload reads.

Query optimization reduces load but doesn't scale reads. Read replicas are the standard solution.

168
Multi-Selectmedium

An organization uses GitOps with Config Sync to manage multiple GKE clusters. They want to ensure that any change to the Git repository is automatically applied to the clusters, and that no manual kubectl apply commands are used. Which TWO resources should they configure?

Select 2 answers
A.A Cloud Build trigger that runs kubectl apply on push
B.A Kustomize overlay for each cluster
C.RepoSync resource pointing to the Git repository
D.RootSync resource pointing to the Git repository
E.An Argo CD Application resource
AnswersC, D

RepoSync syncs namespace-scoped resources. Both can be used together.

Why this answer

A RepoSync resource is used in Config Sync to synchronize a non-root namespace-level repository with the cluster, ensuring that any changes pushed to the Git repository are automatically applied without manual kubectl commands. Option D is correct because a RootSync resource is used to synchronize the root-level configuration (e.g., cluster-scoped resources) from a Git repository, providing the same automated GitOps workflow. Together, they cover both namespace and cluster-scoped resources, fulfilling the requirement of no manual kubectl apply.

Exam trap

Google often tests the distinction between RootSync and RepoSync, and the trap here is that candidates may confuse RepoSync (namespace-scoped) with RootSync (cluster-scoped) or incorrectly assume that any GitOps tool like Argo CD or Cloud Build is equivalent to Config Sync's native resources.

169
MCQeasy

A company is migrating their on-premises PostgreSQL database to Cloud SQL. They want to minimize downtime during the migration. Which approach should they use?

A.Export the database using pg_dump and import using psql in a single connection.
B.Use a VPN tunnel and set up Cloud SQL as a read replica of the on-premises primary.
C.Use Database Migration Service (DMS) with continuous replication from an on-premises replica.
D.Use Database Migration Service (DMS) with a one-time full dump and import.
AnswerC

Continuous replication allows near-zero downtime by keeping the target up-to-date until cutover.

Why this answer

Database Migration Service (DMS) with continuous replication minimizes downtime by performing an initial full load of the database and then continuously replicating changes from the on-premises source to Cloud SQL. This allows the target to stay nearly synchronized with the source, so the final cutover can be completed in seconds or minutes rather than hours.

Exam trap

The trap here is that candidates confuse Cloud SQL's read replica feature (which only works within Cloud SQL) with the ability to replicate from an external primary, leading them to choose Option B despite it being technically impossible.

How to eliminate wrong answers

Option A is wrong because using pg_dump and psql in a single connection is a manual, offline migration method that requires the source database to be locked or read-only during the dump, causing significant downtime. Option B is wrong because Cloud SQL does not support being configured as a read replica of an on-premises PostgreSQL primary; Cloud SQL read replicas can only replicate from a Cloud SQL primary, not from external sources. Option D is wrong because a one-time full dump and import (even via DMS) does not include ongoing change data capture, so the target will be out of sync with the source by the time the import completes, requiring additional downtime for a final sync.

170
MCQhard

A company runs a critical e-commerce platform on Cloud SQL for PostgreSQL with cross-region read replicas for DR. During a recent disaster drill, they promoted the read replica to a standalone instance. After the drill, they attempted to re-create the replica but found that point-in-time recovery (PITR) was not enabled on the promoted instance. What is the most likely cause?

A.The backup retention policy on the original instance limited the PITR window
B.The cross-region replica connectivity was lost during promotion
C.Automated backups and PITR are not enabled by default on the promoted instance
D.The promoted instance does not support PITR because it was originally a read replica
AnswerC

After promotion, the new primary does not have automated backups or PITR enabled; they must be configured explicitly.

Why this answer

When a Cloud SQL read replica is promoted, it becomes a standalone primary instance. By default, automated backups and PITR are not enabled on the promoted instance. The original instance's configuration (including PITR) is not carried over.

The user must manually enable these settings after promotion.

171
MCQeasy

A team wants to use Cloud Build to build a Maven application and store the artifact in Artifact Registry. Which repository format should they use?

A.Python repository
B.npm repository
C.Docker repository
D.Maven repository
AnswerD

Correct: Maven repository stores Java jars and pom files.

Why this answer

The team is building a Maven application, which produces a JAR or WAR artifact. Artifact Registry supports a Maven repository format specifically designed to store and serve Maven artifacts, including pom.xml and JAR files, using the Maven repository layout. This allows Cloud Build to push the artifact directly to a Maven repository in Artifact Registry for dependency management and deployment.

Exam trap

Google often tests the candidate's ability to match the artifact type to the correct repository format, and the trap here is that candidates may confuse 'Maven' as a build tool with 'Docker' as a container format, or assume any artifact can go into any repository, ignoring the protocol-specific requirements.

How to eliminate wrong answers

Option A is wrong because a Python repository stores Python packages (e.g., .whl, .tar.gz) and uses the PyPI protocol, not Maven artifacts. Option B is wrong because an npm repository stores Node.js packages (e.g., .tgz) and uses the npm registry protocol, not Maven artifacts. Option C is wrong because a Docker repository stores container images (e.g., OCI-compliant layers) and uses the Docker Registry HTTP API, not Maven artifacts.

172
Multi-Selecteasy

A developer is using Cloud Build to build a Docker image and wants to use build substitutions to dynamically set the image tag. Which built-in substitutions can they use? (Choose 2)

Select 2 answers
A.$TAG_NAME
B.$SHORT_SHA
C.$_IMAGE_NAME
D.$BRANCH_NAME
E.$_CUSTOM_TAG
AnswersB, D

Short SHA of the commit that triggered the build.

Why this answer

Cloud Build provides built-in substitutions like $SHORT_SHA (short commit SHA) and $BRANCH_NAME. $TAG_NAME is not a built-in substitution; $_USER_DEFINED is a custom substitution with underscore prefix.

173
MCQmedium

A company uses Cloud Logging and wants to receive real-time notifications when the number of 5xx errors exceeds 100 per minute. They need to set up an alerting policy. Which metric type and condition should they use?

A.Create a log-based counter metric and use a metric-absent condition
B.Create a log-based counter metric and use a metric-threshold condition with rate alignment
C.Use a Cloud Monitoring gauge metric with a custom value
D.Use a logs-based alert with a threshold on the log entry count
AnswerB

Counter metric provides the count; rate alignment over 1 minute gives per-minute rate; threshold condition fires when exceeded.

Why this answer

A log-based counter metric can count errors per minute. The alert condition should be 'metric threshold' with 'CUMULATIVE' metric and 'rate' alignment to detect spikes.

174
MCQmedium

An organization wants to track cloud costs per team and per project. They have already enabled billing export to BigQuery. What additional step should they take to enable cost attribution?

A.Create separate billing accounts per team
B.Apply labels to resources (team, environment) and query BigQuery billing export
C.Use resource hierarchy folders to track costs
D.Enable VPC flow logs for cost tracking
AnswerB

Labels are designed for cost attribution.

Why this answer

Labels are key-value pairs attached to resources. By applying labels like `team` and `environment`, billing data in BigQuery can be queried to attribute costs.

175
MCQmedium

A team has an SLO of 99.9% availability over a 30-day month. They burn through their entire error budget in the first 10 days. Which of the following is the MOST appropriate immediate action according to SRE principles?

A.Reduce the error budget by lowering the SLO to 99%
B.Freeze all feature releases and focus on reliability improvements
C.Deploy a new feature to increase user engagement
D.Increase the SLO to 99.99% to act as a buffer
AnswerB

SRE practice dictates that when error budget is exhausted, releases are halted to restore reliability.

Why this answer

When error budget is exhausted, the team should halt all feature releases and focus on reliability improvements to prevent further degradation.

176
Multi-Selecthard

An organization uses Cloud SQL for PostgreSQL with read replicas to offload reporting queries. During peak, the primary instance's CPU spikes to 90%. The team suspects the read replica is falling behind. Which two settings should they check to diagnose replication lag? (Choose TWO.)

Select 2 answers
A.pg_stat_replication view on the primary.
B.pg_replication_slots view on the replica.
C.Replica lag metric in Cloud Monitoring.
D.max_wal_size configuration parameter.
E.SHOW REPLICATION STATUS command.
AnswersA, C

Shows replication lag and status.

Why this answer

The `pg_stat_replication` view on the primary instance shows the WAL sender process state, including the `write_lag`, `flush_lag`, and `replay_lag` columns that directly measure replication lag in PostgreSQL. This view provides real-time data on how far behind each standby (including read replicas) is in receiving, flushing, and applying WAL data, making it the primary diagnostic tool for replication lag.

Exam trap

Google Cloud exams often test the distinction between PostgreSQL-specific commands and MySQL commands, so the trap here is that candidates familiar with MySQL might choose `SHOW REPLICATION STATUS` (which is `SHOW REPLICA STATUS` in MySQL 8.0.23+) instead of the correct PostgreSQL diagnostic tools.

177
MCQmedium

A company uses Config Sync to manage GKE clusters in a GitOps fashion. They need to ensure that resources are automatically synced from a Git repository to the cluster, and that any drift from the desired state is corrected. Which Config Sync mode should they enable?

A.Dry-run mode
B.Sync mode
C.Monitor mode
D.Policy mode
AnswerB

Sync mode applies the manifests and continuously reconciles to the desired state.

Why this answer

Config Sync supports a 'sync' mode that automatically applies the manifests from the repository and continuously reconciles to correct drift. The 'monitor' mode only detects drift but does not correct it.

178
Multi-Selectmedium

A database administrator is planning to migrate an on-premises MySQL database to Cloud SQL. Which two steps are required to ensure a secure migration?

Select 2 answers
A.Configure Cloud SQL to use a private IP address
B.Add authorized networks for all client IPs
C.Ensure the database is encrypted at rest using CMEK
D.Enable SSL/TLS for all connections
E.Set up Cloud SQL Proxy for secure authentication and encryption
AnswersA, E

Private IP ensures traffic stays within Google Cloud network.

Why this answer

Using a private IP address for Cloud SQL ensures that the database instance is not exposed to the public internet, reducing the attack surface. This is a fundamental security best practice for database migrations, as it restricts network access to within a Virtual Private Cloud (VPC) and requires traffic to traverse Google's internal network, which is more secure than public IP routing.

Exam trap

Google Cloud often tests the distinction between 'best practice' and 'required step' — candidates may select SSL/TLS (Option D) as a required step, but the exam expects understanding that Cloud SQL Proxy inherently provides encryption and authentication, making separate SSL/TLS configuration redundant for the migration scenario.

179
MCQhard

A company is migrating an on-premises PostgreSQL 13 database to AlloyDB for PostgreSQL using DMS continuous migration. The source is configured with logical replication using the pglogical extension. During the initial sync, the migration job fails with the error 'could not open relation with OID xxxx'. What is the most likely cause?

A.The source database has a firewall blocking the DMS IP address.
B.The source database does not have the pglogical extension installed.
C.The target AlloyDB cluster does not have the pglogical extension.
D.A DDL operation on the source dropped or altered a table after the replication slot was created.
AnswerD

DDL changes invalidate the replication slot, causing the relation OID error.

Why this answer

DMS uses logical replication slots when possible. If the source has DDL changes (e.g., table dropped) after the slot is created, the replication slot may become invalid.

180
MCQmedium

Refer to the exhibit. What is the likely cause of this error?

A.The table is a view
B.The query does not include WHERE clause with partition column
C.The table is not partitioned
D.The user does not have permission to query the table
AnswerB

The error states no filter over the partition column, meaning the query tries to scan all partitions, which is blocked by a query optimizer or cost control.

Why this answer

The error occurs because the query attempts to access a partitioned table without specifying the partition column in the WHERE clause. In BigQuery (the platform relevant to the Google Professional Cloud Data Engineer exam), querying a large partitioned table without a partition filter forces a full scan of all partitions, which can exceed resource limits or time out. The correct approach is to include the partition column in the WHERE clause to enable partition pruning and avoid such errors.

Exam trap

Google Cloud often tests the misconception that any table can be queried without a WHERE clause, but for partitioned tables, the partition column must be included in the WHERE clause to avoid full partition scans and associated errors.

How to eliminate wrong answers

Option A is wrong because a view would not cause this specific error; views can be queried without a WHERE clause, and the error message would differ (e.g., 'invalid object' or 'view does not exist'). Option C is wrong because if the table were not partitioned, there would be no partition-related error; the error specifically indicates a partition-related issue. Option D is wrong because permission errors typically produce 'insufficient privileges' or 'access denied' messages, not the error shown in the exhibit.

181
Multi-Selecteasy

Which TWO actions would help optimize a Cloud SQL for PostgreSQL database experiencing high read latency?

Select 2 answers
A.Increase the number of read replicas
B.Add indexes on frequently queried columns
C.Increase database tier machine type
D.Configure automatic storage increase
E.Use pgBouncer connection pooling
AnswersB, C

Adding indexes reduces full table scans and speeds up query execution, directly addressing high read latency.

Why this answer

Adding indexes on frequently queried columns (B) reduces full table scans, and increasing the database tier machine type (C) provides more CPU/memory for query processing. Read replicas (A) distribute load but do not reduce individual query latency; connection pooling (E) helps connection management, not read latency; automatic storage increase (D) is irrelevant.

182
MCQmedium

A Memorystore for Redis instance is running out of memory. The application uses a mix of cache and session data. Which eviction policy should be chosen to minimize cache misses while ensuring session data is not evicted?

A.noeviction
B.volatile-ttl
C.allkeys-lru
D.allkeys-random
AnswerB

Evicts only keys with TTL set (cache), leaving session data (no TTL) intact.

Why this answer

The volatile-ttl policy evicts keys with a TTL set, prioritizing those with the shortest remaining TTL. Since session data typically has a TTL and cache data may or may not, this policy allows you to protect session data by assigning it a longer TTL, while cache data with shorter TTLs is evicted first, minimizing cache misses.

Exam trap

The PCDOE exam often tests the misconception that allkeys-lru is always the best for cache performance, but here the requirement to protect session data makes volatile-ttl the correct choice because it only evicts keys with TTLs, allowing session data to be preserved by setting a longer TTL.

How to eliminate wrong answers

Option A is wrong because noeviction prevents any eviction, causing write operations to fail with OOM errors when memory is full, which does not resolve the memory pressure. Option C is wrong because allkeys-lru evicts the least recently used key from the entire keyspace, regardless of TTL, so session data with a TTL could be evicted if it is not recently used. Option D is wrong because allkeys-random evicts random keys from the entire keyspace, providing no control over which data is removed, risking eviction of session data and increasing cache misses.

183
MCQhard

A DevOps engineer is using Terraform and wants to reference outputs from another Terraform configuration that manages networking. Which approach should they use?

A.Use Cloud Shell environment variables
B.Use `terraform_remote_state` data source pointing to the networking project's GCS state
C.Use Terraform Cloud's variable sets
D.Hardcode the networking values in variables
AnswerB

This data source retrieves outputs from another state file.

Why this answer

The `terraform_remote_state` data source is the correct approach because it allows one Terraform configuration to securely read the latest state outputs (e.g., VPC IDs, subnet CIDRs) from another configuration's state file stored in a remote backend like Google Cloud Storage (GCS). This avoids hardcoding or manual copying of values, ensures consistency, and supports dependency management across configurations. By pointing to the networking project's GCS state, the DevOps engineer can dynamically reference outputs like `networking.vpc_id` without exposing sensitive data in environment variables or variable files.

Exam trap

A common misconception in Google Cloud exams is that environment variables or variable sets can substitute for cross-configuration state sharing, but the only native Terraform mechanism for reading outputs from another configuration's state is `terraform_remote_state`.

How to eliminate wrong answers

Option A is wrong because Cloud Shell environment variables are ephemeral, session-specific, and not designed for cross-configuration state sharing; they would require manual export each time and break automation. Option C is wrong because Terraform Cloud variable sets are used to share common variables across workspaces, not to read outputs from another configuration's state; they cannot dynamically fetch remote state outputs. Option D is wrong because hardcoding networking values in variables defeats the purpose of Infrastructure as Code (IaC), introduces duplication, and creates maintenance overhead when networking values change.

184
MCQhard

A Cloud Spanner database needs to add a column 'discount' to the 'Products' table without any downtime. The table is actively used. What is the correct approach?

A.Create a new table with the column and copy data over
B.Execute ALTER TABLE Products ADD COLUMN discount FLOAT64
C.Create a secondary index that includes the new column
D.Define a generated column based on an existing column
AnswerB

Spanner allows DDL changes while the table remains fully available.

Why this answer

Cloud Spanner supports online schema changes via ALTER TABLE without downtime. The operation is performed asynchronously in the background, allowing the table to remain fully available for reads and writes. The new column 'discount' is automatically populated with NULL for existing rows.

Option A is incorrect because creating a new table and copying data introduces downtime and complexity. Option C is incorrect because a secondary index cannot add a column; it only indexes existing columns. Option D is incorrect because a generated column is derived from other columns, not used to add a new independent column.

Exam trap

The trap here is that candidates may assume schema changes require downtime or data migration in a distributed database, but Cloud Spanner's online schema change capability allows ALTER TABLE to be executed without blocking reads or writes.

How to eliminate wrong answers

Option A is wrong because creating a new table and copying data over introduces significant downtime and complexity, and is unnecessary since Cloud Spanner handles schema changes online. Option C is wrong because a secondary index does not add a column to the table; it only creates an index on existing columns, which does not meet the requirement of adding a new column. Option D is wrong because a generated column derives its value from other columns and cannot be used to introduce a new independent column like 'discount'.

185
Multi-Selecthard

Your organization uses Cloud Spanner for a global application with strong consistency requirements. You need to design a table schema to avoid hot spots while supporting queries that join two related entities (e.g., Customers and Orders). Which THREE design choices should you implement? (Choose three)

Select 3 answers
A.Use monotonically increasing keys (e.g., auto-increment) for easy ordering.
B.Use hash prefixes or random UUIDs as the primary key to distribute writes.
C.Disable strict consistency to allow faster writes.
D.Create secondary indexes with the INTERLEAVE IN PARENT option to store index data with the parent.
E.Use interleaved tables to store Customers and Orders together for efficient joins.
AnswersB, D, E

Uniformly distributed keys prevent hot spots.

Why this answer

To avoid hot spots and support efficient joins in Cloud Spanner, three design choices are recommended. First, use hash prefixes or random UUIDs as the primary key (B) to distribute writes evenly across nodes, preventing hot spots caused by monotonically increasing keys. Second, create secondary indexes with the INTERLEAVE IN PARENT option (D) to store index data alongside the parent table, reducing read latency for queries that filter by the indexed columns.

Third, use interleaved tables (E) to store related rows (e.g., Customers and Orders) physically together, enabling efficient joins without cross-node lookups. These choices leverage Spanner's distributed architecture for scalability and strong consistency.

186
MCQeasy

A team is migrating a PostgreSQL database to AlloyDB using Database Migration Service. They need to perform an initial one-time full dump without continuous replication. Which migration job type should they choose?

A.Bulk
B.Continuous
C.Snapshot
D.One-time
AnswerD

One-time performs a full dump and stops. This matches the requirement.

Why this answer

Database Migration Service supports two job types: 'One-time' (full dump only) and 'Continuous' (full dump + CDC). For a one-time migration without ongoing replication, select 'One-time'. Continuous includes CDC for ongoing sync.

187
MCQhard

A company has a Cloud SQL for MySQL instance with automated backups enabled. They need to restore the database to a specific timestamp from 2 days ago. The backup retention is set to 7 days. How should they perform this restore?

A.Export the database and import it into a new instance
B.Create an on-demand backup and restore from that backup
C.Use gcloud sql instances clone with the --point-in-time flag and the desired timestamp
D.Use gcloud sql instances restore-backup with the backup ID from 2 days ago
AnswerC

Cloning with --point-in-time allows restoration to any timestamp within the binary log retention period.

Why this answer

Cloud SQL for MySQL supports point-in-time recovery (PITR), which allows you to restore a database to a specific timestamp within the backup retention period (here, 7 days). The `gcloud sql instances clone` command with the `--point-in-time` flag creates a new instance that reflects the database state at the exact requested timestamp, leveraging the transaction logs retained by automated backups.

Exam trap

The trap here is that candidates confuse `gcloud sql instances restore-backup` (which restores from a full backup only) with point-in-time recovery, not realizing that the clone command with `--point-in-time` is the correct method for timestamp-based restores.

How to eliminate wrong answers

Option A is wrong because exporting and importing the database is a manual, full-database dump and restore process that does not support point-in-time recovery; it would only restore to the state at the time of the export, not to a specific timestamp from 2 days ago. Option B is wrong because creating an on-demand backup captures the database state only at the moment the backup is taken, and you cannot restore from that backup to a different timestamp; it does not provide the granularity needed for a point-in-time restore. Option D is wrong because `gcloud sql instances restore-backup` restores from a specific full backup (identified by backup ID), not to a precise timestamp; it would restore the database to the state at the time that backup was taken, which may not match the desired timestamp from 2 days ago.

188
Multi-Selectmedium

A company runs a high-throughput pub/sub system. They need to improve message processing throughput. Which two actions should they take? (Choose TWO).

Select 2 answers
A.Enable ordering keys
B.Increase the number of parallel pull subscribers
C.Enable flow control to limit outstanding messages
D.Decrease the acknowledgement deadline
E.Use a single pull subscriber
AnswersB, C

More subscribers increase processing parallelism.

Why this answer

Increasing parallel pull consumers and enabling flow control can improve throughput by distributing load and preventing subscriber overload.

189
Multi-Selectmedium

A company is experiencing slow query performance in Cloud SQL for PostgreSQL. Which TWO tools can help identify the root cause?

Select 2 answers
A.Cloud Monitoring
B.Query Insights
C.Cloud Logging with error reporting
D.Cloud Profiler
E.Cloud Trace
AnswersA, B

Cloud Monitoring shows instance-level resource metrics that can indicate bottlenecks.

Why this answer

Cloud Monitoring provides metrics and dashboards to track database performance indicators like CPU utilization, memory usage, disk I/O, and query latency, helping identify resource bottlenecks. Query Insights offers detailed query-level diagnostics, including execution plans, lock contention, and slow query analysis, directly pinpointing problematic SQL statements in Cloud SQL for PostgreSQL.

Exam trap

The trap here is that candidates often confuse Cloud Logging’s error reporting with performance diagnostics, or assume Cloud Profiler and Cloud Trace can analyze database internals, when in fact they are application-layer tools not designed for PostgreSQL query tuning.

190
MCQmedium

A company needs to store petabytes of time-series IoT sensor data and query it with single-digit millisecond latency at millions of reads per second. The data has a simple key-value structure with timestamps. Which Google Cloud database is MOST appropriate?

A.Firestore
B.Cloud Spanner
C.Cloud Bigtable
D.BigQuery
AnswerC

Bigtable is the correct choice: wide-column NoSQL, designed for time-series and IoT workloads, single-digit ms latency, and scales to millions of QPS with additional nodes.

Why this answer

Cloud Bigtable is designed for exactly this use case — petabyte-scale, low-latency (single-digit ms), high-throughput NoSQL storage for time-series, IoT, and financial data. It scales horizontally by adding nodes. BigQuery is optimised for analytics (seconds-to-minutes latency), Cloud SQL is for OLTP (limited to tens of thousands of QPS), and Firestore is for document data with hierarchical structure.

191
MCQmedium

A company uses BigQuery with a table 'orders' that has a column 'items' of type ARRAY<STRUCT<product_id STRING, quantity INT64>>. An analyst needs to find orders that contain a specific product, 'ABC'. Which query is most efficient?

A.SELECT * FROM orders WHERE EXISTS (SELECT 1 FROM UNNEST(items) WHERE product_id = 'ABC')
B.SELECT * FROM orders WHERE ARRAY_LENGTH(items) > 0
C.SELECT * FROM orders WHERE 'ABC' IN UNNEST(items)
D.SELECT o.*, item FROM orders o, UNNEST(items) item WHERE item.product_id = 'ABC'
AnswerA

EXISTS with UNNEST is the standard pattern for array membership.

Why this answer

It uses a correlated subquery with `UNNEST` and `EXISTS`, which stops scanning as soon as a matching product_id is found within each row's array. This is the most efficient pattern for checking array membership in BigQuery, as it avoids unnecessary row multiplication and leverages short-circuit evaluation.

Exam trap

Google Cloud often tests the misconception that `IN UNNEST` works directly with struct arrays, when in fact it requires a scalar field extraction, and that `CROSS JOIN UNNEST` is always the correct way to filter array contents, ignoring the performance penalty of row multiplication.

How to eliminate wrong answers

Option B is wrong because `ARRAY_LENGTH(items) > 0` only checks if the array is non-empty, not whether it contains the specific product 'ABC'. Option C is wrong because `'ABC' IN UNNEST(items)` is invalid syntax; `IN` with `UNNEST` requires a scalar comparison, but `items` is an array of structs, not scalars, so this will cause a type mismatch error. Option D is wrong because the implicit `CROSS JOIN` with `UNNEST` multiplies rows for each array element, which is inefficient for large tables and requires a `DISTINCT` or `SELECT o.*` with deduplication to avoid duplicate order rows, making it slower and more resource-intensive than the `EXISTS` approach.

192
Multi-Selectmedium

Your GKE cluster uses node auto-provisioning to automatically create node pools. However, you notice that the cluster autoscaler is removing nodes too aggressively, causing frequent pod evictions. Which TWO configuration changes can you make to reduce the frequency of scale-down events? (Choose two)

Select 2 answers
A.Increase the scale-down delay to 10 minutes.
B.Decrease the max node count to limit scaling.
C.Enable node auto-provisioning to automatically create new node pools.
D.Set a minimum node count (e.g., 2) to guarantee a baseline of nodes.
E.Use PodDisruptionBudget to protect critical pods.
AnswersA, D

A longer delay prevents premature removal of nodes.

Why this answer

The cluster autoscaler scale-down delay options control how long a node must be underutilized before it is removed. Increasing the scale-down delay (e.g., to 10 minutes) gives pods more time to stabilize. Additionally, setting a minimum number of nodes ensures that even if nodes are underutilized, they are not scaled down below a certain threshold, reducing evictions.

Decreasing max nodes or enabling node auto-provisioning would not help.

193
MCQmedium

A team is migrating from Cloud Deployment Manager to Terraform. They need to manage state for multiple environments (dev, staging, prod) using a single Terraform configuration. Which Terraform feature should they use to achieve this?

A.Use Terraform data sources to switch between environments.
B.Use Terraform workspaces, with each workspace mapping to an environment and storing state in the same GCS bucket with workspace-specific prefixes.
C.Use Terraform modules with different variable files for each environment.
D.Create separate Terraform configurations in separate directories.
AnswerB

Workspaces provide isolated state per environment while using the same configuration.

Why this answer

Terraform workspaces allow you to manage multiple distinct state files from a single configuration. By mapping each workspace to an environment (dev, staging, prod) and configuring a single GCS backend with workspace-specific prefixes (e.g., `prefix = "terraform/state"`), Terraform automatically stores each workspace's state in a separate path within the same bucket. This enables isolated state management without duplicating configuration code.

Exam trap

A common misconception is that workspaces are only for code branching or that variable files alone can isolate state, but workspaces are specifically designed for state isolation with a single configuration and backend.

How to eliminate wrong answers

Option A is wrong because data sources are used to fetch or compute data from providers, not to manage state isolation or switch between environments; they cannot separate state files. Option C is wrong because modules with different variable files only provide input parameterization, not separate state storage; all environments would still share the same state file unless combined with workspaces or separate backends. Option D is wrong because creating separate directories with separate configurations duplicates code and increases maintenance overhead, whereas workspaces achieve the same goal with a single configuration.

194
MCQhard

Refer to the exhibit. The query used DATE_TRUNC(order_date, MONTH) as month. order_date is a TIMESTAMP column. What is the data type of the month column in the result?

A.STRING
B.DATE
C.DATETIME
D.TIMESTAMP
AnswerD

DATE_TRUNC of a TIMESTAMP returns a TIMESTAMP with time set to 00:00:00.

Why this answer

In BigQuery (the SQL engine for the PCDE exam), DATE_TRUNC with a TIMESTAMP input and MONTH granularity returns a TIMESTAMP value, not a DATE or DATETIME. The function truncates the timestamp to the first day of the month at 00:00:00 UTC, preserving the TIMESTAMP data type. Therefore, the month column in the result is of type TIMESTAMP.

Exam trap

The trap here is that candidates often assume DATE_TRUNC returns a DATE because of the word 'DATE' in the function name, but in BigQuery the output type matches the input type, so a TIMESTAMP input yields a TIMESTAMP output.

How to eliminate wrong answers

Option A is wrong because DATE_TRUNC does not return a STRING; it returns a temporal type, not a text representation. Option B is wrong because DATE_TRUNC on a TIMESTAMP column returns a TIMESTAMP, not a DATE; a DATE would lack the time component entirely. Option C is wrong because DATETIME is a different type that does not include timezone context, whereas BigQuery's DATE_TRUNC on a TIMESTAMP preserves the TIMESTAMP type with timezone awareness.

195
MCQhard

Your company runs an e-commerce platform on Google Cloud. The platform uses Cloud SQL for MySQL to store product inventory. The inventory table has the following schema: CREATE TABLE inventory (product_id INT PRIMARY KEY, quantity INT, last_updated TIMESTAMP) ENGINE=InnoDB. The application performs frequent updates on quantity for a subset of popular products. Recently, you have noticed increased deadlock errors during peak hours. The application uses REPEATABLE READ isolation level. You suspect that the schema design is contributing to locking contention. After analyzing the workload, you find that the updates often involve incrementing or decrementing quantity by small amounts and are mostly on the same set of popular products. What would be the best course of action to reduce deadlocks without compromising data integrity?

A.Rewrite the update query to use atomic operations (e.g., UPDATE inventory SET quantity = quantity - ? WHERE product_id = ?) without pre-fetching the current value.
B.Change the engine to MyISAM to avoid row-level locking.
C.Partition the inventory table by product_id range to spread the load.
D.Reduce the isolation level to READ COMMITTED to reduce locking.
AnswerA

Atomic updates avoid the need for SELECT ... FOR UPDATE and significantly reduce locking and deadlock chances.

Why this answer

The application's pattern of reading the current quantity before updating (e.g., SELECT quantity FROM inventory WHERE product_id = ?, then UPDATE inventory SET quantity = ? WHERE product_id = ?) causes gap locks and deadlocks under REPEATABLE READ. By using an atomic UPDATE (UPDATE inventory SET quantity = quantity - ? WHERE product_id = ?), the database performs the update without a prior read, reducing lock contention. This maintains data integrity because the subtraction is atomic and accurate.

Option B is wrong because MyISAM does not support transactions or row-level locking, which compromises data integrity. Option C is wrong because partitioning does not reduce locking contention on the same rows; it only improves data management. Option D is wrong because reducing isolation to READ COMMITTED may reduce some locking but introduces non-repeatable reads and does not address the fundamental read-before-write pattern that causes deadlocks.

196
MCQeasy

An organization needs to define RTO and RPO for their database disaster recovery plan. They have a Cloud SQL for SQL Server instance with HA enabled. What are the typical RTO and RPO for an automatic HA failover?

A.RPO: replication lag (seconds), RTO: minutes
B.RPO: near zero, RTO: under 60 seconds
C.RPO: zero, RTO: zero
D.RPO: minutes, RTO: hours
AnswerB

Cloud SQL HA uses synchronous replication in the same region, providing near-zero RPO and RTO under 60 seconds.

Why this answer

Cloud SQL HA failover is automatic within the same region. It provides RPO near zero (minimal data loss) and RTO typically under 60 seconds.

197
MCQmedium

An organization wants to enforce that all Compute Engine instances in their Google Cloud organization are created with Shielded VM enabled. What is the MOST effective way to enforce this requirement?

A.Configure a VPC Service Controls perimeter to only allow Shielded VMs.
B.Set an organization policy with the constraint compute.requireShieldedVm at the organization level.
C.Create a custom IAM role that only allows creating VMs with Shielded VM enabled.
D.Use Cloud Audit Logs to detect non-compliant VMs and trigger a Cloud Function to delete them.
AnswerB

This organization policy denies creation of VMs that do not have Shielded VM enabled, enforcing the requirement.

Why this answer

Organization policies can enforce constraints on resource creation. The compute.requireShieldedVm constraint ensures that any new VM must have Shielded VM enabled; otherwise, the creation fails.

198
MCQmedium

You are managing a Spanner instance for a global financial application. The database has a table `transactions` with columns `transaction_id` (INT64), `user_id` (INT64), `amount` (FLOAT64), `timestamp` (TIMESTAMP), and `region` (STRING). The table is interleaved with a parent table `users`. Recently, you observed that point-read queries by `transaction_id` are taking over 100ms on average, whereas they used to take under 10ms. The instance CPU utilization is below 40%, and there are no contention issues. The `transactions` table has a primary key `(user_id, transaction_id)`. Queries filter on `transaction_id` only, without specifying `user_id`. Which optimization should you implement to improve point-read latency?

A.Add a secondary index on `user_id` to help narrow down the search.
B.Create a secondary index on `transaction_id` to enable efficient key-based lookups.
C.Use a Spanner query hint to force a specific index scan.
D.Change the primary key to `(transaction_id, user_id)` to enable direct access by transaction_id.
AnswerB

A secondary index on `transaction_id` provides a direct lookup path, reducing latency.

Why this answer

Point-read queries by `transaction_id` are slow because the primary key is `(user_id, transaction_id)`, so without `user_id`, Spanner cannot directly locate the split (tablet) and must perform a full table scan or a less efficient lookup. Creating a secondary index on `transaction_id` allows Spanner to use that index for key-based lookups, reducing latency to under 10ms by enabling direct access to the specific split via the index's key.

Exam trap

Google Cloud often tests the misconception that changing the primary key is the only way to optimize queries that don't use the full primary key, but in Spanner, secondary indexes are the correct and efficient solution without disrupting existing interleaved table relationships.

How to eliminate wrong answers

Option A is wrong because adding a secondary index on `user_id` does not help queries that filter only on `transaction_id`; it would only be useful if queries filtered on `user_id` alone or in combination with `transaction_id`. Option C is wrong because a query hint to force a specific index scan is unnecessary and ineffective if no suitable index exists; the hint cannot create an index that doesn't exist, and without an index on `transaction_id`, Spanner would still perform a full scan. Option D is wrong because changing the primary key to `(transaction_id, user_id)` would require a costly schema change and data migration, and it would break the interleaved table structure with the parent `users` table, which expects `user_id` as the first part of the primary key for interleaving.

199
MCQmedium

An engineer is configuring Cloud Build to use a substitution variable for the Docker image tag. They want the tag to be the short commit SHA. Which built-in substitution should they use?

A.$TAG_NAME
B.$SHORT_SHA
C.$COMMIT_SHA
D.$REVISION_ID
AnswerB

$SHORT_SHA is the built-in substitution for the short commit SHA.

200
Multi-Selectmedium

You are monitoring a Cloud Spanner instance that is experiencing high CPU utilization (consistently above 70%). You want to identify the root cause. Which TWO metrics should you examine first? (Choose two.)

Select 2 answers
A.Average commit latency
B.Read and write throughput (operations/second)
C.Lock wait time
D.Stale read rate
E.Number of nodes
AnswersA, B

High commit latency can indicate contention, increasing CPU.

Why this answer

Examining read and write throughput helps identify if the workload is pushing the instance. Analyzing commit latency and lock wait time reveals contention. Stale reads show replica lag but are not primary indicators of high CPU.

Node count is configuration, not utilization.

201
Multi-Selectmedium

A company is planning disaster recovery for Bigtable. They have two clusters in different regions with replication enabled. They want to automate failover using Cloud DNS. Which THREE components are required for this automation? (Choose 3)

Select 3 answers
A.Bigtable replication routing policy set to any-replica.
B.Cloud Bigtable AppProfile with single-cluster routing.
C.Cloud HTTP(S) health check for the Bigtable cluster endpoints.
D.Cloud Functions to update the DNS record on health check failure.
E.Cloud DNS managed zone with a weighted routing policy.
AnswersC, D, E

Health checks determine primary cluster health.

Why this answer

To automate Bigtable failover, you need a Cloud HTTP(S) health check to monitor the primary cluster, a Cloud DNS routing policy (e.g., weighted round robin) that can be updated, and a mechanism (e.g., Cloud Functions or an external tool) to update the DNS record when the health check fails.

202
MCQhard

A team uses GitOps with Config Sync to manage multiple GKE clusters. They want to ensure that if a cluster's state drifts from the desired state in the Git repository, it is automatically corrected. Config Sync is installed with the default settings. What else must be configured?

A.Enable the 'drift correction' option in Config Sync
B.Set up a Cloud Scheduler to run 'kubectl apply' periodically
C.Install Anthos Config Management with the 'policy controller' enabled
D.No additional configuration is required; drift correction is automatic
AnswerD

Config Sync automatically reconciles the cluster state with the Git repository, correcting any drift.

Why this answer

Config Sync, by default, operates in a continuous reconciliation loop. It periodically compares the live state of the cluster against the desired state defined in the Git repository. If any drift is detected, Config Sync automatically applies the necessary changes to revert the cluster back to the desired state.

Therefore, no additional configuration is needed for automatic drift correction.

Exam trap

The trap here is that candidates may assume a separate 'drift correction' feature must be enabled, not realizing that Config Sync's core design already includes automatic drift correction as a fundamental behavior of its continuous reconciliation loop.

How to eliminate wrong answers

Option A is wrong because Config Sync does not have a separate 'drift correction' option; drift correction is an inherent behavior of its reconciliation loop, not a toggleable feature. Option B is wrong because using Cloud Scheduler to run 'kubectl apply' is an external, manual workaround that duplicates Config Sync's built-in functionality and introduces unnecessary complexity and potential race conditions. Option C is wrong because Anthos Config Management's 'policy controller' (based on OPA/Gatekeeper) is for enforcing policy constraints, not for correcting configuration drift; drift correction is handled by the Config Sync component itself.

203
MCQeasy

A company wants to ensure that all new projects created in their Google Cloud organization automatically inherit a set of baseline IAM roles for the security team. Which approach should they use?

A.Grant the roles at the folder or organization level.
B.Use Cloud Audit Logs to detect new projects and trigger a Cloud Function to add roles.
C.Grant the roles at the project level after each project is created.
D.Use a custom script that runs periodically to add roles.
AnswerA

IAM inheritance means roles granted at higher levels are inherited by all projects underneath.

Why this answer

IAM roles can be granted at the folder or organization level, and they are inherited by all child projects. Granting roles at the organization level ensures every new project inherits them automatically.

204
MCQeasy

A company uses BigQuery to generate daily sales reports. The query aggregates sales by product category and region. The table 'sales_raw' is 500 GB and is updated every hour with new transactions. The report runs slowly. What is the most cost-effective method to improve query performance without changing the existing table schema?

A.Partition the table by product category
B.Create a separate summary table using scheduled queries
C.Create a materialized view that aggregates sales by product category and region
D.Cluster the table by region
AnswerC

Materialized views automatically maintain pre-computed aggregates, significantly reducing query cost and latency.

Why this answer

A materialized view in BigQuery pre-computes and stores the aggregated results of the query, allowing subsequent queries to read the pre-aggregated data instead of scanning the entire 500 GB 'sales_raw' table. This reduces both the data scanned and the query execution time, and it is automatically refreshed when the base table is updated (every hour), making it cost-effective as you only pay for the bytes used by the materialized view and the incremental refreshes, not for full table scans.

Exam trap

Google Cloud often tests the distinction between partitioning/clustering (which optimize data scanning but do not pre-compute results) and materialized views (which store pre-computed results), leading candidates to choose partitioning or clustering as a 'quick fix' without realizing they do not eliminate the need for full aggregation scans.

How to eliminate wrong answers

Option A is wrong because partitioning by product category is not supported in BigQuery (partitioning is based on date, timestamp, or integer range, not on string columns like product category), and even if it were, partitioning alone does not pre-aggregate data, so the query would still need to scan all partitions to compute the aggregation. Option B is wrong because creating a separate summary table using scheduled queries introduces additional complexity and cost for manual refresh scheduling, and it does not provide automatic incremental updates like a materialized view, leading to potential data staleness and extra storage costs for the duplicate table. Option D is wrong because clustering the table by region only improves the performance of queries that filter or sort by region, but it does not pre-compute the aggregation; the query would still scan all rows in the clustered blocks to perform the GROUP BY, so it does not reduce the data scanned for the aggregation itself.

205
Multi-Selecthard

You are migrating a 5 TB MySQL database to Cloud SQL. The migration must have minimal downtime. Which THREE steps should you include in your migration plan?

Select 3 answers
A.Configure continuous replication between on-premises and Cloud SQL.
B.Set up Database Migration Service from the on-premises database to Cloud SQL.
C.Take a full backup and restore to Cloud SQL.
D.Perform a manual failover by stopping the application and promoting the replica.
E.Use mysqldump to export the database.
AnswersA, B, D

DMS uses CDC for continuous replication.

Why this answer

Configuring continuous replication (e.g., using Database Migration Service with CDC) ensures that changes made on the on-premises MySQL database are continuously applied to Cloud SQL, keeping them in sync with minimal lag. This is essential for achieving minimal downtime, as it allows the final cutover to be nearly instantaneous.

Exam trap

Google often tests the misconception that a full backup and restore (Option C) or a simple export/import (Option E) can be performed with minimal downtime, but these methods inherently require the source database to be offline or heavily locked for the duration of the operation.

206
MCQeasy

You are deploying a batch job on Compute Engine that processes large datasets and can tolerate interruptions. The job runs for about 6 hours every night. Which option would minimize cost while ensuring the job completes within the 6-hour window?

A.Use standard VMs with committed use discounts for 1 year.
B.Use custom machine types to optimize cost.
C.Use preemptible VMs to get up to 80% discount, with checkpointing to resume if preempted.
D.Use sole-tenant nodes for dedicated hardware.
AnswerC

Preemptible VMs are cost-effective for fault-tolerant batch workloads; checkpointing ensures completion.

Why this answer

Preemptible VMs are significantly cheaper (up to 80% discount) but can be terminated at any time. For fault-tolerant batch jobs, preemptible VMs are ideal; if preempted, the job can resume on another preemptible VM. Committed use discounts provide cost savings for steady-state usage (1- or 3-year commitment), but are not suitable for a nightly 6-hour job.

Custom machine types or standard VMs would be more expensive.

207
Multi-Selectmedium

A financial services company uses Cloud Spanner for transaction processing. They need to capture real-time changes from the database to stream to a downstream analytics system. Which THREE services or features can achieve this?

Select 3 answers
A.Cloud SQL for PostgreSQL
B.Cloud Pub/Sub
C.Bigtable replication
D.Spanner change streams
E.Cloud Dataflow
AnswersB, D, E

Pub/Sub can deliver change stream events to subscribers.

Why this answer

Spanner change streams are correct because they capture row-level mutations in real time directly from Cloud Spanner. Cloud Pub/Sub is correct as it provides a fully managed messaging service that ingests and delivers change events from Spanner change streams to downstream systems with at-least-once delivery and low latency. Cloud Dataflow is correct because it can process and transform the change stream events in real time, enabling streaming analytics or integration with other services.

Together, these three services form a complete pipeline: Spanner change streams capture changes, Pub/Sub transports them, and Dataflow processes them for the analytics system.

Exam trap

Candidates often confuse services that capture changes (Spanner change streams) with services that transport or process those changes (Pub/Sub, Dataflow), leading to incorrect selections like Bigtable replication or Cloud SQL, which serve different purposes.

208
MCQeasy

A DevOps team wants to implement policy-as-code to enforce that all Terraform configurations comply with security rules before deployment. Which tool is most appropriate for pre-commit policy checks on Terraform plans?

A.Google Cloud Deployment Manager
B.Conftest
C.Open Policy Agent (OPA)
D.Sentinel
AnswerB

Conftest is specifically designed for policy checks on configuration files, including Terraform, using OPA's Rego language.

Why this answer

Conftest is a tool that can evaluate policy as code (using Rego language) against structured configuration files like Terraform HCL or plan JSON. It is designed for pre-commit checks in CI/CD pipelines.

209
MCQmedium

A team is designing a Cloud Spanner schema for an e-commerce platform. They have 'Customer' and 'Order' tables and want to ensure that queries for all orders of a specific customer are efficient. Which schema design approach should they use?

A.Interleave the 'Order' table under the 'Customer' table with CustomerID as the first part of Orders' primary key
B.Use a single table with denormalized customer and order data
C.Use a secondary index on CustomerID in the Order table
D.Create a separate 'Order' table with a foreign key to Customer
AnswerA

Interleaving colocates orders with their customer, making queries for a customer's orders very efficient.

Why this answer

Spanner supports interleaving tables, where child rows are stored physically near the parent row. Interleaving Orders under Customers using the CustomerID as the first part of the primary key in Orders makes queries for all orders of a customer efficient by colocating related data.

210
MCQhard

A company uses Cloud Bigtable for time-series data from IoT devices. Each device sends a reading every second. The row key is device_id#timestamp (reverse timestamp). The team reports that queries for a specific device's data over the last hour are fast, but queries for all devices' data over the last minute are very slow. What is the most likely cause?

A.The Bigtable cluster does not have enough nodes to handle the scan.
B.The query is scanning multiple column families.
C.The row key design does not allow efficient scanning for all devices because device_id is the prefix.
D.The table has too many tablets, causing high overhead.
AnswerC

Prefix scans on device_id are efficient per device, but scanning all devices requires a full table scan.

Why this answer

The row key design uses device_id as the prefix, which means all data for a given device is co-located in contiguous rows, making per-device scans efficient. However, a query for all devices over the last minute requires scanning every row in the table because the timestamp suffix is reversed and not a prefix; Bigtable cannot perform a range scan across all devices for a recent time window without a full table scan, which is extremely slow.

Exam trap

Google Cloud often tests the misconception that adding more nodes or tablets fixes scan performance, but the real issue is row key design that prevents Bigtable from using its sorted storage to limit the scan range.

How to eliminate wrong answers

Option A is wrong because insufficient nodes would cause general performance degradation across all queries, not specifically slow down the all-devices query while keeping the per-device query fast. Option B is wrong because scanning multiple column families adds overhead only if the query retrieves data from many families, but the problem statement does not mention column families, and the slowness is tied to the row key design, not column family access. Option D is wrong because too many tablets can cause high overhead for any scan, but the per-device query would also be affected; the asymmetry between fast per-device and slow all-devices queries points directly to row key ordering, not tablet count.

211
MCQmedium

A company is migrating a large Oracle database to Cloud Spanner. The source database uses sequences for primary key generation. The database engineer needs to design the Cloud Spanner schema to avoid hotspotting. What primary key design should they recommend?

A.Keep the same sequence-based integer keys.
B.Use a composite primary key with a timestamp prefix.
C.Use a hash of the original key as a prefix to the primary key.
D.Use UUIDs as the primary key without modification.
AnswerC

A hash prefix distributes the write load evenly across splits, avoiding hotspots.

Why this answer

Using a hash of the original key as a prefix to the primary key distributes writes evenly across Cloud Spanner's splits, preventing hotspotting. Cloud Spanner uses a distributed, append-only storage model where sequential keys (like from Oracle sequences) cause all new writes to land on the same split, creating a hotspot. A hash prefix ensures that related rows are still co-located for efficient queries while spreading write load across multiple nodes.

Exam trap

Google Cloud often tests the misconception that UUIDs or timestamps inherently solve hotspotting, but the trap here is that only a hash prefix (or similar distribution mechanism) guarantees even write distribution across Cloud Spanner's splits.

How to eliminate wrong answers

Option A is wrong because keeping the same sequence-based integer keys will cause all new inserts to target the same tablet (split) in Cloud Spanner, leading to severe hotspotting and degraded write performance. Option B is wrong because using a timestamp prefix does not guarantee distribution; if timestamps are monotonically increasing (e.g., insertion time), writes will still concentrate on the latest split, causing hotspotting. Option D is wrong because UUIDs are random but not designed to avoid hotspotting in Cloud Spanner; without a hash prefix or similar distribution mechanism, UUIDs can still lead to uneven splits and performance issues, especially under high write loads.

212
MCQhard

A team uses Terraform with a GCS backend. After a failed apply, the state file is corrupted. How can they recover to the last known good state?

A.Use 'terraform force-unlock' to release the lock and then 'terraform apply' again
B.Run 'terraform state rm' to remove corrupted resources and re-import
C.Restore a previous version of the state file from GCS object versioning
D.Manually edit the state file in GCS using the JSON editor
AnswerC

If bucket versioning is enabled, you can restore a previous version of the state file to recover.

Why this answer

With versioning enabled on the GCS bucket, each state file version is preserved. You can restore a previous version by copying it over the current state file.

213
MCQmedium

A company uses Cloud Bigtable to store time-series data from IoT devices. Each device sends a reading every minute. The row key currently is: device_id + timestamp (e.g., 'device123#2024-01-01T00:00:00Z'). Write throughput is lower than expected. Which row key modification would MOST improve write distribution?

A.Add a hash prefix of the device_id (e.g., hash(device_id) + device_id + timestamp)
B.Reverse the timestamp: timestamp + device_id
C.Use only device_id as the row key
D.Remove the device_id and use only timestamp
AnswerA

Salting with a hash prefix spreads row keys across tablets, improving write distribution.

Why this answer

Adding a hash prefix (salting) to the row key distributes writes across multiple tablet servers. The current row key starts with device_id, which may cause hotspots if many writes target the same device. A hash prefix ensures uniform distribution.

214
MCQmedium

An SRE team wants to automate a repetitive manual task that involves moving files from Cloud Storage to BigQuery and then deleting the source files. Which GCP service is BEST suited for this toil reduction?

A.Cloud Build
B.Cloud Scheduler
C.Compute Engine
D.Cloud Functions
AnswerD

Cloud Functions can be triggered by Cloud Storage events (e.g., object finalize) to run code that moves data to BigQuery and deletes the source.

Why this answer

Cloud Functions is ideal for event-driven automation. It can trigger on Cloud Storage events, process data, and delete files.

215
MCQmedium

A team uses Cloud Deploy with a canary deployment strategy to GKE. They want to automatically promote the canary to full production if the error rate is below 1% for 10 minutes. What should they configure?

A.Use a Cloud Build step to check error rates
B.Use a manual approval gate
C.Set the deployment strategy to blue/green
D.Configure a canary deployment with a metric threshold in clouddeploy.yaml
AnswerD

Cloud Deploy can be configured to automatically promote based on metrics.

Why this answer

Cloud Deploy supports canary deployments with automated promotion based on metric thresholds defined in the `clouddeploy.yaml` configuration. By specifying a metric threshold (e.g., error rate < 1% for 10 minutes) under the `canaryDeployment` strategy, Cloud Deploy can automatically promote the canary to full production without manual intervention or external scripts.

Exam trap

The trap here is that candidates confuse Cloud Build's ability to run scripts with the need for a continuous metric evaluation, leading them to choose Option A, when in fact Cloud Deploy's native metric threshold configuration is the correct and simpler approach.

How to eliminate wrong answers

Option A is wrong because Cloud Build is a CI/CD execution service, not a monitoring or decision engine; checking error rates would require integrating with a monitoring service like Cloud Monitoring, and Cloud Build steps are not designed for continuous metric evaluation over a 10-minute window. Option B is wrong because a manual approval gate requires human intervention to promote, contradicting the requirement for automatic promotion based on a metric threshold. Option C is wrong because blue/green deployment is a different strategy that typically involves switching traffic between two environments, not a canary with phased rollout and metric-based promotion.

216
MCQmedium

Your Cloud Spanner instance has several tables with interleaved parent-child relationships. You notice that queries that join parent and child tables are slow. What is the best practice to optimize these joins?

A.Ensure the tables are defined as interleaved with the parent key as the first part of the child primary key
B.Create secondary indexes on the join columns
C.Use batch update operations to reduce round trips
D.Remove interleaving and use a separate JOIN statement
AnswerA

Interleaving enables efficient distributed joins without cross-node communication.

Why this answer

Cloud Spanner optimizes interleaved table joins by physically co-locating parent and child rows on the same split, based on the parent key as the prefix of the child's primary key. This eliminates the need for distributed cross-split joins, dramatically reducing latency. Queries that join on the interleaved key benefit from local data access, making them fast and efficient.

Exam trap

The trap here is that candidates often assume secondary indexes are the universal solution for join performance, but in Cloud Spanner, physical data co-location via interleaving is the critical optimization for parent-child joins, not indexing alone.

How to eliminate wrong answers

Option B is wrong because secondary indexes on join columns do not change the physical co-location of parent and child rows; they only provide an alternative access path, and queries may still require distributed joins across splits, which is the root cause of slowness. Option C is wrong because batch update operations reduce round trips for writes, not for read-heavy join queries; they do not address the physical data layout needed for efficient joins. Option D is wrong because removing interleaving would break the physical co-location guarantee, forcing Spanner to perform distributed cross-split joins, which would make queries even slower, not faster.

217
MCQmedium

A company uses BigQuery for BI reporting. They have a large table 'events' with nested and repeated fields (ARRAY<STRUCT>). Analysts often query unnested data, which is slow. What is the best practice to improve query performance without changing the source schema?

A.Create a view that unnests the data
B.Redesign the table to be flat
C.Use a subquery with UNNEST and cache the results
D.Create a materialized view that flattens the nested data
AnswerD

Materialized views are persisted and automatically refreshed, reducing query time.

Why this answer

A materialized view in BigQuery can precompute and store the results of an UNNEST operation on nested fields, significantly reducing query time for repeated flattening queries. Unlike a regular view, a materialized view persists the flattened data and is automatically refreshed, so analysts query pre-joined, pre-flattened results without altering the source schema. This directly addresses the performance issue while preserving the original nested structure for other use cases.

Exam trap

Google Cloud often tests the distinction between a view (which is just a saved query) and a materialized view (which physically stores results), leading candidates to mistakenly choose the view option as a quick fix without considering performance implications.

How to eliminate wrong answers

Option A is wrong because a view only stores the SQL query definition, not the results; each query against the view still executes the UNNEST operation at runtime, providing no performance improvement. Option B is wrong because it violates the requirement to not change the source schema, and redesigning the table to be flat would require altering the ingestion pipeline and breaking existing queries that rely on nested fields. Option C is wrong because subqueries with UNNEST and caching are not natively supported in BigQuery; caching applies only to the final query result, not intermediate subquery results, and manual caching via temporary tables is not a best practice for ongoing analyst queries.

218
MCQeasy

A bigquery job is running slower than expected. Checking the job information, you see that the slot usage is at 100% for the entire duration of the query. You are using on-demand pricing. What is the most effective way to improve query performance?

A.Create materialized views for common aggregations.
B.Purchase a slot reservation and assign the project to it.
C.Cluster the tables on frequently filtered columns.
D.Partition the tables by date.
AnswerB

Reservations provide dedicated slots, allowing queries to use more resources and run faster.

Why this answer

With on-demand pricing, your query is limited to the default per-project slot capacity (typically 2,000 slots in BigQuery). If slot usage is at 100% for the entire duration, the query is resource-constrained and cannot be sped up without additional slots. Purchasing a slot reservation and assigning the project to it provides dedicated slots, eliminating the contention and allowing the query to run faster.

Exam trap

Google Cloud often tests the misconception that performance issues are always solved by data organization techniques (partitioning/clustering) or precomputation (materialized views), when in fact the bottleneck is compute capacity (slots) under on-demand pricing.

How to eliminate wrong answers

Option A is wrong because materialized views reduce the amount of data scanned and recomputation for repeated aggregations, but they do not increase the available slot capacity; if the query is already hitting 100% slot usage, the bottleneck is compute resources, not data volume. Option C is wrong because clustering improves data pruning and scan efficiency for filtered queries, but it does not add more slots; the query will still be throttled by the fixed slot pool. Option D is wrong because partitioning reduces the amount of data read by date range filters, but like clustering, it does not address the root cause of slot exhaustion; the query will still run at the same slot limit.

219
Multi-Selectmedium

A company is designing a monitoring strategy for a microservices application on Google Kubernetes Engine. They need to capture traces, metrics, and logs using a vendor-neutral approach. Which TWO components should they consider? (Choose 2)

Select 2 answers
A.OpenTelemetry Collector as a DaemonSet
B.Cloud Logging agent
C.Stackdriver agents on each node
D.Cloud Trace automatic instrumentation
E.OpenTelemetry SDK for instrumentation
AnswersA, E

The OTel Collector can receive telemetry and export to backends like Cloud Monitoring.

220
MCQhard

A gaming company uses Cloud Spanner to store player profiles and game state. They need to run a one-time analytic query on historical data that would take minutes and cannot impact production performance. What is the best approach?

A.Create a read-only replica and query it
B.Use the gcloud spanner databases execute-sql command with --query-mode=read-only
C.Export the required data to BigQuery using Dataflow and run the query there
D.Run the query using a read-only transaction with strong reads
AnswerC

Moving data to BigQuery separates analytic workloads from production.

Why this answer

Exporting the data to BigQuery via Dataflow isolates the analytic workload from Cloud Spanner, ensuring zero impact on production performance. Cloud Spanner is designed for transactional workloads, not heavy analytic queries that take minutes, and BigQuery is purpose-built for such analytics. This approach also avoids consuming Spanner's CPU or memory resources, which could degrade real-time game state operations.

Exam trap

The PCDOE exam often tests the misconception that read-only replicas or transactions are fully isolated from production performance, but in Cloud Spanner they still share instance resources and can cause degradation under sustained analytic queries.

How to eliminate wrong answers

Option A is wrong because a read-only replica in Cloud Spanner still shares the same underlying instance resources (CPU, memory) and can experience performance degradation under heavy analytic queries, impacting production. Option B is wrong because the gcloud spanner databases execute-sql command with --query-mode=read-only still executes the query on the primary Spanner instance, consuming resources and potentially affecting production performance. Option D is wrong because a read-only transaction with strong reads still runs on the primary Spanner instance and can cause contention or resource exhaustion, especially for long-running queries.

221
MCQmedium

A company wants to implement granular cost tracking for their cloud resources. They need to attribute costs to specific teams and environments. Which approach should they use?

A.Use separate projects for each team and environment, and analyze costs per project.
B.Use separate billing accounts for each team.
C.Apply labels to resources, such as 'team:engineering' and 'environment:prod', and use billing export to BigQuery for cost analysis.
D.Enable cost attribution in Cloud Monitoring.
AnswerC

Labels enable cost breakdown by any dimension, and BigQuery export allows custom queries.

Why this answer

Labels are key-value pairs that can be applied to resources. By using labels like 'team' and 'environment', costs can be broken down in billing reports and BigQuery exports.

222
MCQmedium

A service expects to receive 10,000 requests per second. The team needs to monitor request latency with an SLI that measures the proportion of requests that complete in under 100 ms. The latency distribution is right-skewed. Which approach should be used to define the SLI in Cloud Monitoring?

A.Use the 99th percentile latency as the SLI
B.Use the median latency as the SLI
C.Use a window-based SLI that counts good minutes
D.Use a histogram metric and create a request-based SLI with good request count filtered by latency < 100 ms
AnswerD

This is the correct way: using a histogram or a pre-computed good request count.

Why this answer

For a latency SLI, the standard approach is to use a request-based SLI with a metric that counts the number of requests that are under the threshold (good) over total requests. This requires instrumenting the application to emit a metric for 'good' requests (latency < 100 ms). Alternatively, you can use a histogram metric and compute the ratio.

The simplest is to use a custom metric for good request count.

223
Multi-Selectmedium

A company is migrating its on-premises PostgreSQL database to Cloud SQL for PostgreSQL. They want to minimize downtime during the migration. Which TWO actions should they take?

Select 2 answers
A.Increase the disk size of the Cloud SQL instance before migration to improve performance.
B.Use pg_dump to export the database and pg_restore to import into Cloud SQL.
C.Set up a Cloud SQL read replica and promote it to the primary after migration.
D.Decrease max_connections to reduce load during migration.
E.Use Database Migration Service (DMS) with continuous replication from the source.
AnswersC, E

Using a read replica allows the source to remain online during replication, and promoting the replica minimizes cutover downtime.

Why this answer

Setting up a Cloud SQL read replica from the source PostgreSQL database and then promoting it to primary allows for a controlled cutover with minimal downtime. The replica stays in sync with the source using PostgreSQL's native streaming replication, and promotion is a fast metadata operation that typically takes seconds, not minutes or hours.

Exam trap

Google Cloud often tests the distinction between logical backup tools (pg_dump/pg_restore) which cause downtime, and continuous replication methods (DMS or read replicas) which minimize it, leading candidates to incorrectly choose the familiar dump-and-restore approach.

224
MCQmedium

A DevOps engineer is setting up Docker credential helper for Artifact Registry on a Cloud Build worker. They want the build steps to authenticate to Artifact Registry without storing service account keys. What is the recommended approach?

A.Use a custom builder that includes Docker with Artifact Registry credentials.
B.Store a service account key in Cloud Secret Manager and load it in a build step.
C.Set environment variable ARTIFACT_REGISTRY_KEY in cloudbuild.yaml.
D.Run gcloud auth configure-docker as a build step; Cloud Build's service account will be used automatically.
AnswerD

This command configures Docker to use gcloud as a credential helper, which uses the environment's service account.

Why this answer

`gcloud auth configure-docker` configures Docker to use `gcloud` as a credential helper, which automatically uses the Cloud Build worker's attached service account to obtain short-lived access tokens for Artifact Registry. This avoids storing any long-lived service account keys, aligning with Google Cloud's security best practices for CI/CD pipelines.

Exam trap

The trap here is that candidates may think a custom builder or secret injection is necessary for authentication, when in fact Cloud Build's default service account can be used directly with `gcloud auth configure-docker` to avoid storing any keys.

How to eliminate wrong answers

Option A is wrong because a custom builder does not inherently solve authentication; it would still need credentials to be injected or configured, and it adds unnecessary complexity without leveraging Cloud Build's built-in identity. Option B is wrong because storing a service account key in Secret Manager and loading it in a build step introduces a long-lived secret that must be managed and rotated, violating the principle of avoiding static keys in CI/CD. Option C is wrong because there is no standard `ARTIFACT_REGISTRY_KEY` environment variable in Cloud Build or Artifact Registry; authentication requires OAuth2 tokens or JSON key files, not a single environment variable.

225
MCQmedium

A data analytics company uses Bigtable for high-throughput writes. They notice that some rows are receiving a disproportionate number of reads and writes, causing performance degradation. Which tool should they use to identify and resolve this hot spotting issue?

A.cbt tool
B.Cloud Logging
C.Key Visualiser
D.Cloud Monitoring
AnswerC

Key Visualiser is the correct tool to identify hot spotting by visualising row key access patterns.

Why this answer

Key Visualizer is the correct tool because it is specifically designed to analyze Bigtable access patterns and visualize hot spotting—where a small number of rows or row ranges receive a disproportionate share of reads and writes. It provides heatmaps and time-series graphs that pinpoint the exact keys causing performance degradation, enabling you to redesign your row keys or implement salting to distribute load evenly.

Exam trap

The trap here is that candidates confuse Cloud Monitoring (general metrics) with Key Visualizer (specialized Bigtable access pattern analysis), assuming any monitoring tool can diagnose hot spots, but only Key Visualizer provides the key-level heatmap required for this specific Bigtable issue.

How to eliminate wrong answers

Option A is wrong because the cbt tool is a command-line interface for interacting with Bigtable (e.g., creating tables, reading/writing data), but it does not provide any built-in analysis or visualization of access patterns to identify hot spots. Option B is wrong because Cloud Logging captures operational logs (e.g., errors, requests) but does not offer the specialized heatmap or key-level analysis needed to detect and resolve hot spotting in Bigtable. Option D is wrong because Cloud Monitoring provides metrics and alerts for overall system health (e.g., CPU, latency), but it lacks the granular, key-range-specific visualization that Key Visualizer offers for diagnosing hot spots.

Page 2

Page 3 of 20

Page 4