πŸ”

PCD β€” questions

Page 6 of 18 Β· 359 total questions.

Topic 1 Β· Question 101

You are developing a web application that will be accessible over both HTTP and HTTPS and will run on Compute Engine instances. On occasion, you will need to SSH from your remote laptop into one of the Compute Engine instances to conduct maintenance on the app. How should you configure the instances while following Google-recommended best practices?

  • ASet up a backend with Compute Engine web server instances with a private IP address behind a TCP proxy load balancer.
  • BConfigure the firewall rules to allow all ingress traffic to connect to the Compute Engine web servers, with each server having a unique external IP address.
  • CConfigure Cloud Identity-Aware Proxy API for SSH access. Then configure the Compute Engine servers with private IP addresses behind an HTTP(s) load balancer for the application web traffic. (correct answer)
  • DSet up a backend with Compute Engine web server instances with a private IP address behind an HTTP(S) load balancer. Set up a bastion host with a public IP address and open firewall ports. Connect to the web instances using the bastion host.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Configure Cloud Identity-Aware Proxy API for SSH access. Then configure the Compute Engine servers with private IP addresses behind an HTTP(s) load balancer for the application web traffic.

Explanation

Compute Engine provides configurable virtual machines when you need full control of the OS. A load balancer distributes traffic across healthy backends in multiple zones for availability and scale. Cloud Identity manages users, groups, and device policies as a managed identity platform.

Topic 1 Β· Question 102

You have a mixture of packaged and internally developed applications hosted on a Compute Engine instance that is running Linux. These applications write log records as text in local files. You want the logs to be written to Cloud Logging. What should you do?

  • APipe the content of the files to the Linux Syslog daemon.
  • BInstall a Google version of fluentd on the Compute Engine instance. (correct answer)
  • CInstall a Google version of collectd on the Compute Engine instance.
  • DUsing cron, schedule a job to copy the log files to Cloud Storage once a day.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Install a Google version of fluentd on the Compute Engine instance.

Explanation

Compute Engine provides configurable virtual machines when you need full control of the OS.

Topic 1 Β· Question 103

You want to create `fully baked` or `golden` Compute Engine images for your application. You need to bootstrap your application to connect to the appropriate database according to the environment the application is running on (test, staging, production). What should you do?

  • AEmbed the appropriate database connection string in the image. Create a different image for each environment.
  • BWhen creating the Compute Engine instance, add a tag with the name of the database to be connected. In your application, query the Compute Engine API to pull the tags for the current instance, and use the tag to construct the appropriate database connection string.
  • CWhen creating the Compute Engine instance, create a metadata item with a key of "DATABASE" and a value for the appropriate database connection string. In your application, read the "DATABASE" environment variable, and use the value to connect to the appropriate database.
  • DWhen creating the Compute Engine instance, create a metadata item with a key of "DATABASE" and a value for the appropriate database connection string. In your application, query the metadata server for the "DATABASE" value, and use the value to connect to the appropriate database. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: When creating the Compute Engine instance, create a metadata item with a key of "DATABASE" and a value for the appropriate database connection string. In your application, query the metadata server for the "DATABAS...

Explanation

Compute Engine provides configurable virtual machines when you need full control of the OS.

Topic 1 Β· Question 104

You are developing a microservice-based application that will be deployed on a Google Kubernetes Engine cluster. The application needs to read and write to a Spanner database. You want to follow security best practices while minimizing code changes. How should you configure your application to retrieve Spanner credentials?

  • AConfigure the appropriate service accounts, and use Workload Identity to run the pods. (correct answer)
  • BStore the application credentials as Kubernetes Secrets, and expose them as environment variables.
  • CConfigure the appropriate routing rules, and use a VPC-native cluster to directly connect to the database.
  • DStore the application credentials using Cloud Key Management Service, and retrieve them whenever a database connection is made.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Configure the appropriate service accounts, and use Workload Identity to run the pods.

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.

Topic 1 Β· Question 105

You are deploying your application on a Compute Engine instance that communicates with Cloud SQL. You will use Cloud SQL Proxy to allow your application to communicate to the database using the service account associated with the application's instance. You want to follow the Google-recommended best practice of providing minimum access for the role assigned to the service account. What should you do?

  • AAssign the Project Editor role.
  • BAssign the Project Owner role.
  • CAssign the Cloud SQL Client role. (correct answer)
  • DAssign the Cloud SQL Editor role.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Assign the Cloud SQL Client role.

Explanation

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

Topic 1 Β· Question 106

