Professional Cloud Developer Free Practice Questions — Page 18
Question 172
You are developing a new public-facing application that needs to retrieve specific properties in the metadata of users’ objects in their respective Cloud Storage buckets. Due to privacy and data residency requirements, you must retrieve only the metadata and not the object data. You want to maximize the performance of the retrieval process. How should you retrieve the metadata?
A. Use the patch method.
B. Use the compose method.
C. Use the copy method.
D. Use the fields request parameter.
Show Answer
Correct Answer: D
Explanation: To retrieve only object metadata (and not the object data) with maximum performance, you should use the fields request parameter. This enables partial responses in the Cloud Storage JSON API, returning only the specific metadata fields you need, which minimizes payload size, improves performance, and satisfies privacy and data residency requirements. The other methods (patch, compose, copy) are used to modify or manipulate objects, not to efficiently read metadata.
Question 173
You are trying to connect to your Google Kubernetes Engine (GKE) cluster using kubectl from Cloud Shell. You have deployed your GKE cluster with a public endpoint. From Cloud Shell, you run the following command:
You notice that the kubectl commands time out without returning an error message. What is the most likely cause of this issue?
A. Your user account does not have privileges to interact with the cluster using kubectl.
B. Your Cloud Shell external IP address is not part of the authorized networks of the cluster.
C. The Cloud Shell is not part of the same VPC as the GKE cluster.
D. A VPC firewall is blocking access to the cluster’s endpoint.
Show Answer
Correct Answer: B
Explanation: When a GKE cluster uses a public control-plane endpoint with authorized networks enabled, kubectl access is allowed only from IP addresses on that list. Cloud Shell has a dynamic external IP that is often not included, which causes kubectl to hang or time out without a clear error. This matches the observed behavior better than IAM issues, VPC placement, or general firewall rules.
Question 174
You are writing from a Go application to a Cloud Spanner database. You want to optimize your application’s performance using Google-recommended best practices. What should you do?
A. Write to Cloud Spanner using Cloud Client Libraries.
B. Write to Cloud Spanner using Google API Client Libraries
C. Write to Cloud Spanner using a custom gRPC client library.
D. Write to Cloud Spanner using a third-party HTTP client library.
Show Answer
Correct Answer: A
Explanation: Google recommends using Cloud Client Libraries for Cloud Spanner because they are optimized, idiomatic for Go, handle authentication, retries, and performance best practices automatically. Other options either operate at a lower level or are not recommended for direct Cloud Spanner access.
Question 175
You need to deploy resources from your laptop to Google Cloud using Terraform. Resources in your Google Cloud environment must be created using a service account. Your Cloud Identity has the roles/iam.serviceAccountTokenCreator Identity and Access Management (IAM) role and the necessary permissions to deploy the resources using Terraform. You want to set up your development environment to deploy the desired resources following Google-recommended best practices. What should you do?
A. 1. Download the service account’s key file in JSON format, and store it locally on your laptop. 2. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your downloaded key file.
B. 1. Run the following command from a command line: gcloud config set auth/impersonate_service_account [email protected] . 2. Set the GOOGLE_OAUTH_ACCESS_TOKEN environment variable to the value that is returned by the gcloud auth print-access-token command.
C. 1. Run the following command from a command line: gcloud auth application-default login. 2. In the browser window that opens, authenticate using your personal credentials.
D. 1. Store the service account's key file in JSON format in Hashicorp Vault. 2. Integrate Terraform with Vault to retrieve the key file dynamically, and authenticate to Vault using a short-lived access token.
Show Answer
Correct Answer: B
Explanation: Google-recommended best practice is to avoid long-lived service account keys and instead use service account impersonation. Since your identity already has roles/iam.serviceAccountTokenCreator, configuring gcloud to impersonate the service account allows Terraform to obtain short-lived credentials securely. This provides strong auditability, centralized IAM control, and no key material stored on your laptop. Options A and D rely on service account keys, which are discouraged, and C authenticates only as your personal identity without enforcing service account usage.
Question 176
You are deploying a microservices application to Google Kubernetes Engine (GKE) that will broadcast livestreams. You expect unpredictable traffic patterns and large variations in the number of concurrent users. Your application must meet the following requirements:
• Scales automatically during popular events and maintains high availability
• Is resilient in the event of hardware failures
How should you configure the deployment parameters? (Choose two.)
A. Distribute your workload evenly using a multi-zonal node pool.
B. Distribute your workload evenly using multiple zonal node pools.
C. Use cluster autoscaler to resize the number of nodes in the node pool, and use a Horizontal Pod Autoscaler to scale the workload.
D. Create a managed instance group for Compute Engine with the cluster nodes. Configure autoscaling rules for the managed instance group.
E. Create alerting policies in Cloud Monitoring based on GKE CPU and memory utilization. Ask an on-duty engineer to scale the workload by executing a script when CPU and memory usage exceed predefined thresholds.
Show Answer
Correct Answer: A, C
Explanation: To handle unpredictable livestream traffic and ensure high availability, you should distribute workloads across multiple zones and enable automatic scaling. Using a multi-zonal node pool spreads nodes evenly across zones, providing resilience against zonal or hardware failures. Combining the Cluster Autoscaler (to scale nodes) with the Horizontal Pod Autoscaler (to scale pods based on load) allows the application to automatically scale during popular events while maintaining availability.
Question 177
You work at a rapidly growing financial technology startup. You manage the payment processing application written in Go and hosted on Cloud Run in the Singapore region (asia-southeast1). The payment processing application processes data stored in a Cloud Storage bucket that is also located in the Singapore region.
The startup plans to expand further into the Asia Pacific region. You plan to deploy the Payment Gateway in Jakarta, Hong Kong, and Taiwan over the next six months. Each location has data residency requirements that require customer data to reside in the country where the transaction was made. You want to minimize the cost of these deployments. What should you do?
A. Create a Cloud Storage bucket in each region, and create a Cloud Run service of the payment processing application in each region.
B. Create a Cloud Storage bucket in each region, and create three Cloud Run services of the payment processing application in the Singapore region.
C. Create three Cloud Storage buckets in the Asia multi-region, and create three Cloud Run services of the payment processing application in the Singapore region.
D. Create three Cloud Storage buckets in the Asia multi-region, and create three Cloud Run revisions of the payment processing application in the Singapore region.
Show Answer
Correct Answer: A
Explanation: Each country has strict data residency requirements, meaning both data storage and data processing must occur within the same country. Creating a Cloud Storage bucket in each region ensures customer data resides locally, and deploying a Cloud Run service in each corresponding region ensures processing also occurs locally. This architecture satisfies residency rules and avoids cross-region data transfer costs. Options using multi-region buckets or centralized Cloud Run services in Singapore violate data residency or increase latency and costs.
Question 178
You recently joined a new team that has a Cloud Spanner database instance running in production. Your manager has asked you to optimize the Spanner instance to reduce cost while maintaining high reliability and availability of the database. What should you do?
A. Use Cloud Logging to check for error logs, and reduce Spanner processing units by small increments until you find the minimum capacity required.
B. Use Cloud Trace to monitor the requests per sec of incoming requests to Spanner, and reduce Spanner processing units by small increments until you find the minimum capacity required.
C. Use Cloud Monitoring to monitor the CPU utilization, and reduce Spanner processing units by small increments until you find the minimum capacity required.
D. Use Snapshot Debugger to check for application errors, and reduce Spanner processing units by small increments until you find the minimum capacity required.
Show Answer
Correct Answer: C
Explanation: Cloud Spanner capacity planning and cost optimization are done by observing real utilization metrics in Cloud Monitoring, especially CPU utilization. Google recommends adjusting Spanner processing units gradually while monitoring CPU to ensure sufficient headroom for reliability and availability. Logging, Trace, and Debugger are not appropriate tools for right-sizing Spanner compute capacity.
Question 179
Your team manages a Google Kubernetes Engine (GKE) cluster where an application is running. A different team is planning to integrate with this application. Before they start the integration, you need to ensure that the other team cannot make changes to your application, but they can deploy the integration on GKE. What should you do?
A. Using Identity and Access Management (IAM), grant the Viewer IAM role on the cluster project to the other team.
B. Create a new GKE cluster. Using Identity and Access Management (IAM), grant the Editor role on the cluster project to the other team.
C. Create a new namespace in the existing cluster. Using Identity and Access Management (IAM), grant the Editor role on the cluster project to the other team.
D. Create a new namespace in the existing cluster. Using Kubernetes role-based access control (RBAC), grant the Admin role on the new namespace to the other team.
Show Answer
Correct Answer: D
Explanation: The requirement is to prevent the other team from modifying the existing application while still allowing them to deploy their own integration workloads on GKE. This is best achieved by isolating access within the same cluster. Creating a separate namespace provides logical isolation, and Kubernetes RBAC allows fine‑grained permissions scoped to that namespace. Granting them an Admin role only in the new namespace lets them fully manage their integration there without granting any permissions over your application or other namespaces. IAM roles at the project level (Viewer/Editor) are too broad and would either be insufficient or grant excessive access.
Question 180
You have recently instrumented a new application with OpenTelemetry, and you want to check the latency of your application requests in Trace. You want to ensure that a specific request is always traced. What should you do?
A. Wait 10 minutes, then verify that Trace captures those types of requests automatically.
B. Write a custom script that sends this type of request repeatedly from your dev project.
C. Use the Trace API to apply custom attributes to the trace.
D. Add the X-Cloud-Trace-Context header to the request with the appropriate parameters.
Show Answer
Correct Answer: D
Explanation: To ensure a specific request is always traced in Google Cloud Trace when using OpenTelemetry, you must explicitly force tracing for that request. This is done by adding the X-Cloud-Trace-Context header with the appropriate trace and sampling parameters. This header instructs the tracing system to sample and record the request regardless of default sampling behavior, allowing you to reliably inspect request latency in Trace.
Question 181
You work for an organization that manages an online ecommerce website. Your company plans to expand across the world; however, the estore currently serves one specific region. You need to select a SQL database and configure a schema that will scale as your organization grows. You want to create a table that stores all customer transactions and ensure that the customer (CustomerId) and the transaction (TransactionId) are unique. What should you do?
A. Create a Cloud SQL table that has TransactionId and CustomerId configured as primary keys. Use an incremental number for the TransactionId.
B. Create a Cloud SQL table that has TransactionId and CustomerId configured as primary keys. Use a random string (UUID) for the Transactionid.
C. Create a Cloud Spanner table that has TransactionId and CustomerId configured as primary keys. Use a random string (UUID) for the TransactionId.
D. Create a Cloud Spanner table that has TransactionId and CustomerId configured as primary keys. Use an incremental number for the TransactionId.
Show Answer
Correct Answer: C
Explanation: The requirement is to scale globally as the ecommerce platform expands worldwide. Cloud Spanner is a globally distributed, horizontally scalable SQL database, whereas Cloud SQL is regional and does not scale globally in the same way. To ensure uniqueness of transactions across regions and avoid hotspotting or coordination issues, using a random UUID for TransactionId is preferred over an incremental ID. Defining CustomerId and TransactionId as the primary key in Cloud Spanner satisfies both uniqueness and scalability requirements.
$19
Get all 357 questions with detailed answers and explanations
Instant download HTML + PDF delivered the moment payment clears.
Secure Stripe checkout we never see or store your card details.
7-day refund if files are defective see our refund policy.