GCDE

Free GCDE practice questions

10 questions from our GCDE practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.

Back to the GCDE practice exams

Question 1 of 10, Design Innovative, Scalable, and Highly Available Cloud Database Solutions

A payments API must keep running if a single zone fails, with an RPO of zero and an RTO of a few minutes. The workload is MySQL, fits on one machine, and serves customers from one region only. Budget matters, so the team wants the simplest configuration that meets these targets. What should the database engineer provision?

  1. AA Spanner multi-region instance so that writes are committed across regions before being acknowledged to the payments API
  2. BA Cloud SQL for MySQL instance with high availability (regional) enabled, which keeps a synchronous standby in another zone Correct answer
  3. CA zonal Cloud SQL instance with automated backups and point-in-time recovery enabled so it can be restored into another zone
  4. DA zonal Cloud SQL for MySQL instance with a read replica in a second zone that is promoted manually when the zone fails

Answer and explanation: A regional (HA) Cloud SQL instance replicates synchronously to a standby in another zone and fails over automatically, giving zero data loss and an RTO of minutes. A read replica is replicated asynchronously, so promoting it can lose recent transactions and needs manual action. A Spanner multi-region instance exceeds the requirement and cost for a single-region MySQL workload. Restoring from backup with PITR takes far longer than a few minutes and is a recovery, not an availability, mechanism.

Question 2 of 10, Design Innovative, Scalable, and Highly Available Cloud Database Solutions

A support team already stores ticket text in AlloyDB for PostgreSQL. They want to build retrieval-augmented generation by creating embeddings inside SQL statements and running approximate nearest-neighbor searches over 50 million vectors with low latency, without adding a separate vector database. What should the database engineer implement?

  1. AExport the tickets to BigQuery nightly, generate embeddings with ML.GENERATE_EMBEDDING, and use VECTOR_SEARCH from the application
  2. BUse the google_ml_integration embedding() function to call a Vertex AI model and create a ScaNN index on the vector column Correct answer
  3. CStore embeddings in a pgvector column without any index, relying on the AlloyDB columnar engine to speed up exact searches
  4. DGenerate embeddings in a Cloud Run service, store them in Memorystore, and run brute-force similarity in the application

Answer and explanation: AlloyDB AI lets SQL call Vertex AI embedding models through google_ml_integration and offers the ScaNN index for fast approximate nearest-neighbor search at large scale, all inside the existing database. Moving data to BigQuery adds a pipeline and nightly staleness. A cache with brute-force similarity in the application does not scale to 50 million vectors. Without a vector index every query is an exact scan, and the columnar engine does not accelerate vector distance search.

Question 3 of 10, Design Innovative, Scalable, and Highly Available Cloud Database Solutions

An industrial IoT platform ingests about 500,000 sensor readings per second, stores 30 TB of history, and serves queries that fetch the readings of one device over a time range. No multi-row transactions or joins are needed. Which database is the BEST fit?

  1. ACloud SQL for PostgreSQL with a table partitioned by day
  2. BSpanner with an interleaved Readings table under a Devices table and secondary indexes on time
  3. CFirestore in Native mode with one document per reading and a composite index on device and time
  4. DBigtable with a row key that combines the device ID and a timestamp Correct answer

Answer and explanation: Bigtable handles very high write throughput and petabyte-scale time series, and a device-plus-timestamp row key turns per-device range queries into efficient scans. Spanner could store the data but its relational and transactional features add cost the workload does not need. A single Cloud SQL instance cannot sustain this ingest rate or comfortably hold 30 TB. Firestore per-document writes at this rate are costly and not designed for dense time-series scans.

Question 4 of 10, Manage a Solution That Can Span Multiple Database Technologies. Choose 2.

A Spanner application shows many ABORTED errors in read-write transactions during peaks. Each transaction reads several rows, calls an external pricing API, and then writes. What should the database engineer recommend? (Choose two.)

  1. ARemove primary keys so locks are taken at the table level
  2. BUse the client library's transaction runner, which retries aborted work Correct answer
  3. CSwitch the transactions to read-only with a strong timestamp
  4. DCall the external API before starting the transaction to keep it short Correct answer
  5. EUse partitioned DML for every write within the checkout flow

Answer and explanation: Holding locks while waiting on an external call increases conflicts, so moving the call outside the transaction shortens it, and Spanner client libraries retry aborted transactions automatically. Partitioned DML is for bulk, idempotent changes and is not transactional across rows. Read-only transactions cannot write. Spanner tables require primary keys, and coarser locks would worsen contention.

Question 5 of 10, Manage a Solution That Can Span Multiple Database Technologies

An automation script that creates and patches Cloud SQL instances across many projects starts failing with RESOURCE_EXHAUSTED errors from the Cloud SQL Admin API during large rollouts. What should the database engineer do?

  1. AIncrease the machine type of each instance so the API can process more operations in parallel
  2. BRun the rollout from several service accounts at once so each account gets its own project quota
  3. CSwitch the script to use the Cloud SQL Auth Proxy, which does not consume Admin API quota
  4. DCheck Admin API quota usage, retry with exponential backoff, and request more quota if needed Correct answer

Answer and explanation: RESOURCE_EXHAUSTED indicates an API rate quota, which is handled by checking quota usage, retrying with backoff, and requesting more quota when justified. Instance size does not affect API quotas. The Auth Proxy is for data connections and cannot create or patch instances. Admin API quotas are per project, so splitting calls across service accounts in the same project does not raise the limit.

