Google

Professional Cloud Developer Free Practice Questions — Page 17

Question 161

Case study - This is a case study. Case studies are not timed separately. You can use as much exam time as you would like to complete each case. However, there may be additional case studies and sections on this exam. You must manage your time to ensure that you are able to complete all questions included on this exam in the time provided. To answer the questions included in a case study, you will need to reference information that is provided in the case study. Case studies might contain exhibits and other resources that provide more information about the scenario that is described in the case study. Each question is independent of the other questions in this case study. At the end of this case study, a review screen will appear. This screen allows you to review your answers and to make changes before you move to the next section of the exam. After you begin a new section, you cannot return to this section. To start the case study - To display the first question in this case study, click the Next button. Use the buttons in the left pane to explore the content of the case study before you answer the questions. Clicking these buttons displays information such as business requirements, existing environment, and problem statements. If the case study has an All Information tab, note that the information displayed is identical to the information displayed on the subsequent tabs. When you are ready to answer a question, click the Question button to return to the question. Company Overview - HipLocal is a community application designed to facilitate communication between people in close proximity. It is used for event planning and organizing sporting events, and for businesses to connect with their local communities. HipLocal launched recently in a few neighborhoods in Dallas and is rapidly growing into a global phenomenon. Its unique style of hyper-local community communication and business outreach is in demand around the world. Executive Statement - We are the number one local community app; it's time to take our local community services global. Our venture capital investors want to see rapid growth and the same great experience for new local and virtual communities that come online, whether their members are 10 or 10000 miles away from each other. Solution Concept - HipLocal wants to expand their existing service, with updated functionality, in new regions to better serve their global customers. They want to hire and train a new team to support these regions in their time zones. They will need to ensure that the application scales smoothly and provides clear uptime data, and that they analyze and respond to any issues that occur. Existing Technical Environment - HipLocal's environment is a mix of on-premises hardware and infrastructure running in Google Cloud Platform. The HipLocal team understands their application well, but has limited experience in global scale applications. Their existing technical environment is as follows: • Existing APIs run on Compute Engine virtual machine instances hosted in GCP. • State is stored in a single instance MySQL database in GCP. • Release cycles include development freezes to allow for QA testing. • The application has no logging. • Applications are manually deployed by infrastructure engineers during periods of slow traffic on weekday evenings. • There are basic indicators of uptime; alerts are frequently fired when the APIs are unresponsive. Business Requirements - HipLocal's investors want to expand their footprint and support the increase in demand they are seeing. Their requirements are: • Expand availability of the application to new regions. • Support 10x as many concurrent users. • Ensure a consistent experience for users when they travel to different regions. • Obtain user activity metrics to better understand how to monetize their product. • Ensure compliance with regulations in the new regions (for example, GDPR). • Reduce infrastructure management time and cost. • Adopt the Google-recommended practices for cloud computing. ○ Develop standardized workflows and processes around application lifecycle management. ○ Define service level indicators (SLIs) and service level objectives (SLOs). Technical Requirements - • Provide secure communications between the on-premises data center and cloud-hosted applications and infrastructure. • The application must provide usage metrics and monitoring. • APIs require authentication and authorization. • Implement faster and more accurate validation of new features. • Logging and performance metrics must provide actionable information to be able to provide debugging information and alerts. • Must scale to meet user demand. For this question, refer to the HipLocal case study. A recent security audit discovers that HipLocal’s database credentials for their Compute Engine-hosted MySQL databases are stored in plain text on persistent disks. HipLocal needs to reduce the risk of these credentials being stolen. What should they do?

