πŸ”

PCD β€” questions

Page 17 of 18 Β· 359 total questions.

Topic 1 Β· Question 322

You have an on-premises containerized service written in the current stable version of Python 3 that is available only to users in the United States. The service has high traffic during the day and no traffic at night. You need to migrate this application to Google Cloud and track error logs after the migration in Error Reporting. You want to minimize the cost and effort of these tasks. What should you do?

  • ADeploy the code on Cloud Run. Configure your code to write errors to standard error. (correct answer)
  • BDeploy the code on Cloud Run. Configure your code to stream errors to a Cloud Storage bucket.
  • CDeploy the code on a GKE Autopilot cluster. Configure your code to write error logs to standard error.
  • DDeploy the code on a GKE Autopilot cluster. Configure your code to write error logs to a Cloud Storage bucket.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Deploy the code on Cloud Run. Configure your code to write errors to standard error.

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead.

Topic 1 Β· Question 323

You have an application running on a GKE cluster. Your application has a stateless web frontend, and has a high-availability requirement. Your cluster is set to automatically upgrade, and some of your nodes need to be drained. You need to ensure that the application has a serving capacity of 10% of the Pods prior to the drain. What should you do?

  • AConfigure a Vertical Pod Autoscaler (VPA) to increase the memory and CPU by 10% and set the updateMode to Auto.
  • BConfigure the Pod replica count to be 10% more than the current replica count.
  • CConfigure a Pod Disruption Budget (PDB) value to have a minAvailable value of 10%. (correct answer)
  • DConfigure the Horizontal Pod Autoscaler (HPA) maxReplicas value to 10% more than the current replica count.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Configure a Pod Disruption Budget (PDB) value to have a minAvailable value of 10%.

Topic 1 Β· Question 324

You have developed a Python application that you want to containerize and deploy to Cloud Run. You have developed a Cloud Build pipeline with the following steps: After triggering the pipeline, you notice in the Cloud Build logs that the final step of the pipeline fails and the container is unable to be deployed to Cloud Run. What is the cause of this issue, and how should you resolve it?

Exhibit 1 for question 324
  • AThe final step uses a Cloud Run instance name that does not match the container name. Update the deployment step so that the Cloud Run instance name matches the container name, and rerun the pipeline.
  • BThe Docker container image has not been pushed to Artifact Registry. Add a step to the pipeline to push the application container image to Artifact Registry, and rerun the pipeline. (correct answer)
  • CCloud Run does not allow unauthenticated invocations. Remove the --allow-unauthenticated parameter to enforce authentication on the application, and rerun the pipeline.
  • DUnit tests in the pipeline are failing. Update the application code so that all unit tests pass, and rerun the pipeline.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: The Docker container image has not been pushed to Artifact Registry. Add a step to the pipeline to push the application container image to Artifact Registry, and rerun the pipeline.

Explanation

Artifact Registry stores and manages container images and language packages.

Topic 1 Β· Question 325

Your infrastructure team uses Terraform Cloud and manages Google Cloud resources by using Terraform configuration files. You want to configure an infrastructure as code pipeline that authenticates to Google Cloud APIs. You want to use the most secure approach and minimize changes to the configuration. How should you configure the authentication?

  • AUse Terraform on GKE. Create a Kubernetes service account to execute the Terraform code. Use workload identity federation to authenticate as the Google service account.
  • BInstall Terraform on a Compute Engine VM. Configure the VM by using a service account that has the required permissions to manage the Google Cloud resources.
  • CConfigure Terraform Cloud to use workload identity federation to authenticate to the Google Cloud APIs. (correct answer)
  • DCreate a service account that has the required permissions to manage the Google Cloud resources, and import the service account key to Terraform Cloud. Use this service account to authenticate to the Google Cloud APIs.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Configure Terraform Cloud to use workload identity federation to authenticate to the Google Cloud APIs.

Explanation

Workload Identity Federation lets workloads access Google Cloud without long-lived service account keys. Terraform provisions Google Cloud infrastructure as code repeatably.

Topic 1 Β· Question 326 Β· Select all that apply