Your team develops stateless services that run on Google Kubernetes Engine (GKE). You need to deploy a new service that will only be accessed by other services running in the GKE cluster. The service will need to scale as quickly as possible to respond to changing load. What should you do?

  • AUse a Vertical Pod Autoscaler to scale the containers, and expose them via a ClusterIP Service.
  • BUse a Vertical Pod Autoscaler to scale the containers, and expose them via a NodePort Service.
  • CUse a Horizontal Pod Autoscaler to scale the containers, and expose them via a ClusterIP Service. (correct answer)
  • DUse a Horizontal Pod Autoscaler to scale the containers, and expose them via a NodePort Service.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Use a Horizontal Pod Autoscaler to scale the containers, and expose them via a ClusterIP Service.

Topic 1 Β· Question 107

You recently migrated a monolithic application to Google Cloud by breaking it down into microservices. One of the microservices is deployed using Cloud Functions. As you modernize the application, you make a change to the API of the service that is backward-incompatible. You need to support both existing callers who use the original API and new callers who use the new API. What should you do?

  • ALeave the original Cloud Function as-is and deploy a second Cloud Function with the new API. Use a load balancer to distribute calls between the versions.
  • BLeave the original Cloud Function as-is and deploy a second Cloud Function that includes only the changed API. Calls are automatically routed to the correct function.
  • CLeave the original Cloud Function as-is and deploy a second Cloud Function with the new API. Use Cloud Endpoints to provide an API gateway that exposes a versioned API. (correct answer)
  • DRe-deploy the Cloud Function after making code changes to support the new API. Requests for both versions of the API are fulfilled based on a version identifier included in the call.
Reveal answer & explanation
Correct answer: C

The correct answer is C. Option C: Leave the original Cloud Function as-is and deploy a second Cloud Function with the new API. Use Cloud Endpoints to provide an API gateway that exposes a versioned API.

Topic 1 Β· Question 108

You are developing an application that will allow users to read and post comments on news articles. You want to configure your application to store and display user-submitted comments using Firestore. How should you design the schema to support an unknown number of comments and articles?

  • AStore each comment in a subcollection of the article. (correct answer)
  • BAdd each comment to an array property on the article.
  • CStore each comment in a document, and add the comment's key to an array property on the article.
  • DStore each comment in a document, and add the comment's key to an array property on the user profile.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Store each comment in a subcollection of the article.

Topic 1 Β· Question 109

