πŸ”

PCD β€” questions

Page 12 of 18 Β· 359 total questions.

Topic 1 Β· Question 221

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 source code is consuming the most CPU and memory resources. What should you do?

  • ADownload, install, and start the Snapshot Debugger agent in your VM. Take debug snapshots of the functions that take the longest time. Review the call stack frame, and identify the local variables at that level in the stack.
  • BImport 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)
  • 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 where bottlenecks are occurring.
  • DCreate 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 identity time-intensive functions.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: 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 222

You have a container deployed on Google Kubernetes Engine. The container can sometimes be slow to launch, so you have implemented a liveness probe. You notice that the liveness probe occasionally fails on launch. What should you do?

  • AAdd a startup probe. (correct answer)
  • BIncrease the initial delay for the liveness probe.
  • CIncrease the CPU limit for the container.
  • DAdd a readiness probe.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Add a startup probe.

Topic 1 Β· Question 223

You work for an organization that manages an ecommerce site. Your application is deployed behind a global HTTP(S) load balancer. You need to test a new product recommendation algorithm. You plan to use A/B testing to determine the new algorithm’s effect on sales in a randomized way. How should you test this feature?

  • ASplit traffic between versions using weights. (correct answer)
  • BEnable the new recommendation feature flag on a single instance.
  • CMirror traffic to the new version of your application.
  • DUse HTTP header-based routing.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Split traffic between versions using weights.

Topic 1 Β· Question 224

You plan to deploy a new application revision with a Deployment resource to Google Kubernetes Engine (GKE) in production. The container might not work correctly. You want to minimize risk in case there are issues after deploying the revision. You want to follow Google-recommended best practices. What should you do?

  • APerform a rolling update with a PodDisruptionBudget of 80%. (correct answer)
  • BPerform a rolling update with a HorizontalPodAutoscaler scale-down policy value of 0.
  • CConvert the Deployment to a StatefulSet, and perform a rolling update with a PodDisruptionBudget of 80%.
  • DConvert the Deployment to a StatefulSet, and perform a rolling update with a HorizontalPodAutoscaler scale-down policy value of 0.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Perform a rolling update with a PodDisruptionBudget of 80%.

Topic 1 Β· Question 225

Before promoting your new application code to production, you want to conduct testing across a variety of different users. Although this plan is risky, you want to test the new version of the application with production users and you want to control which users are forwarded to the new version of the application based on their operating system. If bugs are discovered in the new version, you want to roll back the newly deployed version of the application as quickly as possible. What should you do?

  • ADeploy your application on Cloud Run. Use traffic splitting to direct a subset of user traffic to the new version based on the revision tag.
  • BDeploy your application on Google Kubernetes Engine with Anthos Service Mesh. Use traffic splitting to direct a subset of user traffic to the new version based on the user-agent header. (correct answer)
  • CDeploy your application on App Engine. Use traffic splitting to direct a subset of user traffic to the new version based on the IP address.
  • DDeploy your application on Compute Engine. Use Traffic Director to direct a subset of user traffic to the new version based on predefined weights.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Deploy your application on Google Kubernetes Engine with Anthos Service Mesh. Use traffic splitting to direct a subset of user traffic to the new version based on the user-agent header.

Explanation

Google Kubernetes Engine runs managed Kubernetes for containerized workloads. Anthos runs and manages Kubernetes workloads consistently across on-premises and clouds.

Topic 1 Β· Question 226