Your team has created an application that is hosted on a GKE cluster. You need to connect the application to a REST service that is deployed in two GKE clusters in two different regions. How should you set up the connection and health checks? (Choose two.)

  • AUse Cloud Service Mesh with sidecar proxies to connect the application to the REST service. (correct answer)
  • BUse Cloud Service Mesh with proxyless gRPC to connect the application to the REST service.
  • CConfigure the REST service's firewall to allow health checks originating from the GKE service’s IP ranges.
  • DConfigure the REST service's firewall to allow health checks originating from the GKE control plane’s IP ranges.
  • EConfigure the REST service's firewall to allow health checks originating from the GKE check probe’s IP ranges. (correct answer)
Reveal answer & explanation
Correct answer: A, E

The correct answer is A, E. Option A: Use Cloud Service Mesh with sidecar proxies to connect the application to the REST service. Option E: Configure the REST service's firewall to allow health checks originating from the GKE check probe’s IP ranges.

Explanation

Google Kubernetes Engine runs managed Kubernetes for containerized, portable workloads.

Topic 1 Β· Question 327

You are using the latest stable version of Python 3 to develop an API that stores data in a Cloud SQL database. You need to perform CRUD operations on the production database securely and reliably with minimal effort. What should you do?

  • A1. Use Cloud Composer to manage the connection to the Cloud SQL database from your Python application.2. Grant an IAM role to the service account that includes the composer.worker permission.
  • B1. Use the Cloud SQL API to connect to the Cloud SQL database from your Python application.2. Grant an IAM role to the service account that includes the cloudsql.instances.login permission.
  • C1. Use the Cloud SQL connector library for Python to connect to the Cloud SQL database through a Cloud SQL Auth Proxy.2. Grant an IAM role to the service account that includes the cloudsql.instances.connect permission. (correct answer)
  • D1. Use the Cloud SQL emulator to connect to the Cloud SQL database from Cloud Shell2. Grant an IAM role to the user that includes the cloudsql.instances.login permission.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: 1. Use the Cloud SQL connector library for Python to connect to the Cloud SQL database through a Cloud SQL Auth Proxy.2. Grant an IAM role to the service account that includes the cloudsql.instances.connect permission.

Explanation

Cloud SQL is a managed relational database (MySQL/PostgreSQL/SQL Server) that handles patching, backups, and failover. A service account provides an identity for workloads to access Google Cloud APIs securely. Cloud IAM grants fine-grained, least-privilege access to Google Cloud resources.

Topic 1 Β· Question 328

Your company manages an application that captures stock data in an internal database. You need to create an API that provides real-time stock data to users. You want to return stock data to users as quickly as possible, and you want your solution to be highly scalable. What should you do?

  • ACreate a BigQuery dataset and table to act as the internal database. Query the table when user requests are received.
  • BCreate a Memorystore for Redis instance to store all stock market data. Query this database when user requests are received.
  • CCreate a Bigtable instance. Query the table when user requests are received. Configure a Pub/Sub topic to queue user requests that your API will respond to.
  • DCreate a Memorystore for Redis instance, and use this database to store the most accessed stock data. Query this instance first when user requests are received, and fall back to the internal database. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Create a Memorystore for Redis instance, and use this database to store the most accessed stock data. Query this instance first when user requests are received, and fall back to the internal database.

Explanation

Memorystore provides managed in-memory Redis/Memcached caching to reduce latency and offload databases. This option meets the real-time / low-latency performance requirement.

Topic 1 Β· Question 329

You are designing a microservices architecture for a new application that will be deployed on Cloud Run. The application requires high-throughput communication between the internal microservices. You want to use the most effective, lowest latency communication protocol for this application. What should you do?

  • AConfigure the Cloud Run service to use HTTP/2. Implement gRPC for communication between the microservices. Use streaming gRPCs when a large amount of data has to be sent. (correct answer)
  • BImplement the microservices with the REST API communication protocol. Use Apigee with rate-limiting to provide the best QoS for high-priority services.
  • CUse SOAP to build the microservices API, and use XML as the data format for communication across the microservices. Define SOAP data contracts for each microservice.
  • DUse HTTP REST to communicate across the microservices. Implement pagination and add indexing to your database.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Configure the Cloud Run service to use HTTP/2. Implement gRPC for communication between the microservices. Use streaming gRPCs when a large amount of data has to be sent.

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead.