A. Create a service account and download its key. Use the key to authenticate to Cloud Key Management Service (KMS) to obtain the database credentials.
B. Create a service account and download its key. Use the key to authenticate to Cloud Key Management Service (KMS) to obtain a key used to decrypt the database credentials.
C. Create a service account and grant it the roles/iam.serviceAccountUser role. Impersonate as this account and authenticate using the Cloud SQL Proxy.
D. Grant the roles/secretmanager.secretAccessor role to the Compute Engine service account. Store and access the database credentials with the Secret Manager API.
Show Answer
Correct Answer: D
Explanation:
The recommended Google Cloud approach is to store sensitive credentials in Secret Manager and grant the Compute Engine service account only the Secret Manager Secret Accessor role needed to retrieve them at runtime. This avoids storing database credentials in plaintext on persistent disks and avoids downloading and managing long-lived service account keys. Options A and B rely on downloaded service account keys, which are discouraged, and C is unrelated to protecting MySQL credentials stored on disk.

Question 162

You are building a highly available and globally accessible application that will serve static content to users. You need to configure the storage and serving components. You want to minimize management overhead and latency while maximizing reliability for users. What should you do?

A. 1. Create a managed instance group. Replicate the static content across the virtual machines (VMs) 2. Create an external HTTP(S) load balancer. 3. Enable Cloud CDN, and send traffic to the managed instance group.
B. 1. Create an unmanaged instance group. Replicate the static content across the VMs. 2. Create an external HTTP(S) load balancer 3. Enable Cloud CDN, and send traffic to the unmanaged instance group.
C. 1. Create a Standard storage class, regional Cloud Storage bucket. Put the static content in the bucket 2. Reserve an external IP address, and create an external HTTP(S) load balancer 3. Enable Cloud CDN, and send traffic to your backend bucket
D. 1. Create a Standard storage class, multi-regional Cloud Storage bucket. Put the static content in the bucket. 2. Reserve an external IP address, and create an external HTTP(S) load balancer. 3. Enable Cloud CDN, and send traffic to your backend bucket.
Show Answer
Correct Answer: D
Explanation:
A multi-regional Standard Cloud Storage bucket is the appropriate origin for globally distributed static content because it provides high availability across multiple regions with minimal operational overhead. Using an external HTTP(S) Load Balancer with a backend bucket and Cloud CDN delivers low-latency global access by caching content close to users. Instance groups require unnecessary VM management for static content, and a regional bucket provides less geographic redundancy than a multi-regional bucket.

Question 163

You are developing an application that will handle requests from end users. You need to secure a Cloud Function called by the application to allow authorized end users to authenticate to the function via the application while restricting access to unauthorized users. You will integrate Google Sign-In as part of the solution and want to follow Google-recommended best practices. What should you do?

A. Deploy from a source code repository and grant users the roles/cloudfunctions.viewer role.
B. Deploy from a source code repository and grant users the roles/cloudfunctions.invoker role
C. Deploy from your local machine using gcloud and grant users the roles/cloudfunctions.admin role
D. Deploy from your local machine using gcloud and grant users the roles/cloudfunctions.developer role
Show Answer
Correct Answer: B
Explanation:
To allow authenticated callers to invoke a Cloud Function, the required IAM permission is cloudfunctions.functions.invoke, which is included in the Cloud Functions Invoker role (roles/cloudfunctions.invoker). Viewer does not allow invocation, while Admin and Developer are overly privileged and violate least-privilege best practices. The deployment method (source repository vs. local gcloud) is not the security control for end-user invocation; among the options, the one that grants the correct least-privilege role is B.

Question 164

You are running a containerized application on Google Kubernetes Engine. Your container images are stored in Container Registry. Your team uses CI/CD practices. You need to prevent the deployment of containers with known critical vulnerabilities. What should you do?

