πŸ”

PCD β€” questions

Page 14 of 18 Β· 359 total questions.

Topic 1 Β· Question 261

You have a web application that publishes messages to Pub/Sub. You plan to build new versions of the application locally and want to quickly test Pub/Sub integration for each new build. How should you configure local testing?

  • AInstall Cloud Code on the integrated development environment (IDE). Navigate to Cloud APIs, and enable Pub/Sub against a valid Google Project ID. When developing locally, configure your application to call pubsub.googleapis.com.
  • BInstall the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID. When developing locally, configure your application to use the local emulator with ${gcloud beta emulators pubsub env-init}. (correct answer)
  • CIn the Google Cloud console, navigate to the API Library, and enable the Pub/Sub API. When developing locally, configure your application to call pubsub.googleapis.com.
  • DInstall the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project IWhen developing locally, configure your application to use the local emulator by exporting the PUBSUB_EMULATOR_HOST variable.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Install the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID. When developing locally, configure your application to use the local emulator with ${gcloud beta emulators pubsub env-i...

Explanation

Pub/Sub is a serverless, global messaging service that decouples services and ingests high-volume event streams.

Topic 1 Β· Question 262

Your ecommerce application receives external requests and forwards them to third-party API services for credit card processing, shipping, and inventory management as shown in the diagram. Your customers are reporting that your application is running slowly at unpredictable times. The application doesn’t report any metrics. You need to determine the cause of the inconsistent performance. What should you do?

Exhibit 1 for question 262
  • AInstall the OpenTelemetry library for your respective language, and instrument your application. (correct answer)
  • BInstall the Ops Agent inside your container and configure it to gather application metrics.
  • CModify your application to read and forward the X-Cloud-Trace-Context header when it calls the downstream services.
  • DEnable Managed Service for Prometheus on the Google Kubernetes Engine cluster to gather application metrics.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Install the OpenTelemetry library for your respective language, and instrument your application.

Topic 1 Β· Question 263

You are developing a new application. You want the application to be triggered only when a given file is updated in your Cloud Storage bucket. Your trigger might change, so your process must support different types of triggers. You want the configuration to be simple so that multiple team members can update the triggers in the future. What should you do?

  • AConfigure Cloud Storage events to be sent to Pub/Sub, and use Pub/Sub events to trigger a Cloud Build job that executes your application.
  • BCreate an Eventarc trigger that monitors your Cloud Storage bucket for a specific filename, and set the target as Cloud Run. (correct answer)
  • CConfigure a Cloud Function that executes your application and is triggered when an object is updated in Cloud Storage.
  • DConfigure a Firebase function that executes your application and is triggered when an object is updated in Cloud Storage.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Create an Eventarc trigger that monitors your Cloud Storage bucket for a specific filename, and set the target as Cloud Run.

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead. Cloud Storage provides durable, scalable object storage that is fully managed.

Topic 1 Β· Question 264

You are defining your system tests for an application running in Cloud Run in a Google Cloud project. You need to create a testing environment that is isolated from the production environment. You want to fully automate the creation of the testing environment with the least amount of effort and execute automated tests. What should you do?

  • AUsing Cloud Build, execute Terraform scripts to create a new Google Cloud project and a Cloud Run instance of your application in the Google Cloud project. (correct answer)
  • BUsing Cloud Build, execute a Terraform script to deploy a new Cloud Run revision in the existing Google Cloud project. Use traffic splitting to send traffic to your test environment.
  • CUsing Cloud Build, execute gcloud commands to create a new Google Cloud project and a Cloud Run instance of your application in the Google Cloud project.
  • DUsing Cloud Build, execute gcloud commands to deploy a new Cloud Run revision in the existing Google Cloud project. Use traffic splitting to send traffic to your test environment.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Using Cloud Build, execute Terraform scripts to create a new Google Cloud project and a Cloud Run instance of your application in the Google Cloud project.

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead. Cloud Build runs managed CI pipelines to build, test, and package code. Terraform provisions Google Cloud infrastructure as code repeatably.

Topic 1 Β· Question 265

You are a cluster administrator for Google Kubernetes Engine (GKE). Your organization’s clusters are enrolled in a release channel. You need to be informed of relevant events that affect your GKE clusters, such as available upgrades and security bulletins. What should you do?

  • AConfigure cluster notifications to be sent to a Pub/Sub topic. (correct answer)
  • BExecute a scheduled query against the google_cloud_release_notes BigQuery dataset.
  • CQuery the GKE API for available versions.
  • DCreate an RSS subscription to receive a daily summary of the GKE release notes.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Configure cluster notifications to be sent to a Pub/Sub topic.

Explanation

Pub/Sub is a serverless, global messaging service that decouples services and ingests high-volume event streams.

Topic 1 Β· Question 266

You are tasked with using C++ to build and deploy a microservice for an application hosted on Google Cloud. The code needs to be containerized and use several custom software libraries that your team has built. You do not want to maintain the underlying infrastructure of the application. How should you deploy the microservice?

  • AUse Cloud Functions to deploy the microservice.
  • BUse Cloud Build to create the container, and deploy it on Cloud Run. (correct answer)
  • CUse Cloud Shell to containerize your microservice, and deploy it on a Container-Optimized OS Compute Engine instance.
  • DUse Cloud Shell to containerize your microservice, and deploy it on standard Google Kubernetes Engine.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Use Cloud Build to create the container, and deploy it on Cloud Run.

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead. Cloud Build runs managed CI pipelines to build, test, and package code.

Topic 1 Β· Question 267

You need to containerize a web application that will be hosted on Google Cloud behind a global load balancer with SSL certificates. You don’t have the time to develop authentication at the application level, and you want to offload SSL encryption and management from your application. You want to configure the architecture using managed services where possible. What should you do?

  • AHost the application on Google Kubernetes Engine, and deploy an NGINX Ingress Controller to handle authentication.
  • BHost the application on Google Kubernetes Engine, and deploy cert-manager to manage SSL certificates.
  • CHost the application on Compute Engine, and configure Cloud Endpoints for your application.
  • DHost the application on Google Kubernetes Engine, and use Identity-Aware Proxy (IAP) with Cloud Load Balancing and Google-managed certificates. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Host the application on Google Kubernetes Engine, and use Identity-Aware Proxy (IAP) with Cloud Load Balancing and Google-managed certificates.

Explanation

Google Kubernetes Engine runs managed Kubernetes for containerized workloads. Cloud Load Balancing distributes traffic across regions and backends for availability and scale. A load balancer distributes traffic across healthy backends in multiple zones for availability and scale.

Topic 1 Β· Question 268

You manage a system that runs on stateless Compute Engine VMs and Cloud Run instances. Cloud Run is connected to a VPC, and the ingress setting is set to Internal. You want to schedule tasks on Cloud Run. You create a service account and grant it the roles/run.invoker Identity and Access Management (IAM) role. When you create a schedule and test it, a 403 Permission Denied error is returned in Cloud Logging. What should you do?

  • AGrant the service account the roles/run.developer IAM role.
  • BConfigure a cron job on the Compute Engine VMs to trigger Cloud Run on schedule.
  • CChange the Cloud Run ingress setting to 'Internal and Cloud Load Balancing.'
  • DUse Cloud Scheduler with Pub/Sub to invoke Cloud Run. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Use Cloud Scheduler with Pub/Sub to invoke Cloud Run.

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead. Pub/Sub is a serverless, global messaging service that decouples services and ingests high-volume event streams.

Topic 1 Β· Question 269

You work on an application that relies on Cloud Spanner as its main datastore. New application features have occasionally caused performance regressions. You want to prevent performance issues by running an automated performance test with Cloud Build for each commit made. If multiple commits are made at the same time, the tests might run concurrently. What should you do?

  • ACreate a new project with a random name for every build. Load the required data. Delete the project after the test is run.
  • BCreate a new Cloud Spanner instance for every build. Load the required data. Delete the Cloud Spanner instance after the test is run. (correct answer)
  • CCreate a project with a Cloud Spanner instance and the required data. Adjust the Cloud Build build file to automatically restore the data to its previous state after the test is run.
  • DStart the Cloud Spanner emulator locally. Load the required data. Shut down the emulator after the test is run.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Create a new Cloud Spanner instance for every build. Load the required data. Delete the Cloud Spanner instance after the test is run.

Explanation

Cloud Spanner is a horizontally scalable, strongly consistent relational database with global reach.

Topic 1 Β· Question 270

Your company's security team uses Identity and Access Management (IAM) to track which users have access to which resources. You need to create a version control system that can integrate with your security team's processes. You want your solution to support fast release cycles and frequent merges to your main branch to minimize merge conflicts. What should you do?

  • ACreate a Cloud Source Repositories repository, and use trunk-based development. (correct answer)
  • BCreate a Cloud Source Repositories repository, and use feature-based development.
  • CCreate a GitHub repository, mirror it to a Cloud Source Repositories repository, and use trunk-based development.
  • DCreate a GitHub repository, mirror it to a Cloud Source Repositories repository, and use feature-based development.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Create a Cloud Source Repositories repository, and use trunk-based development.

Topic 1 Β· Question 271

You recently developed an application that monitors a large number of stock prices. You need to configure Pub/Sub to receive messages and update the current stock price in an in-memory database. A downstream service needs the most up-to-date prices in the in-memory database to perform stock trading transactions. Each message contains three pieces or information: β€’ Stock symbol β€’ Stock price β€’ Timestamp for the update How should you set up your Pub/Sub subscription?

  • ACreate a push subscription with exactly-once delivery enabled.
  • BCreate a pull subscription with both ordering and exactly-once delivery turned off.
  • CCreate a pull subscription with ordering enabled, using the stock symbol as the ordering key. (correct answer)
  • DCreate a push subscription with both ordering and exactly-once delivery turned off.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Create a pull subscription with ordering enabled, using the stock symbol as the ordering key.

Topic 1 Β· Question 272

You are a developer at a social media company. The company runs their social media website on-premises and uses MySQL as a backend to store user profiles and user posts. Your company plans to migrate to Google Cloud, and your learn will migrate user profile information to Firestore. You are tasked with designing the Firestore collections. What should you do?

  • ACreate one root collection for user profiles, and create one root collection for user posts.
  • BCreate one root collection for user profiles, and create one subcollection for each user's posts. (correct answer)
  • CCreate one root collection for user profiles, and store each user's post as a nested list in the user profile document.
  • DCreate one root collection for user posts, and create one subcollection for each user's profile.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Create one root collection for user profiles, and create one subcollection for each user's posts.

Topic 1 Β· Question 273

Your team recently deployed an application on Google Kubernetes Engine (GKE). You are monitoring your application and want to be alerted when the average memory consumption of your containers is under 20% or above 80%. How should you configure the alerts?

  • ACreate a Cloud Function that consumes the Monitoring API. Create a schedule to trigger the Cloud Function hourly and alert you if the average memory consumption is outside the defined range.
  • BIn Cloud Monitoring, create an alerting policy to notify you if the average memory consumption is outside the defined range. (correct answer)
  • CCreate a Cloud Function that runs on a schedule, executes kubectl top on all the workloads on the cluster, and sends an email alert if the average memory consumption is outside the defined range.
  • DWrite a script that pulls the memory consumption of the instance at the OS level and sends an email alert if the average memory consumption is outside the defined range.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: In Cloud Monitoring, create an alerting policy to notify you if the average memory consumption is outside the defined range.

Explanation

Cloud Monitoring collects metrics, dashboards, and alerts to observe system health.

Topic 1 Β· Question 274

You manage a microservice-based ecommerce platform on Google Cloud that sends confirmation emails to a third-party email service provider using a Cloud Function. Your company just launched a marketing campaign, and some customers are reporting that they have not received order confirmation emails. You discover that the services triggering the Cloud Function are receiving HTTP 500 errors. You need to change the way emails are handled to minimize email loss. What should you do?

  • AIncrease the Cloud Function's timeout to nine minutes.
  • BConfigure the sender application to publish the outgoing emails in a message to a Pub/Sub topic. Update the Cloud Function configuration to consume the Pub/Sub queue. (correct answer)
  • CConfigure the sender application to write emails to Memorystore and then trigger the Cloud Function. When the function is triggered, it reads the email details from Memorystore and sends them to the email service.
  • DConfigure the sender application to retry the execution of the Cloud Function every one second if a request fails.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Configure the sender application to publish the outgoing emails in a message to a Pub/Sub topic. Update the Cloud Function configuration to consume the Pub/Sub queue.

Explanation

Pub/Sub is a serverless, global messaging service that decouples services and ingests high-volume event streams.

Topic 1 Β· Question 275

You have a web application that publishes messages to Pub/Sub. You plan to build new versions of the application locally and need to quickly test Pub/Sub integration for each new build. How should you configure local testing?

  • AIn the Google Cloud console, navigate to the API Library, and enable the Pub/Sub API. When developing locally configure your application to call pubsub.googleapis.com.
  • BInstall the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID. When developing locally, configure your applicat.cn to use the local emulator by exporting the PUBSUB_EMULATOR_HOST variable. (correct answer)
  • CRun the gcloud config set api_endpoint_overrides/pubsub https://pubsubemulator.googleapis.com.com/ command to change the Pub/Sub endpoint prior to starting the application.
  • DInstall Cloud Code on the integrated development environment (IDE). Navigate to Cloud APIs, and enable Pub/Sub against a valid Google Project IWhen developing locally, configure your application to call pubsub.googleapis.com.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Install the Pub/Sub emulator using gcloud, and start the emulator with a valid Google Project ID. When developing locally, configure your applicat.cn to use the local emulator by exporting the PUBSUB_EMULATOR_HOST var...

Explanation

Pub/Sub is a serverless, global messaging service that decouples services and ingests high-volume event streams.

Topic 1 Β· Question 276

You recently developed an application that monitors a large number of stock prices. You need to configure Pub/Sub to receive a high volume messages and update the current stock price in a single large in-memory database. A downstream service needs the most up-to-date prices in the in-memory database to perform stock trading transactions. Each message contains three pieces or information: β€’ Stock symbol β€’ Stock price β€’ Timestamp for the update How should you set up your Pub/Sub subscription?

  • ACreate a pull subscription with exactly-once delivery enabled.
  • BCreate a push subscription with both ordering and exactly-once delivery turned off.
  • CCreate a push subscription with exactly-once delivery enabled.
  • DCreate a pull subscription with both ordering and exactly-once delivery turned off. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Create a pull subscription with both ordering and exactly-once delivery turned off.

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

Your team has created an application that is hosted on a Google Kubemetes Engine (GKE) cluster. You need to connect the application to a legacy REST service that is deployed in two GKE clusters in two different regions. You want to connect your application to the legacy service in a way that is resilient and requires the fewest number of steps. You also want to be able to run probe-based health checks on the legacy service on a separate port. How should you set up the connection? (Choose two.)

  • AUse Traffic Director with a sidecar proxy to connect the application to the service. (correct answer)
  • BSet up a proxyless Traffic Director configuration for the application.
  • CConfigure the legacy service's firewall to allow health checks originating from the sidecar proxy. (correct answer)
  • DConfigure the legacy service's firewall to allow health checks originating from the application.
  • EConfigure the legacy service's firewall to allow health checks originating from the Traffic Director control plane.
Reveal answer & explanation
Correct answer: A, C

The correct answer is A, C. Option A: Use Traffic Director with a sidecar proxy to connect the application to the service. Option C: Configure the legacy service's firewall to allow health checks originating from the sidecar proxy. By spanning multiple Availability Zones / adding redundancy, this option provides the high availability and resilience required.

Topic 1 Β· Question 278

You are monitoring a web application that is written in Go and deployed in Google Kubernetes Engine. You notice an increase in CPU and memory utilization. You need to determine which function is consuming the most CPU and memory resources. What should you do?

  • AAdd print commands to the application source code to log when each function is called, and redeploy the application.
  • BCreate a Cloud Logging query that gathers the web application s logs. Write a Python script that calculates the difference between the timestamps from the beginning and the end of the application's longest functions to identify time-intensive functions.
  • CImport OpenTelemetry and Trace export packages into your application, and create the trace provider. Review the latency data for your application on the Trace overview page, and identify which functions cause the most latency.
  • DImport the Cloud Profiler package into your application, and initialize the Profiler agent. Review the generated flame graph in the Google Cloud console to identify time-intensive functions. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Import the Cloud Profiler package into your application, and initialize the Profiler agent. Review the generated flame graph in the Google Cloud console to identify time-intensive functions.

Explanation

Cloud Profiler continuously analyzes CPU and memory usage of production code.

Topic 1 Β· Question 280

You recently deployed an application to GKE where Pods are writing files to a Compute Engine persistent disk. You have created a PersistentVolumeClaim (PVC) and a PersistentVolume (PV) object on Kubernetes for the disk, and you reference the PVC in the deployment manifest file. You recently expanded the size of the persistent disk because the application has used up almost all of the disk space. You have logged on to one of the Pods, and you notice that the disk expansion is not visible in the container file system. What should you do?

  • ASet the spec.capacity.storage value of the PV object to match the size of the persistent disk. Apply the updated configuration by using kubectl.
  • BRecreate the application Pods by running the kubectl delete deployment DEPLOYMENT_NAME && kubectl apply deployment.yaml command, where the DEPLOYMENT_NAME parameter is the name of your deployment and deployment.yaml is its manifest file.
  • CSet the spec.resources.requests.storage value of the PVC object to match the size of the persistent disk. Apply the updated configuration by using kubectl. (correct answer)
  • DIn the Pod, resize the disk partition to the maximum value by using the fdisk or parted utility.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Set the spec.resources.requests.storage value of the PVC object to match the size of the persistent disk. Apply the updated configuration by using kubectl.

Explanation

Persistent Disk provides durable block storage attached to Compute Engine VMs.

Topic 1 Β· Question 281

You work for an ecommerce company. You are designing a new Orders API that will be exposed through Apigee. In your Apigee organization, you created two new environments named orders-test and orders-prod. You plan to use unique URLs named test.lnk-42.com/api/v1/orders and Ink-42.com/api/v1/orders for each environment. You need to ensure that each environment only uses the assigned URL. What should you do?

  • A1. Attach orders-test and orders-prod to the orders environment group.2. Add each hostname to the appropriate environment.
  • B1. Attach orders-test and orders-prod to the orders environment group.2. Add each hostname to the orders environment group.
  • C1. Attach orders-test to the test environment group, and attach orders-prod to the production environment group.2. Add each hostname to the appropriate environment.
  • D1. Attach orders-test to the test environment group, and attach orders-prod to the production environment group.2. Add each hostname to the appropriate environment group. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: 1. Attach orders-test to the test environment group, and attach orders-prod to the production environment group.2. Add each hostname to the appropriate environment group.

Showing questions 261–280 of 359 Β· Page 14 of 18