Topic 1 Β· Question 330

Your company recently modernized their monolith ecommerce site to a microservices application in GKE. Your team uses Google Cloud's operations suite for monitoring and logging. You want to improve the logging indexing and searchabilty in Cloud Logging across your microservices with the least amount of effort. What should you do?

  • AAsk the SRE team to enable Managed Service for Prometheus on your GKE cluster.
  • BReconfigure your applications to write logs to an emptyDir volume. Configure a sidecar agent to read the logs and send them to the Cloud Logging API.
  • CUpdate your microservices code to emit logs in JSON format. (correct answer)
  • DInstrument your microservices code with OpenTelemetry libraries.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Update your microservices code to emit logs in JSON format.

Topic 1 Β· Question 331

You recently developed an application that will be hosted on Cloud Run. You need to conduct a load test. You want to analyze the load test logs second by second to understand your Cloud Run service's response to rapid traffic spikes. You want to minimize effort. How should you analyze the logs?

  • AUse estimation to extrapolate performance from summary monitoring charts.
  • BAnalyze the log data in BigQuery by configuring a BigQuery log sink with the appropriate inclusion filter for your application. (correct answer)
  • CUse Cloud Monitoring’s default log console for analysis.
  • DAnalyze the log data in Cloud SQL for PostgreSQL by pushing logs to a Pub/Sub topic. Use Dataflow to process and ingest the logs.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Analyze the log data in BigQuery by configuring a BigQuery log sink with the appropriate inclusion filter for your application.

Explanation

BigQuery is a serverless, petabyte-scale data warehouse for fast SQL analytics with no infrastructure to manage. This option decouples the components so they scale independently and absorb load spikes.

Topic 1 Β· Question 332

You are deploying a microservices application to GKE. One microservice needs to download files from a Cloud Storage bucket. You have an IAM service account with the Storage Object Viewer role on the project with the bucket. You need to configure your application to access the Cloud Storage bucket while following Google-recommended practices. What should you do?

  • AAssign the IAM service account to the cluster’s node pool. Configure the application to authenticate to the bucket by using Application Default Credentials.
  • BAssign the IAM service account to the cluster’s node pool. Encrypt the IAM service account key file by using a symmetric block cipher, and store the encrypted file on a persistent volume. Store the encryption key in Secret Manager.
  • CCreate a Kubernetes service account. Create a Kubernetes secret with a base64-encoded IAM service account key file. Annotate the Kubernetes secret with the Kubernetes service account. Assign the Kubernetes ServiceAccount to the Pods that need to access the bucket.
  • DCreate a Kubernetes service account. Use an IAM policy to bind the IAM service account to a Kubernetes service account. Annotate the Kubernetes ServiceAccount object with the name of the bound IAM service account. Assign the Kubernetes ServiceAccount to the Pods that need to access the bucket. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Create a Kubernetes service account. Use an IAM policy to bind the IAM service account to a Kubernetes service account. Annotate the Kubernetes ServiceAccount object with the name of the bound IAM service account. Ass...

Explanation

A service account provides an identity for workloads to access Google Cloud APIs securely. Cloud IAM grants fine-grained, least-privilege access to Google Cloud resources.

Topic 1 Β· Question 333

You are developing a new ecommerce website for your company. You want customers to receive a customized email notification when they place an order. You need to configure this email service while minimizing deployment effort. What should you do?

  • ACreate a Cloud Function that is triggered by a create type event in Firestore, (correct answer)
  • BCreate an email-sending application hosted on Compute Engine that is invoked by an HTTP request.
  • CCreate an email notification channel, and set up an alerting policy that is based on log metrics from a create type event.
  • DUse Pub/Sub to send an email when the orders/ API returns an HTTP response of 200 OK.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Create a Cloud Function that is triggered by a create type event in Firestore,

Explanation

Firestore is a serverless, autoscaling NoSQL document database ideal for app and user data.

Topic 1 Β· Question 334