You recently developed an application. You need to call the Cloud Storage API from a Compute Engine instance that doesn't have a public IP address. What should you do?

  • AUse Carrier Peering
  • BUse VPC Network Peering
  • CUse Shared VPC networks
  • DUse Private Google Access (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Use Private Google Access

Explanation

Private Google Access lets internal instances reach Google APIs without external IPs.

Topic 1 Β· Question 110

You are a developer working with the CI/CD team to troubleshoot a new feature that your team introduced. The CI/CD team used HashiCorp Packer to create a new Compute Engine image from your development branch. The image was successfully built, but is not booting up. You need to investigate the issue with the CI/ CD team. What should you do?

  • ACreate a new feature branch, and ask the build team to rebuild the image.
  • BShut down the deployed virtual machine, export the disk, and then mount the disk locally to access the boot logs.
  • CInstall Packer locally, build the Compute Engine image locally, and then run it in your personal Google Cloud project.
  • DCheck Compute Engine OS logs using the serial port, and check the Cloud Logging logs to confirm access to the serial port. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Check Compute Engine OS logs using the serial port, and check the Cloud Logging logs to confirm access to the serial port.

Explanation

Compute Engine provides configurable virtual machines when you need full control of the OS. Cloud Logging centralizes, stores, and analyzes logs across services.

Topic 1 Β· Question 111

You manage an application that runs in a Compute Engine instance. You also have multiple backend services executing in stand-alone Docker containers running in Compute Engine instances. The Compute Engine instances supporting the backend services are scaled by managed instance groups in multiple regions. You want your calling application to be loosely coupled. You need to be able to invoke distinct service implementations that are chosen based on the value of an HTTP header found in the request. Which Google Cloud feature should you use to invoke the backend services?

  • ATraffic Director (correct answer)
  • BService Directory
  • CAnthos Service Mesh
  • DInternal HTTP(S) Load Balancing
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: Traffic Director This option decouples the components so they scale independently and absorb load spikes.

Topic 1 Β· Question 112

Your team is developing an ecommerce platform for your company. Users will log in to the website and add items to their shopping cart. Users will be automatically logged out after 30 minutes of inactivity. When users log back in, their shopping cart should be saved. How should you store users' session and shopping cart information while following Google-recommended best practices?

  • AStore the session information in Pub/Sub, and store the shopping cart information in Cloud SQL.
  • BStore the shopping cart information in a file on Cloud Storage where the filename is the SESSION ID.
  • CStore the session and shopping cart information in a MySQL database running on multiple Compute Engine instances.
  • DStore the session information in Memorystore for Redis or Memorystore for Memcached, and store the shopping cart information in Firestore. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Store the session information in Memorystore for Redis or Memorystore for Memcached, and store the shopping cart information in Firestore.

Explanation

Firestore is a serverless, autoscaling NoSQL document database ideal for app and user data. Memorystore provides managed in-memory Redis/Memcached caching to reduce latency and offload databases.

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

You are designing a resource-sharing policy for applications used by different teams in a Google Kubernetes Engine cluster. You need to ensure that all applications can access the resources needed to run. What should you do? (Choose two.)

  • ASpecify the resource limits and requests in the object specifications.
  • BCreate a namespace for each team, and attach resource quotas to each namespace. (correct answer)
  • CCreate a LimitRange to specify the default compute resource requirements for each namespace. (correct answer)
  • DCreate a Kubernetes service account (KSA) for each application, and assign each KSA to the namespace.
  • EUse the Anthos Policy Controller to enforce label annotations on all namespaces. Use taints and tolerations to allow resource sharing for namespaces.
Reveal answer & explanation
Correct answer: B, C

The correct answer is B, C. Option B: Create a namespace for each team, and attach resource quotas to each namespace. Option C: Create a LimitRange to specify the default compute resource requirements for each namespace.

Topic 1 Β· Question 114

You are developing a new application that has the following design requirements: β€’ Creation and changes to the application infrastructure are versioned and auditable. β€’ The application and deployment infrastructure uses Google-managed services as much as possible. β€’ The application runs on a serverless compute platform. How should you design the application's architecture?

  • A1. Store the application and infrastructure source code in a Git repository. 2. Use Cloud Build to deploy the application infrastructure with Terraform. 3. Deploy the application to a Cloud Function as a pipeline step. (correct answer)
  • B1. Deploy Jenkins from the Google Cloud Marketplace, and define a continuous integration pipeline in Jenkins. 2. Configure a pipeline step to pull the application source code from a Git repository. 3. Deploy the application source code to App Engine as a pipeline step.
  • C1. Create a continuous integration pipeline on Cloud Build, and configure the pipeline to deploy the application infrastructure using Deployment Manager templates. 2. Configure a pipeline step to create a container with the latest application source code. 3. Deploy the container to a Compute Engine instance as a pipeline step.
  • D1. Deploy the application infrastructure using gcloud commands. 2. Use Cloud Build to define a continuous integration pipeline for changes to the application source code. 3. Configure a pipeline step to pull the application source code from a Git repository, and create a containerized application. 4. Deploy the new container on Cloud Run as a pipeline step.
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: 1. Store the application and infrastructure source code in a Git repository. 2. Use Cloud Build to deploy the application infrastructure with Terraform. 3. Deploy the application to a Cloud Function as a pipeline step.

Explanation

Cloud Build runs managed CI pipelines to build, test, and package code. Terraform provisions Google Cloud infrastructure as code repeatably.

Topic 1 Β· Question 115

You are creating and running containers across different projects in Google Cloud. The application you are developing needs to access Google Cloud services from within Google Kubernetes Engine (GKE). What should you do?

  • AAssign a Google service account to the GKE nodes.
  • BUse a Google service account to run the Pod with Workload Identity. (correct answer)
  • CStore the Google service account credentials as a Kubernetes Secret.
  • DUse a Google service account with GKE role-based access control (RBAC).
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Use a Google service account to run the Pod with Workload Identity.

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.

Topic 1 Β· Question 116

You have containerized a legacy application that stores its configuration on an NFS share. You need to deploy this application to Google Kubernetes Engine (GKE) and do not want the application serving traffic until after the configuration has been retrieved. What should you do?

  • AUse the gsutil utility to copy files from within the Docker container at startup, and start the service using an ENTRYPOINT script.
  • BCreate a PersistentVolumeClaim on the GKE cluster. Access the configuration files from the volume, and start the service using an ENTRYPOINT script. (correct answer)
  • CUse the COPY statement in the Dockerfile to load the configuration into the container image. Verify that the configuration is available, and start the service using an ENTRYPOINT script.
  • DAdd a startup script to the GKE instance group to mount the NFS share at node startup. Copy the configuration files into the container, and start the service using an ENTRYPOINT script.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Create a PersistentVolumeClaim on the GKE cluster. Access the configuration files from the volume, and start the service using an ENTRYPOINT script.

Explanation

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

Topic 1 Β· Question 117

Your team is developing a new application using a PostgreSQL database and Cloud Run. You are responsible for ensuring that all traffic is kept private on Google Cloud. You want to use managed services and follow Google-recommended best practices. What should you do?

  • A1. Enable Cloud SQL and Cloud Run in the same project. 2. Configure a private IP address for Cloud SQL. Enable private services access. 3. Create a Serverless VPC Access connector. 4. Configure Cloud Run to use the connector to connect to Cloud SQL. (correct answer)
  • B1. Install PostgreSQL on a Compute Engine virtual machine (VM), and enable Cloud Run in the same project. 2. Configure a private IP address for the VM. Enable private services access. 3. Create a Serverless VPC Access connector. 4. Configure Cloud Run to use the connector to connect to the VM hosting PostgreSQL.
  • C1. Use Cloud SQL and Cloud Run in different projects. 2. Configure a private IP address for Cloud SQL. Enable private services access. 3. Create a Serverless VPC Access connector. 4. Set up a VPN connection between the two projects. Configure Cloud Run to use the connector to connect to Cloud SQL.
  • D1. Install PostgreSQL on a Compute Engine VM, and enable Cloud Run in different projects. 2. Configure a private IP address for the VM. Enable private services access. 3. Create a Serverless VPC Access connector. 4. Set up a VPN connection between the two projects. Configure Cloud Run to use the connector to access the VM hosting PostgreSQL
Reveal answer & explanation
Correct answer: A

The correct answer is A. Option A: 1. Enable Cloud SQL and Cloud Run in the same project. 2. Configure a private IP address for Cloud SQL. Enable private services access. 3. Create a Serverless VPC Access connector. 4. Configure Cloud Run to use the co...

Explanation

Cloud Run runs stateless containers serverlessly and scales to zero, minimizing operational overhead. Cloud SQL is a managed relational database (MySQL/PostgreSQL/SQL Server) that handles patching, backups, and failover. A VPC provides a global, software-defined private network for your Google Cloud resources.

Topic 1 Β· Question 118

You are developing an application that will allow clients to download a file from your website for a specific period of time. How should you design the application to complete this task while following Google-recommended best practices?

  • AConfigure the application to send the file to the client as an email attachment.
  • BGenerate and assign a Cloud Storage-signed URL for the file. Make the URL available for the client to download. (correct answer)
  • CCreate a temporary Cloud Storage bucket with time expiration specified, and give download permissions to the bucket. Copy the file, and send it to the client.
  • DGenerate the HTTP cookies with time expiration specified. If the time is valid, copy the file from the Cloud Storage bucket, and make the file available for the client to download.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Generate and assign a Cloud Storage-signed URL for the file. Make the URL available for the client to download.

Explanation

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

Topic 1 Β· Question 119

Your development team has been asked to refactor an existing monolithic application into a set of composable microservices. Which design aspects should you implement for the new application? (Choose two.)

  • ADevelop the microservice code in the same programming language used by the microservice caller.
  • BCreate an API contract agreement between the microservice implementation and microservice caller. (correct answer)
  • CRequire asynchronous communications between all microservice implementations and microservice callers.
  • DEnsure that sufficient instances of the microservice are running to accommodate the performance requirements.
  • EImplement a versioning scheme to permit future changes that could be incompatible with the current interface.
Reveal answer & explanation
Correct answer: B

The correct answer is B. Option B: Create an API contract agreement between the microservice implementation and microservice caller.

Topic 1 Β· Question 120

You deployed a new application to Google Kubernetes Engine and are experiencing some performance degradation. Your logs are being written to Cloud Logging, and you are using a Prometheus sidecar model for capturing metrics. You need to correlate the metrics and data from the logs to troubleshoot the performance issue and send real-time alerts while minimizing costs. What should you do?

  • ACreate custom metrics from the Cloud Logging logs, and use Prometheus to import the results using the Cloud Monitoring REST API.
  • BExport the Cloud Logging logs and the Prometheus metrics to Cloud Bigtable. Run a query to join the results, and analyze in Google Data Studio.
  • CExport the Cloud Logging logs and stream the Prometheus metrics to BigQuery. Run a recurring query to join the results, and send notifications using Cloud Tasks.
  • DExport the Prometheus metrics and use Cloud Monitoring to view them as external metrics. Configure Cloud Monitoring to create log-based metrics from the logs, and correlate them with the Prometheus data. (correct answer)
Reveal answer & explanation
Correct answer: D

The correct answer is D. Option D: Export the Prometheus metrics and use Cloud Monitoring to view them as external metrics. Configure Cloud Monitoring to create log-based metrics from the logs, and correlate them with the Prometheus data.

Explanation

Cloud Monitoring collects metrics, dashboards, and alerts to observe system health. This option meets the real-time / low-latency performance requirement.

Showing questions 101–120 of 359 Β· Page 6 of 18