Google

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:
Use the fields request parameter (partial response) to request only the specific metadata properties needed. This avoids retrieving unnecessary data, minimizes response size, and maximizes performance while ensuring only metadata is returned. The patch method updates metadata, compose combines objects, and copy copies objects rather than retrieving 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:
A timeout when using kubectl against a GKE cluster with a public endpoint commonly indicates that the client cannot reach the Kubernetes API server. If authorized networks are enabled, Cloud Shell's ephemeral external IP must be included. Missing IAM/RBAC permissions typically produce authorization errors rather than silent timeouts. Being in the same VPC is not required for a public endpoint, and VPC firewall rules do not control access to the managed public control plane endpoint.

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 the Cloud Client Libraries for Cloud Spanner from Go. These libraries are optimized for Google Cloud services, provide idiomatic language support, handle authentication, retries, connection management, and expose Spanner-specific features. Using raw Google API client libraries, a custom gRPC client, or third-party HTTP clients is not the recommended best practice for application development.

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 recommends avoiding long-lived service account keys and using service account impersonation instead. Since your user already has the Service Account Token Creator role and the required deployment permissions, configuring gcloud to impersonate the service account allows Terraform to obtain short-lived credentials without downloading a key. Option A and D rely on service account keys, which are discouraged. Option C authenticates as your personal identity but does not configure Terraform to use the required service account.

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:
Use multi-zonal node pools to distribute nodes evenly across zones for high availability and resilience against zone or hardware failures. Use the Cluster Autoscaler to automatically add/remove nodes based on demand, together with the Horizontal Pod Autoscaler to scale application pods as traffic fluctuates. Multiple separate zonal node pools do not inherently provide the same balanced multi-zonal distribution, managed instance groups should not be managed separately for GKE nodes, and manual scaling does not meet the automatic scaling requirement.

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:
Data residency requires storing customer data in the country/region where transactions occur, so a separate Cloud Storage bucket is needed in each target region. To avoid cross-region data access and comply with residency while maintaining low latency, deploy the Cloud Run service in the same region as its corresponding bucket. The other options either centralize compute in Singapore or use Asia multi-region storage, which does not satisfy country-specific residency requirements.

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 should be right-sized by monitoring CPU utilization in Cloud Monitoring and then decreasing processing units in small increments while ensuring utilization and performance remain within recommended limits. Cloud Logging, Cloud Trace, and Snapshot Debugger are not the primary tools for capacity right-sizing.

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:
Use namespace isolation within the existing GKE cluster and Kubernetes RBAC to grant administrative permissions only within the new namespace. This allows the other team to deploy and manage their integration without being able to modify your application's resources in a different namespace. Granting IAM Editor at the project level is overly broad, and Viewer cannot deploy workloads. Creating a separate cluster is unnecessary. Sources: https://docs.cloud.google.com/kubernetes-engine/docs/best-practices/enterprise-multitenancy

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 force a specific request to be traced in Google Cloud Trace, include the X-Cloud-Trace-Context header with the appropriate trace context (including the trace ID and trace options). This overrides normal sampling behavior for that request. Waiting does not guarantee capture, repeatedly sending requests does not ensure a particular request is traced, and adding custom attributes via the Trace API does not force sampling.

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:
Cloud Spanner is the appropriate choice for a globally scalable relational database. For primary keys in Spanner, avoid monotonically increasing values because they create write hotspots. Using a UUID for TransactionId distributes writes more evenly. A composite primary key of (TransactionId, CustomerId) ensures uniqueness of the pair while leveraging a non-sequential key for scalability.

$19

Get all 358 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.