You are developing an online chat application where users can upload profile pictures. Uploaded profile pictures must comply with content policies. You need to detect inappropriate images and label those images automatically when they are uploaded. In the future, this process will need to be expanded to include additional processing tasks such as watermarking and image compression. You want to simplify orchestration and minimize operational overhead of the image scanning and labeling steps while also ensuring that additional steps can be added and removed easily later on. What should you do?

  • ASave user-uploaded images to a temporary Cloud Storage bucket. Implement code on the backend server to retrieve the image content and call the Vision API to process each new uploaded image.
  • BSave user-uploaded images to a Cloud Storage bucket. Configure a Cloud Function that is triggered when a new image is uploaded and calls one or more Cloud Run services. Create additional Cloud Run services that call the Vision API to process each new uploaded image.
  • CSave user-uploaded images to a Cloud Storage bucket. Configure a Cloud Function that is triggered when a new image is uploaded and publishes a message to a Pub/Sub topic. Deploy microservices in GKE that subscribe to the Pub/Sub topic and call the Vision API to process each new uploaded image.
  • DSave user-uploaded images to a Cloud Storage bucket. Create an Eventarc trigger that connects the bucket to the Workflows event receiver when a new image is uploaded. Create a workflow in Workflows with multiple Cloud Functions that call the Vision API to process each new uploaded image. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Save user-uploaded images to a Cloud Storage bucket. Create an Eventarc trigger that connects the bucket to the Workflows event receiver when a new image is uploaded. Create a workflow in Workflows with multiple Cloud...

Explanation

Cloud Functions runs event-driven code without managing servers and scales automatically. Cloud Storage provides durable, scalable object storage that is fully managed.

Topic 1 Β· Question 335

You are responsible for improving the security of your Cloud Run services to protect these services against supply chain threats. You need to ensure that there are adequate security controls such as SLSA Level 3 builds for container images and non-falsifiable provenance for container images by using Google Cloud tools. What should you do?

  • AAsk developers to build container images locally and ensure strict version controls by using Container Registry.
  • BUse Cloud Build to build container images. Configure a Binary Authorization policy on the Cloud Run job.
  • CUse Cloud Deploy to generate authenticated and non-falsifiable build provenance for container images. (correct answer)
  • DUse Cloud Build to build container images. Use Cloud Scheduler to automate delivery of your applications to a series of target environments in a defined sequence.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Use Cloud Deploy to generate authenticated and non-falsifiable build provenance for container images.

Explanation

Cloud Deploy manages continuous delivery to GKE and other runtimes with promotion and rollback.

Topic 1 Β· Question 336

You are designing a microservices application on GKE that will expose a public API to users. Users will interact with the application by using OAuth 2.0, and illegitimate requests should receive a 403 response code. You need the API to be resilient against distributed denial of service (DDoS) attacks and critical security risks such as SQL injection (SQL) and cross-site scripting (XSS). You want to design the application's architecture while following Google-recommended practices. What should you do?

  • AInstall Service Mesh in your GKE cluster. Configure Service Mesh user authentication to integrate the service hosted on GKE by using an OpenID Connect-compliant identity provider. Expose the application externally by using an Istio Ingress Gateway. Use VPC firewall rules to restrict Ingress traffic to the Ingress gateway.
  • BRun an Apache HTTP server on Cloud Run to expose a service with a public IP address. Configure the Apache HTTP server as a reverse proxy to only forward valid requests to the API hosted on GKE.
  • CUse an external Application Load Balancer with Cloud Armor. Integrate Cloud Armor with reCAPTCHA Enterprise. Configure the load balancer to forward traffic to the application hosted on GKE. (correct answer)
  • DUse an external Application Load Balancer with Cloud Armor, and configure the load balancer to forward requests to Apigee to check the validity of the API requests. Configure GKE as the application's backend.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Use an external Application Load Balancer with Cloud Armor. Integrate Cloud Armor with reCAPTCHA Enterprise. Configure the load balancer to forward traffic to the application hosted on GKE.

Explanation

Google Kubernetes Engine runs managed Kubernetes for containerized, portable workloads. A load balancer distributes traffic across healthy backends in multiple zones for availability and scale. Cloud Armor protects applications from DDoS and common web attacks with WAF rules. By spanning multiple Availability Zones / adding redundancy, this option provides the high availability and resilience required.

Topic 1 Β· Question 337

