GPDE
Free GPDE practice questions
10 questions from our GPDE 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.
Question 1 of 10, Designing data processing systems
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?
- ARemove all IAM bindings on the tenant's dataset when the contract ends and record the change for auditors
- BEncrypt each tenant's dataset with its own Cloud KMS key, then disable and destroy that key's versions when the tenant leaves Correct answer
- CRun a Sensitive Data Protection de-identification job over the tenant's tables before deleting the dataset
- DDelete the tenant's dataset when the contract ends and set the dataset time travel window to its minimum allowed length
Answer and 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, Designing data processing systems
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?
- AAn organization policy using the resource locations constraint so that every BigQuery dataset and bucket can only be created in approved regions
- BCustomer-managed encryption keys in Cloud KMS for every dataset and bucket, with key access limited to the healthcare team's groups
- CA VPC Service Controls service perimeter around the three projects that restricts the BigQuery and Cloud Storage APIs for all callers Correct answer
- DReplacing BigQuery Data Owner grants with BigQuery Data Viewer so that analysts can read tables but never modify or delete them
Answer and 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, Ingesting and processing the data
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?
- AEnable exactly-once delivery on the Pub/Sub subscription that the Dataflow pipeline reads from so that redelivered messages are suppressed
- BSet the purchase_id as the insertId when streaming rows to BigQuery and rely on the streaming buffer to remove duplicate rows permanently
- CAdd purchase_id as a message attribute, configure PubsubIO to use it as the ID attribute, and deduplicate downstream by that key Correct answer
- DPublish the events with an ordering key equal to purchase_id so that Pub/Sub delivers duplicates in sequence and drops the second copy
Answer and 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, Ingesting and processing the data
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?
- ADatabase Migration Service with a continuous migration job that replicates the PostgreSQL database into a BigQuery dataset
- BA Cloud Data Fusion batch pipeline scheduled every ten minutes that reads changed rows by an updated_at column
- CBigQuery scheduled queries that call EXTERNAL_QUERY against Cloud SQL every five minutes and merge the result into the target table
- DDatastream with a PostgreSQL source that reads changes through logical replication, and BigQuery as the destination Correct answer
Answer and 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, Ingesting and processing the data. 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.)
- ASalt the skewed join key by appending a random suffix and expanding the matching rows on the other side Correct answer
- BLower spark.sql.shuffle.partitions to a small value so that fewer tasks are scheduled for the join
- CIncrease the driver memory so that the driver can coordinate the long-running tasks more efficiently
- DEnable adaptive query execution with skew join handling so that Spark splits oversized partitions at runtime Correct answer
- ESwitch the cluster's primary worker disks from SSD persistent disks to standard persistent disks
Answer and 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, Storing the data
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?
- AStore objects in Nearline from the start and grant only the Storage Object Viewer role to everyone except a break-glass account
- BUse lifecycle rules to move objects to Coldline and then Archive storage, and enable soft delete with the maximum retention duration
- CUse lifecycle rules to move objects to colder storage classes, and set a seven-year bucket retention policy that you then lock Correct answer
- DEnable Autoclass on the bucket so objects move to colder classes automatically, and enable object versioning to keep deleted copies
Answer and 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, Storing the data
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?
- AAn app profile with multi-cluster routing so that the application is routed to the nearest available cluster
- BA third cluster in another region so that writes are acknowledged by a majority of the replicas
- CAn app profile with single-cluster routing that sends that application's reads and writes to one cluster Correct answer
- DSingle-row transactions enabled on a multi-cluster routing app profile shared by all applications
Answer and 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, Preparing and using data for analysis
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?
- AHashed email lists exported to a shared Cloud Storage bucket, which each company joins on its own side
- BAuthorized views on each company's tables, shared with the other company's analysts through IAM grants
- CSensitive Data Protection de-identification of both datasets, followed by copying them into one jointly owned project
- DA BigQuery data clean room in which shared data is protected by analysis rules such as aggregation thresholds Correct answer
Answer and 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, Maintaining and automating data workloads
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?
- ASwitch the jobs from interactive to batch priority so that BigQuery runs each UPDATE when slots become free
- BCombine the changes into a staging table and apply them with fewer MERGE statements, retrying with backoff Correct answer
- CMove the table to a separate dataset with its own reservation so that each UPDATE runs with dedicated slots
- DShard the table into one copy per job so that every job updates its own table without any conflicts
Answer and 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, Maintaining and automating data workloads
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?
- ACancel the existing job and start the new version with a new subscription on the topic
- BRun the update with the compatibility check disabled to force the job to restart
- CRetry the update with a transform name mapping that renames the stateful step
- DDrain the existing job and then start the new version reading from the same subscription Correct answer
Answer and 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.