# Free GPDE practice questions

> 10 free GPDE practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/google-professional-data-engineer/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/google-professional-data-engineer/

### Question 1 of 10

A SaaS provider stores each tenant's data in its own BigQuery dataset. Contracts require that when a tenant leaves, all of its data becomes permanently unreadable immediately, including any copies in time travel or fail-safe storage. Which design supports this?

- A. Remove all IAM bindings on the tenant's dataset when the contract ends and record the change for auditors
- B. Encrypt each tenant's dataset with its own Cloud KMS key, then disable and destroy that key's versions when the tenant leaves
- C. Run a Sensitive Data Protection de-identification job over the tenant's tables before deleting the dataset
- D. Delete the tenant's dataset when the contract ends and set the dataset time travel window to its minimum allowed length

**Answer:** B

**Explanation:** Using a dedicated CMEK key per tenant enables crypto-shredding: disabling the key versions makes the tenant's data unreadable right away, and destroying them makes every copy, including time travel and fail-safe copies, permanently unreadable. Deleting the dataset still leaves data recoverable for the time travel and fail-safe periods. Removing IAM bindings leaves data readable by anyone who regains access. De-identification transforms only selected values and does not reach existing recovery copies.

### Question 2 of 10

A healthcare provider stores patient records in BigQuery datasets and Cloud Storage buckets inside three projects. Auditors require that even a user holding valid IAM permissions cannot copy this data into a project that belongs to another organization, for example by running a query whose destination table sits elsewhere. What should the data engineer implement?

- A. An organization policy using the resource locations constraint so that every BigQuery dataset and bucket can only be created in approved regions
- B. Customer-managed encryption keys in Cloud KMS for every dataset and bucket, with key access limited to the healthcare team's groups
- C. A VPC Service Controls service perimeter around the three projects that restricts the BigQuery and Cloud Storage APIs for all callers
- D. Replacing BigQuery Data Owner grants with BigQuery Data Viewer so that analysts can read tables but never modify or delete them

**Answer:** C

**Explanation:** A VPC Service Controls perimeter blocks API calls that move data from protected projects to resources outside the perimeter, which is exactly the exfiltration path described, even for users with valid IAM roles. The resource locations constraint only controls where new resources may be created. CMEK protects data at rest but an authorized user can still read it and write the results elsewhere. Data Viewer users can still query tables and save results to a destination table in another project.

### Question 3 of 10

Mobile clients publish purchase events to Pub/Sub and retry when they time out, so the same purchase is sometimes published twice with different Pub/Sub message IDs. Each event carries a unique purchase_id. A Dataflow pipeline written with the Apache Beam Java SDK writes the events to BigQuery, and finance requires each purchase to appear once. What should the data engineer do?

- A. Enable exactly-once delivery on the Pub/Sub subscription that the Dataflow pipeline reads from so that redelivered messages are suppressed
- B. Set the purchase_id as the insertId when streaming rows to BigQuery and rely on the streaming buffer to remove duplicate rows permanently
- C. Add purchase_id as a message attribute, configure PubsubIO to use it as the ID attribute, and deduplicate downstream by that key
- D. Publish the events with an ordering key equal to purchase_id so that Pub/Sub delivers duplicates in sequence and drops the second copy

**Answer:** C

**Explanation:** Publisher retries create new message IDs, so the deduplication must use a business key; configuring PubsubIO with an ID attribute lets Dataflow drop repeats of the same purchase_id, and a keyed deduplication step covers repeats outside that window. Exactly-once delivery only prevents redelivery of the same message ID. Ordering keys order messages but do not remove duplicates. BigQuery insertId deduplication is best effort over a short period and is not a guarantee.

### Question 4 of 10

An e-commerce team wants inserts, updates and deletes from its Cloud SQL for PostgreSQL order database to appear in BigQuery within a few minutes. The solution must place minimal load on the source and require no custom code or cluster management. What should the data engineer use?

- A. Database Migration Service with a continuous migration job that replicates the PostgreSQL database into a BigQuery dataset
- B. A Cloud Data Fusion batch pipeline scheduled every ten minutes that reads changed rows by an updated_at column
- C. BigQuery scheduled queries that call EXTERNAL_QUERY against Cloud SQL every five minutes and merge the result into the target table
- D. Datastream with a PostgreSQL source that reads changes through logical replication, and BigQuery as the destination

**Answer:** D

**Explanation:** Datastream reads the PostgreSQL write-ahead log through logical replication and applies inserts, updates and deletes directly to BigQuery with low latency and no infrastructure to manage. Repeated federated queries put load on the source and cannot detect deletes. Database Migration Service migrates into database targets such as Cloud SQL or AlloyDB, not BigQuery. An updated_at batch pipeline misses deletes and adds latency.

### Question 5 of 10 (choose 2)

A Spark SQL job on Dataproc joins a 3 TB fact table with a customer table. A few customer IDs account for a large share of the rows, and the Spark UI shows a handful of tasks running far longer than the others in the join stage. Which two actions directly address this problem? (Choose two.)

- A. Salt the skewed join key by appending a random suffix and expanding the matching rows on the other side
- B. Lower spark.sql.shuffle.partitions to a small value so that fewer tasks are scheduled for the join
- C. Increase the driver memory so that the driver can coordinate the long-running tasks more efficiently
- D. Enable adaptive query execution with skew join handling so that Spark splits oversized partitions at runtime
- E. Switch the cluster's primary worker disks from SSD persistent disks to standard persistent disks