You are compiling a compliance report on vulnerability metadata for a specific set of images identified by Artifact Analysis. Metadata from images scanned more than 30 days ago are missing from the compliance report. You need to access the vulnerability metadata for these older images. What should you do?

  • ACreate a Pub/Sub subscription to pull from Artifact Analysis topics.
  • BCheck Artifact Analysis storage buckets in Cloud Storage. (correct answer)
  • CPush or pull the images from Artifact Registry.
  • DCheck Cloud Trace logs for Artifact Analysis findings.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Check Artifact Analysis storage buckets in Cloud Storage.

Explanation

Cloud Storage provides durable, scalable object storage that is fully managed.

Topic 1 Β· Question 338

Your team runs a Python job that reads millions of customer record files stored in a Cloud Storage bucket. To comply with regulatory requirements, you need to ensure that customer data is immediately deleted once the job is completed. You want to minimize the time required to complete this task. What should you do?

  • AAdd a final step in the job that deletes all the objects in the bucket in bulk by using batch requests to the Cloud Storage API. (correct answer)
  • BConfigure Object Lifecycle Management on the Cloud Storage bucket that deletes all the objects in the bucket at the end of the job execution.
  • CRemove the bucket from the Google Cloud console when the job is completed
  • DUse the gcloud CLI to execute the gcloud storage rm --recursive gs://BUCKET_NAME/ command.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Add a final step in the job that deletes all the objects in the bucket in bulk by using batch requests to the Cloud Storage API.

Explanation

Google Cloud Batch schedules and runs batch jobs at scale without managing infrastructure. Cloud Storage provides durable, scalable object storage that is fully managed.

Topic 1 Β· Question 339

You have a Cloud Run service that needs to connect to a Cloud SQL instance in a different project. You provisioned the Cloud Run service account with the Cloud SQL Client IAM role on the project that is hosting Cloud SQL. However, when you test the connection, the connection fails. You want to fix the connection failure while following Google-recommended practices. What should you do?

  • AAdd the cloudsql.instances.connect IAM permission to the Cloud Run service account.
  • BRequest additional API quota for Cloud SQL Auth Proxy,
  • CEnable the Cloud SQL Admin API in both projects. (correct answer)
  • DMigrate the Cloud SQL instance into the same project as the Cloud Run service.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Enable the Cloud SQL Admin API in both projects.

Explanation

Cloud SQL is a managed relational database (MySQL/PostgreSQL/SQL Server) that handles patching, backups, and failover.

Topic 1 Β· Question 340

You developed a Python script that retrieves information from files that are uploaded to Cloud Storage and writes the information to Bigtable. You have completed testing on your local environment and created the python-script service account with the Bigtable User IAM role. You want to deploy the code with the appropriate authentication while following Google-recommended practices. What should you do?

  • A1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.2. Configure IAM binding for authentication. (correct answer)
  • B1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.2. Create a service account key for authentication
  • C1. Deploy your image to Cloud Run. Create a trigger in Cloud Scheduler that triggers the service every minute.2. Configure IAM binding for authentication.
  • D1. Deploy your image to Cloud Run. Create a trigger in Cloud Scheduler that triggers the service every minute.2. Create a service account key for authentication.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: 1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.2. Configure IAM binding for authentication.

Explanation

Cloud Functions runs event-driven code without managing servers and scales automatically. Cloud Storage provides durable, scalable object storage that is fully managed. Cloud IAM grants fine-grained, least-privilege access to Google Cloud resources.

Topic 1 Β· Question 341

You are a developer at a large organization. Your team uses Git for source code management (SCM). You want to ensure that your team follows Google-recommended best practices to manage code to drive higher rates of software delivery. Which SCM process should your team use?

  • AEach developer commits their code to the main branch before each product release, conducts testing, and rolls back if integration issues are detected.
  • BEach group of developers copies the repository, commits their changes to their repository, and merges their code into the main repository before each product release.
  • CEach developer creates a branch for their own work, commits their changes to their branch, and merges their code into the main branch daily. (correct answer)
  • DEach group of developers creates a feature branch from the main branch for their work, commits their changes to their branch, and merges their code into the main branch before each major release.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Each developer creates a branch for their own work, commits their changes to their branch, and merges their code into the main branch daily.

Showing questions 321–340 of 359 Β· Page 17 of 18