πŸ”

PCD β€” all questions

359 practice questions with answers and explanations.

Topic 1 Β· Question 1

You want to upload files from an on-premises virtual machine to Google Cloud Storage as part of a data migration. These files will be consumed by Cloud DataProc Hadoop cluster in a GCP environment. Which command should you use?

  • Agsutil cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/ (correct answer)
  • Bgcloud cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/
  • Chadoop fs cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/
  • Dgcloud dataproc cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: gsutil cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/.

Topic 1 Β· Question 2

You migrated your applications to Google Cloud Platform and kept your existing monitoring platform. You now find that your notification system is too slow for time critical problems. What should you do?

  • AReplace your entire monitoring platform with Stackdriver.
  • BInstall the Stackdriver agents on your Compute Engine instances.
  • CUse Stackdriver to capture and alert on logs, then ship them to your existing platform. (correct answer)
  • DMigrate some traffic back to your old platform and perform AB testing on the two platforms concurrently.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Use Stackdriver to capture and alert on logs, then ship them to your existing platform.

Explanation

Cloud Operations (formerly Stackdriver) provides monitoring, logging, and tracing for reliability.

Topic 1 Β· Question 3

You are planning to migrate a MySQL database to the managed Cloud SQL database for Google Cloud. You have Compute Engine virtual machine instances that will connect with this Cloud SQL instance. You do not want to whitelist IPs for the Compute Engine instances to be able to access Cloud SQL. What should you do?

  • AEnable private IP for the Cloud SQL instance. (correct answer)
  • BWhitelist a project to access Cloud SQL, and add Compute Engine instances in the whitelisted project.
  • CCreate a role in Cloud SQL that allows access to the database from external instances, and assign the Compute Engine instances to that role.
  • DCreate a CloudSQL instance on one project. Create Compute engine instances in a different project. Create a VPN between these two projects to allow internal access to CloudSQL.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Enable private IP for the Cloud SQL instance.

Explanation

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

Topic 1 Β· Question 4

You have deployed an HTTP(s) Load Balancer with the gcloud commands shown below. Health checks to port 80 on the Compute Engine virtual machine instance are failing and no traffic is sent to your instances. You want to resolve the problem. Which commands should you run?

  • Agcloud compute instances add-access-config ${NAME}-backend-instance-1
  • Bgcloud compute instances add-tags ${NAME}-backend-instance-1 --tags http-server
  • Cgcloud compute firewall-rules create allow-lb --network load-balancer --allow tcp --source-ranges 130.211.0.0/22,35.191.0.0/16 --direction INGRESS (correct answer)
  • Dgcloud compute firewall-rules create allow-lb --network load-balancer --allow tcp --destination-ranges 130.211.0.0/22,35.191.0.0/16 --direction EGRESS
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: gcloud compute firewall-rules create allow-lb --network load-balancer --allow tcp --source-ranges 130.211.0.0/22,35.191.0.0/16 --direction INGRESS.

Topic 1 Β· Question 5

Your website is deployed on Compute Engine. Your marketing team wants to test conversion rates between 3 different website designs. Which approach should you use?

  • ADeploy the website on App Engine and use traffic splitting. (correct answer)
  • BDeploy the website on App Engine as three separate services.
  • CDeploy the website on Cloud Functions and use traffic splitting.
  • DDeploy the website on Cloud Functions as three separate functions.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Deploy the website on App Engine and use traffic splitting.

Explanation

App Engine is a fully managed platform that runs and autoscales web apps with little operational effort.

Topic 1 Β· Question 6

You need to copy directory local-scripts and all of its contents from your local workstation to a Compute Engine virtual machine instance. Which command should you use?

  • Agsutil cp --project "my-gcp-project" -r ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone "us-east1-b"
  • Bgsutil cp --project "my-gcp-project" -R ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone "us-east1-b"
  • Cgcloud compute scp --project "my-gcp-project" --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone "us-east1-b" (correct answer)
  • Dgcloud compute mv --project "my-gcp-project" --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone "us-east1-b"
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: gcloud compute scp --project "my-gcp-project" --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone "us-east1-b".