**Answer:** A, D

**Explanation:** Adaptive query execution can detect skewed partitions during a join and split them, and salting the hot keys spreads their rows across many tasks; both target the uneven partition sizes causing the stragglers. Driver memory does not affect executor task skew. Slower disks would only make shuffle worse. Fewer shuffle partitions make each partition larger and worsen the imbalance.

### Question 6 of 10

Application logs in Cloud Storage are read often in the first 30 days, rarely afterwards, and must be retained for seven years. Regulators require that no one, including project owners, can delete or overwrite a log before the seven years end. Which configuration meets these requirements at the lowest cost?

- A. Store objects in Nearline from the start and grant only the Storage Object Viewer role to everyone except a break-glass account
- B. Use lifecycle rules to move objects to Coldline and then Archive storage, and enable soft delete with the maximum retention duration
- C. Use lifecycle rules to move objects to colder storage classes, and set a seven-year bucket retention policy that you then lock
- D. Enable Autoclass on the bucket so objects move to colder classes automatically, and enable object versioning to keep deleted copies

**Answer:** C

**Explanation:** Lifecycle transitions lower storage cost as access declines, and a locked retention policy (Bucket Lock) prevents anyone from deleting or replacing objects before the period ends. Autoclass handles cost but versioning does not stop deletion by an owner. Soft delete only allows recovery for a limited window and is not an immutable retention control. IAM restrictions can be changed by project owners, so they do not satisfy the regulator.

### Question 7 of 10

A Bigtable instance has clusters in two regions for availability. One application writes a user's preferences and immediately reads them back, and it must always see its own write. Other applications only need high availability. How should the data engineer configure access for the first application?

- A. An app profile with multi-cluster routing so that the application is routed to the nearest available cluster
- B. A third cluster in another region so that writes are acknowledged by a majority of the replicas
- C. An app profile with single-cluster routing that sends that application's reads and writes to one cluster
- D. Single-row transactions enabled on a multi-cluster routing app profile shared by all applications

**Answer:** C

**Explanation:** Replication between Bigtable clusters is eventually consistent, so read-your-writes requires single-cluster routing for that application while others can use multi-cluster routing. Multi-cluster routing may read from a cluster that has not yet received the write. Bigtable does not use majority acknowledgement across clusters. Single-row transactions require single-cluster routing and cannot be enabled on a multi-cluster profile.

### Question 8 of 10

A retailer and a consumer goods brand want to measure how many of their customers overlap and analyze joint purchase patterns. Neither company may see the other's row-level customer data, and only aggregated results may be returned. What should the data engineer recommend?

- A. Hashed email lists exported to a shared Cloud Storage bucket, which each company joins on its own side
- B. Authorized views on each company's tables, shared with the other company's analysts through IAM grants
- C. Sensitive Data Protection de-identification of both datasets, followed by copying them into one jointly owned project
- D. A BigQuery data clean room in which shared data is protected by analysis rules such as aggregation thresholds

**Answer:** D

**Explanation:** Data clean rooms let parties contribute data and enforce analysis rules, such as aggregation thresholds, so queries return only aggregated results and no party sees the other's rows. Authorized views still expose row-level data to the other company. De-identification plus copying moves data and still exposes rows. Exchanging hashed lists reveals row-level identifiers and gives no enforcement of aggregation.

### Question 9 of 10

Many small jobs run UPDATE statements against the same BigQuery table concurrently. Several of them are queued for long periods or fail with concurrent-update errors. What should the data engineer do to make the workload reliable?

- A. Switch the jobs from interactive to batch priority so that BigQuery runs each UPDATE when slots become free
- B. Combine the changes into a staging table and apply them with fewer MERGE statements, retrying with backoff
- C. Move the table to a separate dataset with its own reservation so that each UPDATE runs with dedicated slots
- D. Shard the table into one copy per job so that every job updates its own table without any conflicts

**Answer:** B

**Explanation:** BigQuery limits concurrent mutating DML on a table, so consolidating changes into a staging table and applying them with fewer MERGE statements, plus retry with exponential backoff, avoids queueing and conflicts. Dedicated slots do not change per-table DML concurrency limits. Batch priority affects scheduling but not conflicts on the same table. Sharding the table fragments the data and complicates every query.

### Question 10 of 10

An update to a Dataflow streaming job changes the coder of a stateful step, and the in-place update fails the compatibility check. Losing open window state is acceptable, but no messages may be lost. What should the data engineer do?

- A. Cancel the existing job and start the new version with a new subscription on the topic
- B. Run the update with the compatibility check disabled to force the job to restart
- C. Retry the update with a transform name mapping that renames the stateful step
- D. Drain the existing job and then start the new version reading from the same subscription

**Answer:** D

**Explanation:** Draining stops reading new input, finishes in-flight work and acknowledges processed messages, so the new job continues from the same subscription without losing messages. Cancelling and using a new subscription loses messages that were published before it existed and not yet processed. A name mapping does not fix a coder incompatibility. Dataflow does not offer a way to bypass the compatibility check.

Ready for a timed run? Take the free 15-question GPDE mini exam: https://devopscodelab.com/app/exams/google-professional-data-engineer/mini/

DevOpsCode Lab is not affiliated with Google Cloud. GPDE and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