Question 6 of 10, Manage a Solution That Can Span Multiple Database Technologies

A compliance team requires that every SELECT on a table containing card data in Cloud SQL for PostgreSQL is logged with the database user and query text, and that logs are retained centrally. Which approach should the database engineer use?

  1. ATurn on the log_statement flag with value all and rely on the default _Default log bucket retention for compliance
  2. BEnable Query Insights with query plans sampled at the maximum rate so that every SELECT is captured with its text
  3. CEnable Admin Activity audit logs for Cloud SQL, which record every query that users run inside the database instance
  4. DEnable pgaudit through the cloudsql.enable_pgaudit flag and route its audit log entries to a dedicated log bucket Correct answer

Answer and explanation: pgAudit on Cloud SQL produces database-level audit entries, including statement text and user, which flow into Cloud Audit Logs and can be routed to a dedicated bucket with the needed retention. Admin Activity logs cover API operations such as creating instances, not SQL statements. log_statement=all logs every statement for the whole instance, is noisy, and the default bucket retention is short. Query Insights samples and aggregates queries, so it does not guarantee every statement is recorded.

Question 7 of 10, Migrate Data Solutions

An enterprise is migrating an Oracle database to AlloyDB for PostgreSQL. The schema contains hundreds of PL/SQL packages, and the team needs to convert DDL and code, review conversion issues, and then replicate data continuously until cutover. Which approach meets these needs with the LEAST custom tooling?

  1. ADatabase Migration Service with a conversion workspace for schema and code conversion, then a continuous heterogeneous migration job into AlloyDB Correct answer
  2. BSpanner migration tool to convert the Oracle schema, followed by a Spanner-to-AlloyDB export using Dataflow once the conversion is done
  3. CDatastream from Oracle to Cloud Storage with a Dataflow template that loads the files and creates PostgreSQL tables from Avro schemas
  4. DOracle Data Pump export to Cloud Storage and pg_restore into AlloyDB after the team manually rewrites the PL/SQL packages

Answer and explanation: Database Migration Service supports Oracle to AlloyDB and Cloud SQL for PostgreSQL migrations, with conversion workspaces (including Gemini-assisted code conversion) for schema and PL/SQL and continuous CDC replication until promotion. Datastream with Dataflow moves data but converts no code and requires assembling the pipeline. The Spanner migration tool targets Spanner, not AlloyDB. Data Pump files cannot be restored with pg_restore, and manual rewriting is exactly the custom effort to avoid.

Question 8 of 10, Migrate Data Solutions

A company wants to move a 2 TB on-premises MySQL 8.0 database to Cloud SQL for MySQL with only a few minutes of downtime. The source can reach Google Cloud through Cloud VPN. Which approach should the database engineer use?

  1. ATransfer Appliance shipping of the raw data files, followed by attaching them to the Cloud SQL instance as external storage
  2. Bmysqldump to Cloud Storage and import during a weekend outage
  3. CA Database Migration Service continuous job, promoting the destination when replication lag nears zero Correct answer
  4. DDatastream streaming the binlog into BigQuery, then a scheduled query that loads the data into the Cloud SQL instance

Answer and explanation: Database Migration Service performs an initial load and continuous binlog-based replication into Cloud SQL, so cutover only requires stopping writes and promoting, which takes minutes. A dump and import means downtime for the full export and import of 2 TB. Datastream to BigQuery targets analytics and has no supported path to write back into Cloud SQL as a migration. Cloud SQL does not attach external data files, and Transfer Appliance does not keep the data in sync.

Question 9 of 10, Deploy Scalable and Highly Available Databases in Google Cloud. Choose 2.

A team wants to test its Spanner disaster recovery plan for logical corruption, such as a bad deployment that rewrites many rows. Which exercises are appropriate? (Choose two.)

  1. AStop one replica region manually to check zero data loss behavior
  2. BRestore a recent backup into a new database and time the restore Correct answer
  3. CChange the default leader region and confirm that writes keep working
  4. DRead data at a timestamp before a simulated bad change with PITR Correct answer
  5. EDisable the change streams and confirm that writes are blocked

Answer and explanation: Corruption is replicated to every replica, so recovery relies on backups and point-in-time recovery; practicing restores and stale reads validates both procedures and timings. Moving the default leader tests write placement, not recovery from bad data. Customers cannot stop a replica region, and region failures would not undo corruption anyway. Change streams are unrelated to recovery and do not block writes.

Question 10 of 10, Deploy Scalable and Highly Available Databases in Google Cloud

A Firestore database supports a consumer app worldwide and must survive the loss of an entire region without data loss. The database has not been created yet. Which choice satisfies this requirement?

  1. ACreate a regional database and replicate with Firestore change listeners
  2. BCreate a regional database and schedule daily backups to another region
  3. CCreate the database in a multi-region location such as nam5 or eur3 Correct answer
  4. DCreate a regional database with PITR

Answer and explanation: A multi-region Firestore location synchronously replicates across regions, so a regional outage causes no data loss, and the location must be chosen at creation. Point-in-time recovery protects against logical errors but stays within the single region. Daily backups permit up to a day of data loss. Change listeners are a client feature, and building replication with them is unreliable and unsupported for DR.