Topic 1 Β· Question 7

You are deploying your application to a Compute Engine virtual machine instance with the Stackdriver Monitoring Agent installed. Your application is a unix process on the instance. You want to be alerted if the unix process has not run for at least 5 minutes. You are not able to change the application to generate metrics or logs. Which alert condition should you configure?

  • AUptime check
  • BProcess health
  • CMetric absence (correct answer)
  • DMetric threshold
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Metric absence.

Topic 1 Β· Question 8

You have two tables in an ANSI-SQL compliant database with identical columns that you need to quickly combine into a single table, removing duplicate rows from the result set. What should you do?

  • AUse the JOIN operator in SQL to combine the tables.
  • BUse nested WITH statements to combine the tables.
  • CUse the UNION operator in SQL to combine the tables. (correct answer)
  • DUse the UNION ALL operator in SQL to combine the tables.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Use the UNION operator in SQL to combine the tables.

Topic 1 Β· Question 9

You have an application deployed in production. When a new version is deployed, some issues don't arise until the application receives traffic from users in production. You want to reduce both the impact and the number of users affected. Which deployment strategy should you use?

  • ABlue/green deployment
  • BCanary deployment (correct answer)
  • CRolling deployment
  • DRecreate deployment
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Canary deployment.

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

Your company wants to expand their users outside the United States for their popular application. The company wants to ensure 99.999% availability of the database for their application and also wants to minimize the read latency for their users across the globe. Which two actions should they take? (Choose two.)

  • ACreate a multi-regional Cloud Spanner instance with "nam-asia-eur1" configuration. (correct answer)
  • BCreate a multi-regional Cloud Spanner instance with "nam3" configuration.
  • CCreate a cluster with at least 3 Spanner nodes. (correct answer)
  • DCreate a cluster with at least 1 Spanner node.
  • ECreate a minimum of two Cloud Spanner instances in separate regions with at least one node.
  • FCreate a Cloud Dataflow pipeline to replicate data across different databases.
Reveal answer & explanation
Correct answer: A, C

The correct answer is A, C. Option A: Create a multi-regional Cloud Spanner instance with "nam-asia-eur1" configuration. Option C: Create a cluster with at least 3 Spanner nodes.

Explanation

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

Topic 1 Β· Question 11

You need to migrate an internal file upload API with an enforced 500-MB file size limit to App Engine. What should you do?

  • AUse FTP to upload files.
  • BUse CPanel to upload files.
  • CUse signed URLs to upload files. (correct answer)
  • DChange the API to be a multipart file upload API.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Use signed URLs to upload files.

Topic 1 Β· Question 12

You are planning to deploy your application in a Google Kubernetes Engine (GKE) cluster. The application exposes an HTTP-based health check at /healthz. You want to use this health check endpoint to determine whether traffic should be routed to the pod by the load balancer. Which code snippet should you include in your Pod configuration? A. B. C. D.

  • A
  • B (correct answer)
  • C
  • D
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B:.

Topic 1 Β· Question 13

Your teammate has asked you to review the code below. Its purpose is to efficiently add a large number of small rows to a BigQuery table. Which improvement should you suggest your teammate make?

  • AInclude multiple rows with each request. (correct answer)
  • BPerform the inserts in parallel by creating multiple threads.
  • CWrite each row to a Cloud Storage object, then load into BigQuery.
  • DWrite each row to a Cloud Storage object in parallel, then load into BigQuery.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Include multiple rows with each request.

Topic 1 Β· Question 14

You are developing a JPEG image-resizing API hosted on Google Kubernetes Engine (GKE). Callers of the service will exist within the same GKE cluster. You want clients to be able to get the IP address of the service. What should you do?

  • ADefine a GKE Service. Clients should use the name of the A record in Cloud DNS to find the service's cluster IP address.
  • BDefine a GKE Service. Clients should use the service name in the URL to connect to the service. (correct answer)
  • CDefine a GKE Endpoint. Clients should get the endpoint name from the appropriate environment variable in the client container.
  • DDefine a GKE Endpoint. Clients should get the endpoint name from Cloud DNS.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Define a GKE Service. Clients should use the service name in the URL to connect to the service.