Your team is writing a backend application to implement the business logic for an interactive voice response (IVR) system that will support a payroll application. The IVR system has the following technical characteristics: β€’ Each customer phone call is associated with a unique IVR session. β€’ The IVR system creates a separate persistent gRPC connection to the backend for each session. β€’ If the connection is interrupted, the IVR system establishes a new connection, causing a slight latency for that call. You need to determine which compute environment should be used to deploy the backend application. Using current call data, you determine that: β€’ Call duration ranges from 1 to 30 minutes. β€’ Calls are typically made during business hours. β€’ There are significant spikes of calls around certain known dates (e.g., pay days), or when large payroll changes occur. You want to minimize cost, effort, and operational overhead. Where should you deploy the backend application?

  • ACompute Engine
  • BGoogle Kubernetes Engine cluster in Standard mode
  • CCloud Functions
  • DCloud Run (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Cloud Run

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead. This option delivers the requirement at the lowest cost.

Topic 1 Β· Question 227

You are developing an application hosted on Google Cloud that uses a MySQL relational database schema. The application will have a large volume of reads and writes to the database and will require backups and ongoing capacity planning. Your team does not have time to fully manage the database but can take on small administrative tasks. How should you host the database?

  • AConfigure Cloud SQL to host the database, and import the schema into Cloud SQL. (correct answer)
  • BDeploy MySQL from the Google Cloud Marketplace to the database using a client, and import the schema.
  • CConfigure Bigtable to host the database, and import the data into Bigtable.
  • DConfigure Cloud Spanner to host the database, and import the schema into Cloud Spanner.
  • EConfigure Firestore to host the database, and import the data into Firestore.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Configure Cloud SQL to host the database, and import the schema into Cloud SQL.

Explanation

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

Topic 1 Β· Question 228

You are developing a new web application using Cloud Run and committing code to Cloud Source Repositories. You want to deploy new code in the most efficient way possible. You have already created a Cloud Build YAML file that builds a container and runs the following command: gcloud run deploy. What should you do next?

  • ACreate a Pub/Sub topic to be notified when code is pushed to the repository. Create a Pub/Sub trigger that runs the build file when an event is published to the topic.
  • BCreate a build trigger that runs the build file in response to a repository code being pushed to the development branch. (correct answer)
  • CCreate a webhook build trigger that runs the build file in response to HTTP POST calls to the webhook URL.
  • DCreate a Cron job that runs the following command every 24 hours: gcloud builds submit.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Create a build trigger that runs the build file in response to a repository code being pushed to the development branch.

Topic 1 Β· Question 229

You are a developer at a large organization. You are deploying a web application to Google Kubernetes Engine (GKE). The DevOps team has built a CI/CD pipeline that uses Cloud Deploy to deploy the application to Dev, Test, and Prod clusters in GKE. After Cloud Deploy successfully deploys the application to the Dev cluster, you want to automatically promote it to the Test cluster. How should you configure this process following Google-recommended best practices?

  • A1. Create a Cloud Build trigger that listens for SUCCEEDED Pub/Sub messages from the clouddeploy-operations topic.2. Configure Cloud Build to include a step that promotes the application to the Test cluster. (correct answer)
  • B1. Create a Cloud Function that calls the Google Cloud Deploy API to promote the application to the Test cluster.2. Configure this function to be triggered by SUCCEEDED Pub/Sub messages from the cloud-builds topic.
  • C1. Create a Cloud Function that calls the Google Cloud Deploy API to promote the application to the Test cluster.2. Configure this function to be triggered by SUCCEEDED Pub/Sub messages from the clouddeploy-operations topic.
  • D1. Create a Cloud Build pipeline that uses the gke-deploy builder.2. Create a Cloud Build trigger that listens for SUCCEEDED Pub/Sub messages from the cloud-builds topic.3. Configure this pipeline to run a deployment step to the Test cluster.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: 1. Create a Cloud Build trigger that listens for SUCCEEDED Pub/Sub messages from the clouddeploy-operations topic.2. Configure Cloud Build to include a step that promotes the application to the Test cluster.

Explanation

Pub/Sub is a serverless, global messaging service that decouples services and ingests high-volume event streams. Cloud Build runs managed CI pipelines to build, test, and package code.

Topic 1 Β· Question 230

Your application is running as a container in a Google Kubernetes Engine cluster. You need to add a secret to your application using a secure approach. What should you do?

  • ACreate a Kubernetes Secret, and pass the Secret as an environment variable to the container.
  • BEnable Application-layer Secret Encryption on the cluster using a Cloud Key Management Service (KMS) key.
  • CStore the credential in Cloud KMS. Create a Google service account (GSA) to read the credential from Cloud KMS. Export the GSA as a .json file, and pass the .json file to the container as a volume which can read the credential from Cloud KMS.
  • DStore the credential in Secret Manager. Create a Google service account (GSA) to read the credential from Secret Manager. Create a Kubernetes service account (KSA) to run the container. Use Workload Identity to configure your KSA to act as a GSA. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Store the credential in Secret Manager. Create a Google service account (GSA) to read the credential from Secret Manager. Create a Kubernetes service account (KSA) to run the container. Use Workload Identity to config...

Explanation

Workload Identity Federation lets workloads access Google Cloud without long-lived service account keys. A service account provides an identity for workloads to access Google Cloud APIs securely. Secret Manager stores and controls access to secrets such as API keys and credentials.

Topic 1 Β· Question 231

You are a developer at a financial institution. You use Cloud Shell to interact with Google Cloud services. User data is currently stored on an ephemeral disk; however, a recently passed regulation mandates that you can no longer store sensitive information on an ephemeral disk. You need to implement a new storage solution for your user data. You want to minimize code changes. Where should you store your user data?

  • AStore user data on a Cloud Shell home disk, and log in at least every 120 days to prevent its deletion.
  • BStore user data on a persistent disk in a Compute Engine instance. (correct answer)
  • CStore user data in a Cloud Storage bucket.
  • DStore user data in BigQuery tables.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Store user data on a persistent disk in a Compute Engine instance.

Explanation

Compute Engine provides configurable virtual machines when you need full control of the OS. Persistent Disk provides durable block storage attached to Compute Engine VMs.

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

You recently developed a web application to transfer log data to a Cloud Storage bucket daily. Authenticated users will regularly review logs from the prior two weeks for critical events. After that, logs will be reviewed once annually by an external auditor. Data must be stored for a period of no less than 7 years. You want to propose a storage solution that meets these requirements and minimizes costs. What should you do? (Choose two.)

  • AUse the Bucket Lock feature to set the retention policy on the data. (correct answer)
  • BRun a scheduled job to set the storage class to Coldline for objects older than 14 days.
  • CCreate a JSON Web Token (JWT) for users needing access to the Coldline storage buckets.
  • DCreate a lifecycle management policy to set the storage class to Coldline for objects older than 14 days. (correct answer)
  • ECreate a lifecycle management policy to set the storage class to Nearline for objects older than 14 days.
Reveal answer & explanation
Correct answer: A, D

The correct answer is A, D. Option A: Use the Bucket Lock feature to set the retention policy on the data. Option D: Create a lifecycle management policy to set the storage class to Coldline for objects older than 14 days.

Topic 1 Β· Question 233

Your team is developing a Cloud Function triggered by Cloud Storage events. You want to accelerate testing and development of your Cloud Function while following Google-recommended best practices. What should you do?

  • ACreate a new Cloud Function that is triggered when Cloud Audit Logs detects the cloudfunctions.functions.sourceCodeSet operation in the original Cloud Function. Send mock requests to the new function to evaluate the functionality.
  • BMake a copy of the Cloud Function, and rewrite the code to be HTTP-triggered. Edit and test the new version by triggering the HTTP endpoint. Send mock requests to the new function to evaluate the functionality.
  • CInstall the Functions Frameworks library, and configure the Cloud Function on localhost. Make a copy of the function, and make edits to the new version. Test the new version using curl. (correct answer)
  • DMake a copy of the Cloud Function in the Google Cloud console. Use the Cloud console's in-line editor to make source code changes to the new function. Modify your web application to call the new function, and test the new version in production
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Install the Functions Frameworks library, and configure the Cloud Function on localhost. Make a copy of the function, and make edits to the new version. Test the new version using curl.

Topic 1 Β· Question 234

Your team is setting up a build pipeline for an application that will run in Google Kubernetes Engine (GKE). For security reasons, you only want images produced by the pipeline to be deployed to your GKE cluster. Which combination of Google Cloud services should you use?

  • ACloud Build, Cloud Storage, and Binary Authorization
  • BGoogle Cloud Deploy, Cloud Storage, and Google Cloud Armor
  • CGoogle Cloud Deploy, Artifact Registry, and Google Cloud Armor
  • DCloud Build, Artifact Registry, and Binary Authorization (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Cloud Build, Artifact Registry, and Binary Authorization

Explanation

Cloud Build runs managed CI pipelines to build, test, and package code. Artifact Registry stores and manages container images and language packages.

Topic 1 Β· Question 235

You are supporting a business-critical application in production deployed on Cloud Run. The application is reporting HTTP 500 errors that are affecting the usability of the application. You want to be alerted when the number of errors exceeds 15% of the requests within a specific time window. What should you do?

  • ACreate a Cloud Function that consumes the Cloud Monitoring API. Use Cloud Scheduler to trigger the Cloud Function daily and alert you if the number of errors is above the defined threshold.
  • BNavigate to the Cloud Run page in the Google Cloud console, and select the service from the services list. Use the Metrics tab to visualize the number of errors for that revision, and refresh the page daily.
  • CCreate an alerting policy in Cloud Monitoring that alerts you if the number of errors is above the defined threshold. (correct answer)
  • DCreate a Cloud Function that consumes the Cloud Monitoring API. Use Cloud Composer to trigger the Cloud Function daily and alert you if the number of errors is above the defined threshold.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Create an alerting policy in Cloud Monitoring that alerts you if the number of errors is above the defined threshold.

Explanation

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

Topic 1 Β· Question 236

You need to build a public API that authenticates, enforces quotas, and reports metrics for API callers. Which tool should you use to complete this architecture?

Exhibit 1 for question 236
  • AApp Engine
  • BCloud Endpoints (correct answer)
  • CIdentity-Aware Proxy
  • DGKE Ingress for HTTP(S) Load Balancing
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Cloud Endpoints.

Topic 1 Β· Question 237

You noticed that your application was forcefully shut down during a Deployment update in Google Kubernetes Engine. Your application didn’t close the database connection before it was terminated. You want to update your application to make sure that it completes a graceful shutdown. What should you do?

  • AUpdate your code to process a received SIGTERM signal to gracefully disconnect from the database. (correct answer)
  • BConfigure a PodDisruptionBudget to prevent the Pod from being forcefully shut down.
  • CIncrease the terminationGracePeriodSeconds for your application.
  • DConfigure a PreStop hook to shut down your application.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Update your code to process a received SIGTERM signal to gracefully disconnect from the database.

Topic 1 Β· Question 238

You are a lead developer working on a new retail system that runs on Cloud Run and Firestore in Datastore mode. A web UI requirement is for the system to display a list of available products when users access the system and for the user to be able to browse through all products. You have implemented this requirement in the minimum viable product (MVP) phase by returning a list of all available products stored in Firestore. A few months after go-live, you notice that Cloud Run instances are terminated with HTTP 500: Container instances are exceeding memory limits errors during busy times. This error coincides with spikes in the number of Datastore entity reads. You need to prevent Cloud Run from crashing and decrease the number of Datastore entity reads. You want to use a solution that optimizes system performance. What should you do?

  • AModify the query that returns the product list using integer offsets.
  • BModify the query that returns the product list using limits.
  • CModify the Cloud Run configuration to increase the memory limits.
  • DModify the query that returns the product list using cursors. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Modify the query that returns the product list using cursors. This option decouples the components so they scale independently and absorb load spikes.

Topic 1 Β· Question 239

You need to deploy an internet-facing microservices application to Google Kubernetes Engine (GKE). You want to validate new features using the A/B testing method. You have the following requirements for deploying new container image releases: β€’ There is no downtime when new container images are deployed. β€’ New production releases are tested and verified using a subset of production users. What should you do?

  • A1. Configure your CI/CD pipeline to update the Deployment manifest file by replacing the container version with the latest version.2. Recreate the Pods in your cluster by applying the Deployment manifest file.3. Validate the application's performance by comparing its functionality with the previous release version, and roll back if an issue arises.
  • B1. Create a second namespace on GKE for the new release version.2. Create a Deployment configuration for the second namespace with the desired number of Pods.3. Deploy new container versions in the second namespace.4. Update the Ingress configuration to route traffic to the namespace with the new container versions. (correct answer)
  • C1. Install the Anthos Service Mesh on your GKE cluster.2. Create two Deployments on the GKE cluster, and label them with different version names.3. Implement an Istio routing rule to send a small percentage of traffic to the Deployment that references the new version of the application.
  • D1. Implement a rolling update pattern by replacing the Pods gradually with the new release version.2. Validate the application's performance for the new subset of users during the rollout, and roll back if an issue arises.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: 1. Create a second namespace on GKE for the new release version.2. Create a Deployment configuration for the second namespace with the desired number of Pods.3. Deploy new container versions in the second namespace.4....

Explanation

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

Topic 1 Β· Question 240

Your team manages a large Google Kubernetes Engine (GKE) cluster. Several application teams currently use the same namespace to develop microservices for the cluster. Your organization plans to onboard additional teams to create microservices. You need to configure multiple environments while ensuring the security and optimal performance of each team’s work. You want to minimize cost and follow Google-recommended best practices. What should you do?

  • ACreate new role-based access controls (RBAC) for each team in the existing cluster, and define resource quotas.
  • BCreate a new namespace for each environment in the existing cluster, and define resource quotas.
  • CCreate a new GKE cluster for each team.
  • DCreate a new namespace for each team in the existing cluster, and define resource quotas. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Create a new namespace for each team in the existing cluster, and define resource quotas. This option delivers the requirement at the lowest cost.

Showing questions 221–240 of 359 Β· Page 12 of 18