GPCSE

Free GPCSE practice questions

10 questions from our GPCSE 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 GPCSE practice exams

Question 1 of 10, Configuring access

Your organization wants to stop developers from creating user-managed service account keys in every project, while still allowing a single legacy project to keep using keys until it is migrated. What is the MOST manageable approach?

  1. ACreate an IAM deny policy at the organization node that denies iam.serviceAccountKeys.create for all principals in every project
  2. BEnable the iam.serviceAccountKeyExpiryHours constraint at the organization node so that every newly created key expires after one hour
  3. CEnforce iam.disableServiceAccountKeyCreation at the organization node and set the legacy project's policy to not enforced Correct answer
  4. DRemove the Service Account Key Admin role from all developers at the organization node and grant it back at the legacy project only

Answer and explanation: The boolean organization policy constraint blocks key creation everywhere, and organization policies can be overridden at a lower node, so one exception project is easy to manage. Removing a role misses Owners and Editors and custom roles that also hold the permission. A blanket deny policy at the organization would also block the legacy project unless you add exception logic, making it harder to manage than a policy override. The expiry constraint limits key lifetime but still allows keys to be created.

Question 2 of 10, Configuring access

A contractor's on-call script needs to act as a deployment service account for a few minutes at a time. Security wants no long-lived credentials and wants every use to appear in audit logs with the contractor's own identity. Which approach meets these requirements?

  1. ACreate a key for the service account with the iam.serviceAccountKeyExpiryHours constraint set to one hour
  2. BGrant the contractor the same roles as the service account directly at the project level for the duration of the contract
  3. CGrant the contractor Service Account User on the project so that the script can attach the service account to new VMs
  4. DGrant the contractor Service Account Token Creator on that service account and use gcloud --impersonate-service-account Correct answer

Answer and explanation: Impersonation through Token Creator issues short-lived tokens, and audit logs record both the service account and the impersonating user. Service Account User lets a principal attach the account to resources, which is broader and does not directly give the script short-lived tokens. Even with expiry, a key is a downloadable long-lived secret until it expires. Granting the roles directly removes the separation of the deployment identity and gives broader standing access.

Question 3 of 10, Configuring access

Your company wants to prevent anyone from granting IAM roles in its organization to accounts from consumer Gmail or from other companies' Google Workspace domains. What should you configure?

  1. AThe iam.workloadIdentityPoolProviders constraint restricted to the company's own identity provider URIs
  2. BAn IAM deny policy that denies all permissions to principals whose email domain is gmail.com
  3. CThe iam.allowedPolicyMemberDomains constraint listing the company's Cloud Identity customer ID Correct answer
  4. DA VPC Service Controls access level that only admits devices enrolled in the company's endpoint management

Answer and explanation: Domain restricted sharing uses iam.allowedPolicyMemberDomains to allow policy bindings only for principals from listed customer IDs, which blocks Gmail and other organizations. A deny policy keyed on gmail.com does not cover other companies' Workspace domains and does not stop the bindings being created. Access levels govern request context, not who can be added to IAM policies. The workload identity provider constraint restricts federation providers, not IAM members.

Question 4 of 10, Securing communications and establishing boundary protection

A producer team exposes an internal API on an internal load balancer, and dozens of consumer VPCs in other projects must reach it privately. Consumer address ranges overlap with the producer's, and consumers must not gain access to other producer resources. What should you use?

  1. AHA VPN tunnels from each consumer VPC to the producer VPC with BGP sessions advertising only the API subnet
  2. BVPC Network Peering between the producer VPC and each consumer VPC, with custom route export disabled
  3. CPublish the service with a Private Service Connect service attachment and create endpoints in each consumer VPC Correct answer
  4. DShared VPC with the producer project as the host project and each consumer project attached to it as a service project

Answer and explanation: Private Service Connect exposes only the published service through endpoints in consumer VPCs, uses NAT so overlapping ranges are fine, and grants no wider network access. Peering cannot be established between VPCs with overlapping subnet ranges and is limited in the number of peers. Shared VPC merges network administration and gives consumers the same network as the producer. Per-consumer VPN tunnels add significant overhead and still require non-overlapping routes.

Question 5 of 10, Securing communications and establishing boundary protection

A Cloud SQL for PostgreSQL instance must not be reachable from the internet. Applications in a VPC should connect privately, and connections must be authorized with IAM and encrypted without managing client certificates. Which configuration fits BEST?

  1. APublic IP with no authorized networks and the instance placed inside a VPC Service Controls perimeter
  2. BPrivate IP through private services access, with self-managed client certificates distributed to each application
  3. CPrivate IP through private services access, with clients using the Cloud SQL Auth Proxy and IAM database authentication Correct answer
  4. DPublic IP with authorized networks restricted to the VPC's Cloud NAT IP addresses and the SSL mode set to require trusted client certificates

Answer and explanation: Private IP removes internet exposure, and the Auth Proxy encrypts connections and authorizes them with IAM, with IAM database authentication avoiding static passwords. A public IP keeps the instance internet-facing even with authorized networks. Self-managed client certificates meet encryption but add the certificate management the requirement wants to avoid. A perimeter protects the Cloud SQL Admin API, not the database's public IP connection path.