A. • Use Web Security Scanner to automatically crawl your application • Review your application logs for scan results, and provide an attestation that the container is free of known critical vulnerabilities • Use Binary Authorization to implement a policy that forces the attestation to be provided before the container is deployed
B. • Use Web Security Scanner to automatically crawl your application • Review the scan results in the scan details page in the Cloud Console, and provide an attestation that the container is free of known critical vulnerabilities • Use Binary Authorization to implement a policy that forces the attestation to be provided before the container is deployed
C. • Enable the Container Scanning API to perform vulnerability scanning • Review vulnerability reporting in Container Registry in the Cloud Console, and provide an attestation that the container is free of known critical vulnerabilities • Use Binary Authorization to implement a policy that forces the attestation to be provided before the container is deployed
D. • Enable the Container Scanning API to perform vulnerability scanning • Programmatically review vulnerability reporting through the Container Scanning API, and provide an attestation that the container is free of known critical vulnerabilities • Use Binary Authorization to implement a policy that forces the attestation to be provided before the container is deployed
Show Answer
Correct Answer: D
Explanation:
To block deployment of images with known critical vulnerabilities in a CI/CD workflow on GKE, use Container Scanning (Container Analysis) to scan images, programmatically evaluate vulnerability results as part of the pipeline, create an attestation only if the image passes policy, and enforce that attestation with Binary Authorization. Web Security Scanner is for web applications, not container image vulnerability scanning. Programmatic review is the CI/CD-appropriate approach.

Question 165

You have an application deployed in Google Kubernetes Engine (GKE). You need to update the application to make authorized requests to Google Cloud managed services. You want this to be a one-time setup, and you need to follow security best practices of auto-rotating your security keys and storing them in an encrypted store. You already created a service account with appropriate access to the Google Cloud service. What should you do next?

A. Assign the Google Cloud service account to your GKE Pod using Workload Identity.
B. Export the Google Cloud service account, and share it with the Pod as a Kubernetes Secret.
C. Export the Google Cloud service account, and embed it in the source code of the application.
D. Export the Google Cloud service account, and upload it to HashiCorp Vault to generate a dynamic service account for your application.
Show Answer
Correct Answer: A
Explanation:
Workload Identity is the recommended GKE mechanism for allowing Pods to authenticate as a Google Cloud service account without distributing or managing long-lived service account keys. It avoids exporting keys, supports secure credential handling with automatic key management/rotation by Google, and is the security best practice for accessing Google Cloud managed services from GKE.

Question 167

You are developing an application that will store and access sensitive unstructured data objects in a Cloud Storage bucket. To comply with regulatory requirements, you need to ensure that all data objects are available for at least 7 years after their initial creation. Objects created more than 3 years ago are accessed very infrequently (less than once a year). You need to configure object storage while ensuring that storage cost is optimized. What should you do? (Choose two.)

A. Set a retention policy on the bucket with a period of 7 years.
B. Use IAM Conditions to provide access to objects 7 years after the object creation date.
C. Enable Object Versioning to prevent objects from being accidentally deleted for 7 years after object creation.
D. Create an object lifecycle policy on the bucket that moves objects from Standard Storage to Archive Storage after 3 years.
E. Implement a Cloud Function that checks the age of each object in the bucket and moves the objects older than 3 years to a second bucket with the Archive Storage class. Use Cloud Scheduler to trigger the Cloud Function on a daily schedule.
Show Answer
Correct Answer: A, D
Explanation:
A bucket retention policy of 7 years enforces that objects cannot be deleted or overwritten before the retention period expires, satisfying the regulatory retention requirement. A lifecycle policy can automatically transition objects from Standard Storage to Archive Storage after 3 years, minimizing storage costs for data that is rarely accessed. IAM Conditions do not enforce retention, Object Versioning does not guarantee 7-year retention, and a Cloud Function with a second bucket is unnecessary because lifecycle management supports storage class transitions within the bucket.

Question 168

You are developing an application using different microservices that must remain internal to the cluster. You want the ability to configure each microservice with a specific number of replicas. You also want the ability to address a specific microservice from any other microservice in a uniform way, regardless of the number of replicas the microservice scales to. You plan to implement this solution on Google Kubernetes Engine. What should you do?