Explanation

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

Topic 1 Β· Question 15

You are using Cloud Build to build and test application source code stored in Cloud Source Repositories. The build process requires a build tool not available in the Cloud Build environment. What should you do?

  • ADownload the binary from the internet during the build process.
  • BBuild a custom cloud builder image and reference the image in your build steps. (correct answer)
  • CInclude the binary in your Cloud Source Repositories repository and reference it in your build scripts.
  • DAsk to have the binary added to the Cloud Build environment by filing a feature request against the Cloud Build public Issue Tracker.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Build a custom cloud builder image and reference the image in your build steps.

Explanation

Cloud Build runs managed CI pipelines to build, test, and package code.

Topic 1 Β· Question 16

You are deploying your application to a Compute Engine virtual machine instance. Your application is configured to write its log files to disk. You want to view the logs in Stackdriver Logging without changing the application code. What should you do?

  • AInstall the Stackdriver Logging Agent and configure it to send the application logs. (correct answer)
  • BUse a Stackdriver Logging Library to log directly from the application to Stackdriver Logging.
  • CProvide the log file folder path in the metadata of the instance to configure it to send the application logs.
  • DChange the application to log to /var/log so that its logs are automatically sent to Stackdriver Logging.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Install the Stackdriver Logging Agent and configure it to send the application logs.

Explanation

Cloud Operations (formerly Stackdriver) provides monitoring, logging, and tracing for reliability. This option needs the least custom development effort.

Topic 1 Β· Question 17

Your service adds text to images that it reads from Cloud Storage. During busy times of the year, requests to Cloud Storage fail with an HTTP 429 "Too Many Requests" status code. How should you handle this error?

  • AAdd a cache-control header to the objects.
  • BRequest a quota increase from the GCP Console.
  • CRetry the request with a truncated exponential backoff strategy. (correct answer)
  • DChange the storage class of the Cloud Storage bucket to Multi-regional.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Retry the request with a truncated exponential backoff strategy.

Topic 1 Β· Question 18

You are building an API that will be used by Android and iOS apps. The API must: * Support HTTPs * Minimize bandwidth cost * Integrate easily with mobile apps Which API architecture should you use?

  • ARESTful APIs
  • BMQTT for APIs
  • CgRPC-based APIs (correct answer)
  • DSOAP-based APIs
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: gRPC-based APIs.

Topic 1 Β· Question 19

Your application takes an input from a user and publishes it to the user's contacts. This input is stored in a table in Cloud Spanner. Your application is more sensitive to latency and less sensitive to consistency. How should you perform reads from Cloud Spanner for this application?

  • APerform Read-Only transactions.
  • BPerform stale reads using single-read methods. (correct answer)
  • CPerform strong reads using single-read methods.
  • DPerform stale reads using read-write transactions.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Perform stale reads using single-read methods.

Topic 1 Β· Question 20

Your application is deployed in a Google Kubernetes Engine (GKE) cluster. When a new version of your application is released, your CI/CD tool updates the spec.template.spec.containers[0].image value to reference the Docker image of your new application version. When the Deployment object applies the change, you want to deploy at least 1 replica of the new version and maintain the previous replicas until the new replica is healthy. Which change should you make to the GKE Deployment object shown below?

  • ASet the Deployment strategy to RollingUpdate with maxSurge set to 0, maxUnavailable set to 1.
  • BSet the Deployment strategy to RollingUpdate with maxSurge set to 1, maxUnavailable set to 0. (correct answer)
  • CSet the Deployment strategy to Recreate with maxSurge set to 0, maxUnavailable set to 1.
  • DSet the Deployment strategy to Recreate with maxSurge set to 1, maxUnavailable set to 0.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Set the Deployment strategy to RollingUpdate with maxSurge set to 1, maxUnavailable set to 0.

Showing questions 1–20 of 359 Β· Page 1 of 18