Question 6 of 10, Ensuring data protection

A team wants every new Cloud Storage bucket, BigQuery dataset and Compute Engine disk in a folder to receive a customer-managed encryption key automatically, without developers creating key rings or keys themselves. What should you enable?

  1. AThe gcp.restrictNonCmekServices organization policy on the folder so that resources without CMEK are rejected
  2. BCloud KMS Autokey on the folder, with a dedicated key project that holds the automatically created keys Correct answer
  3. CA Cloud Build trigger that creates a key ring and key whenever an Admin Activity log shows a new resource
  4. DDefault Google encryption combined with the Cloud HSM protection level selected for each project in the folder

Answer and explanation: Autokey provisions keys on demand at resource creation time in a designated key project, removing manual key management. The CMEK-requirement constraint only rejects non-CMEK resources; developers would still need to create keys. A trigger reacting to audit logs creates keys after the resource exists, so the resource would already be using default encryption. Google default encryption is not customer-managed, and protection level is a property of a KMS key, not of a project.

Question 7 of 10, Ensuring data protection

A payments team needs to store database passwords and API tokens, rotate them on a schedule, restrict access per secret, and keep the replicas in two specific EU regions only. Which service and configuration should you use?

  1. ACloud Storage objects encrypted with CMEK in a dual-region EU bucket, with a lifecycle rule that deletes objects after 90 days
  2. BCloud KMS asymmetric keys in an EU multi-region key ring, with the secrets stored as encrypted labels on the key resources
  3. CSecret Manager with an automatic replication policy and an organization policy that restricts resource locations to the EU
  4. DSecret Manager with user-managed replication in the two EU regions and a rotation schedule that notifies Pub/Sub Correct answer

Answer and explanation: User-managed replication pins secret payloads to the exact regions chosen, and rotation schedules publish to Pub/Sub so a function can rotate the value. Cloud KMS manages keys, not secret payloads, and labels are not a place to store secrets. Automatic replication lets Google choose locations, so it does not guarantee the two named regions. Objects in a bucket lack per-secret versioning, access semantics and rotation workflow, and a deletion rule is not rotation.

Question 8 of 10, Managing operations

An auditor asks who read rows from a sensitive Cloud SQL instance and Cloud Storage bucket during the last month. The logs show administrative changes but no read activity. What is the MOST likely cause?

  1. AThe _Required log bucket retention was shortened to seven days, so the read events have already been deleted
  2. BData Access audit logs were not enabled for Cloud SQL and Cloud Storage, because they are off by default for most services Correct answer
  3. CAdmin Activity audit logs were excluded from the _Default sink, so the read operations were never routed to any log bucket for retention
  4. DSystem Event audit logs were disabled at the organization node, which suppresses all read events for managed services

Answer and explanation: Data Access audit logs record reads of user data and are disabled by default for most services except BigQuery, so they must be enabled explicitly. Admin Activity logs record configuration changes, not data reads, and they go to the _Required bucket that cannot be excluded. System Event logs cannot be disabled and record Google-initiated actions, not user reads. The _Required bucket retention is fixed at 400 days and cannot be changed.

Question 9 of 10, Managing operations. Choose 2.

Developers create infrastructure with Terraform from their laptops, and auditors found inconsistent configurations. The security team wants all production changes to go through version control, peer review and an automated pipeline with policy checks. Which steps are MOST effective? (Choose two.)

  1. AStore Terraform state locally on each laptop so that state cannot leak through a bucket
  2. BRequire merge request approval before the pipeline applies plans that passed policy validation Correct answer
  3. CRun Security Health Analytics weekly and roll back any change that appears in its findings
  4. DGrant production write roles only to the pipeline's service account, not to individual developers Correct answer
  5. EGive each developer a personal service account key so that pipeline runs can be traced

Answer and explanation: Restricting production write access to the pipeline identity forces changes through the pipeline, and required approvals add peer review before validated plans are applied. Personal keys are long-lived secrets and let developers bypass the pipeline. Local state causes drift and conflicts; state belongs in a secured remote backend. Weekly scans are detective and do not enforce review.

Question 10 of 10, Supporting compliance requirements

An EU public-sector customer requires that its workloads use only EU regions, that Google support be provided only by EU personnel, and that keys be held outside Google's infrastructure by a local partner. Which approach meets these requirements?

  1. AAssured Workloads with a FedRAMP Moderate package, combined with Cloud HSM keys created in EU regions
  2. BAccess Transparency and Access Approval, combined with CSEK keys supplied for each request
  3. CAssured Workloads with a sovereign controls package, combined with Cloud EKM keys from the partner Correct answer
  4. DResource location restriction to EU locations, combined with CMEK keys in an EU key ring

Answer and explanation: Sovereign control packages in Assured Workloads enforce EU data residency and EU personnel support, and Cloud EKM keeps keys with an external partner. FedRAMP packages are US frameworks and Cloud HSM keys live inside Google. Location restriction with CMEK covers residency but not personnel controls or external key custody. Access Transparency and Approval add visibility and approval but do not restrict regions or personnel, and CSEK is limited to a few services.