A. Deploy each microservice as a Deployment. Expose the Deployment in the cluster using a Service, and use the Service DNS name to address it from other microservices within the cluster.
B. Deploy each microservice as a Deployment. Expose the Deployment in the cluster using an Ingress, and use the Ingress IP address to address the Deployment from other microservices within the cluster.
C. Deploy each microservice as a Pod. Expose the Pod in the cluster using a Service, and use the Service DNS name to address the microservice from other microservices within the cluster.
D. Deploy each microservice as a Pod. Expose the Pod in the cluster using an Ingress, and use the Ingress IP address to address the Pod from other microservices within the cluster.
Show Answer
Correct Answer: A
Explanation:
Deploy each microservice as a Deployment to manage replica count and rolling updates. Expose each Deployment with a ClusterIP Service (the default), which provides a stable virtual IP and DNS name inside the cluster. Other microservices can use the Service DNS name regardless of how many pod replicas exist. Ingress is intended for HTTP(S) ingress traffic to Services, not for internal service-to-service discovery, and standalone Pods do not provide replica management.

Question 169

You are building an application that uses a distributed microservices architecture. You want to measure the performance and system resource utilization in one of the microservices written in Java. What should you do?

A. Instrument the service with Cloud Profiler to measure CPU utilization and method-level execution times in the service.
B. Instrument the service with Debugger to investigate service errors.
C. Instrument the service with Cloud Trace to measure request latency.
D. Instrument the service with OpenCensus to measure service latency, and write custom metrics to Cloud Monitoring.
Show Answer
Correct Answer: A
Explanation:
Cloud Profiler is designed to continuously measure CPU usage, heap/resource utilization, and method-level performance for supported languages such as Java with low overhead. Cloud Trace focuses on request latency across services, Debugger is for inspecting application state, and OpenCensus is for custom telemetry and latency metrics but does not provide CPU/resource profiling or method-level execution profiling.

Question 170

You are planning to add unit tests to your application. You need to be able to assert that published Pub/Sub messages are processed by your subscriber in order. You want the unit tests to be cost-effective and reliable. What should you do?

A. Implement a mocking framework.
B. Create a topic and subscription for each tester.
C. Add a filter by tester to the subscription.
D. Use the Pub/Sub emulator.
Show Answer
Correct Answer: D
Explanation:
Use the Pub/Sub emulator for unit tests. It provides a local, cost-free environment that simulates Google Cloud Pub/Sub behavior, making tests reliable and isolated from network and cloud service variability. Creating real topics/subscriptions is more appropriate for integration testing and incurs management overhead and potential cost, while mocking would not validate Pub/Sub behavior as faithfully as the emulator.

Question 171

You have an application deployed in Google Kubernetes Engine (GKE) that reads and processes Pub/Sub messages. Each Pod handles a fixed number of messages per minute. The rate at which messages are published to the Pub/Sub topic varies considerably throughout the day and week, including occasional large batches of messages published at a single moment. You want to scale your GKE Deployment to be able to process messages in a timely manner. What GKE feature should you use to automatically adapt your workload?

A. Vertical Pod Autoscaler in Auto mode
B. Vertical Pod Autoscaler in Recommendation mode
C. Horizontal Pod Autoscaler based on an external metric
D. Horizontal Pod Autoscaler based on resources utilization
Show Answer
Correct Answer: C
Explanation:
Use the Horizontal Pod Autoscaler (HPA) with an external metric, such as the number of undelivered Pub/Sub messages exposed through Cloud Monitoring. Because each Pod processes a fixed throughput, scaling should be driven by queue backlog rather than CPU or memory utilization. Vertical Pod Autoscaler changes resource requests, not replica count, and HPA based on resource utilization may not react appropriately to varying queue depth or sudden message bursts.

$19

Get all 358 questions with detailed answers and explanations

  • Instant download HTML + PDF delivered the moment payment clears.
  • Secure Stripe checkout we never see or store your card details.
  • 7-day refund if files are defective see our refund policy.