Ace Your Professional Cloud Developer Certification with Practice Exams.
Google Certified – Professional Cloud Developer Practice Exam (23 Q)
v2019-11-16
QUESTION 1
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?
- A. gsutil cp –project “my-gcp-project” -r ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone “us-east1-b”
- B. gsutil cp –project “my-gcp-project” -R ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone “us-east1-b”
- C. gcloud compute scp –project “my-gcp-project” –recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone
“us-east1-b” - D. gcloud compute mv –project “my-gcp-project” –recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone
“us-east1-b”
Correct Answer: C
Reference
gcloud compute copy-files
QUESTION 2
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?
- A. Uptime check
- B. Process health
- C. Metric absence
- D. Metric threshold
Correct Answer: B
Reference
Alerting policies in depth
QUESTION 3
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?
- A. Use the JOIN operator in SQL to combine the tables.
- B. Use nested WITH statements to combine the tables.
- C. Use the UNION operator in SQL to combine the tables.
- D. Use the UNION ALL operator in SQL to combine the tables.
Correct Answer: C
Reference
SQL: UNION ALL Operator
QUESTION 4
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?
- A. Blue/green deployment.
- B. Canary deployment.
- C. Rolling deployment.
- D. Recreate deployment.
Correct Answer: A
Reference:
Six Strategies for Application Deployment
QUESTION 5
You need to migrate an internal file upload API with an enforced 500-MB file size limit to App Engine.
What should you do?
- A. Use FTP to upload files.
- B. Use CPanel to upload files.
- C. Use signed URLs to upload files
- D. Change the API to be a multipart file upload API.
Correct Answer: C
Reference:
Google Cloud Platform
QUESTION 6
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.
livenessProbe: httpGet: path: /healthz port: 80
- B.
reainessProbe: httpGet: path: /healthz port: 80
- C.
loadbalanceHealthCheck: httpGet: path: /healthz port: 80
/ - D.
HealthCheck: httpGet: path: /healthz port: 80
/
Correct Answer: B
Explanation:
For the GKE ingress controller to use your readinessProbes as health checks, the Pods for an Ingress must exist at the time of Ingress creation. If your replicas are scaled to 0, the default health check will apply.
QUESTION 7
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.
BigQuery service = BigQuyerOptions.newBuilder() .build() .getService();
public void write To BigQuery(Collection<Map<string, String>> row){
for(Map<string, string< row : rows) {
InsertAllRequest insertRequest = InsertAllRequesr. newBuilder(
“dataseId”, “tableId”,
InsertAllRequest.RowToInsert.of(row)).build()
service.insertAll(insertRequest);
}
}
Which improvement should you suggest your teammate make?
- A. Include multiple rows with each request.
- B. Perform the inserts in parallel by creating multiple threads.
- C. Write each row to a Cloud Storage object, then load into BigQuery.
- D. Write each row to a Cloud Storage object in parallel, then load into BigQuery.
Correct Answer: B
QUESTION 8
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?
- A. RESTful APIs
- B. MQTT for APIs
- C. gRPC-based APIs
- D. SOAP-based APIs
Correct Answer: A
Reference:
How to Build RESTful API for Your Mobile App?
QUESTION 9
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?
- A. Perform Read-Only transactions.
- B. Perform stale reads using single-read methods.
- C. Perform strong reads using single-read methods.
- D. Perform stale reads using read-write transactions.
Correct Answer: D
Reference:
Best practices for using Cloud Spanner as a gaming database
QUESTION 10
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?
apiVersion: apps/v1
kind: Deployment
Metadata:
name: ecommerce-frontend
spec:
replicas: 3
selector:
matchLabels:
app: ecommerce-frontend
template:
metadate:
labels:
app: ecommerce-frontend
spec:
containers:
- name: ecommerce-forntend-webapp
image: ecommerce-frontend-webapp:1.7.9
prets:
- containerPort: 80
- A. Set the Deployment strategy to RollingUpdate with maxSurge set to 0, maxUnavailable set to 1.
- B. Set the Deployment strategy to RollingUpdate with maxSurge set to 1, maxUnavailable set to 0.
- C. Set the Deployment strategy to Recreate with maxSurge set to 0, maxUnavailable set to 1.
- D. Set the Deployment strategy to Recreate with maxSurge set to 1, maxUnavailable set to 0.
Correct Answer: D
QUESTION 11
You plan to make a simple HTML application available on the internet. This site keeps information about FAQs for your application. The application is static and contains images, HTML, CSS, and Javascript. You want to make this application available on the internet with as few steps as possible.
What should you do?
- A. Upload your application to Cloud Storage.
- B. Upload your application to an App Engine environment.
- C. Create a Compute Engine instance with Apache web server installed. Configure Apache web server to host the application.
- D. Containerize your application first. Deploy this container to Google Kubernetes Engine (GKE) and assign an external IP address to the GKE pod hosting the application.
Correct Answer: A
Reference:
Hosting a static website
QUESTION 12
Your company has deployed a new API to App Engine Standard environment. During testing, the API is not behaving as expected. You want to monitor the application over time to diagnose the problem within the application code without redeploying the application.
Which tool should you use?
- A. Stackdriver Trace
- B. Stackdriver Monitoring
- C. Stackdriver Debug Snapshots
- D. Stackdriver Debug Logpoints
Correct Answer: B
Reference:
GCP Stackdriver Tutorial : Debug Snapshots, Traces, Logging and Logpoints
QUESTION 13
You want to use the Stackdriver Logging Agent to send an application’s log file to Stackdriver from a Compute Engine virtual machine instance.
After installing the Stackdriver Logging Agent, what should you do first?
- A. Enable the Error Reporting API on the project.
- B. Grant the instance full access to all Cloud APIs.
- C. Configure the application log file as a custom source.
- D. Create a Stackdriver Logs Export Sink with a filter that matches the application’s log entries.
Correct Answer: B
QUESTION 14
Your company has a BigQuery dataset named “Master” that keeps information about employee travel and expenses. This information is organized by employee department. That means employees should only be able to view information for their department. You want to apply a security framework to enforce this requirement with the minimum number of steps.
What should you do?
- A. Create a separate dataset for each department. Create a view with an appropriate WHERE clause to select records from a particular dataset for the specific department. Authorize this view to access records from your Master dataset. Give employees the permission to this department-specific dataset.
- B. Create a separate dataset for each department. Create a data pipeline for each department to copy appropriate information from the Master dataset to the specific dataset for the department. Give employees the permission to this department-specific dataset.
- C. Create a dataset named Master dataset. Create a separate view for each department in the Master dataset. Give employees access to the specific view for their department.
- D. Create a dataset named Master dataset. Create a separate table for each department in the Master dataset. Give employees access to the specific table for their department.
Correct Answer: B
QUESTION 15
You have an application in production. It is deployed on Compute Engine virtual machine instances controlled by a managed instance group. Traffic is routed to the instances via a HTTP (s) load balancer. Your users are unable to access your application. You want to implement a monitoring technique to alert you when the application is unavailable.
Which technique should you choose?
- A. Smoke tests
- B. Stackdriver uptime checks
- C. Cloud Load Balancing – heath checks
- D. Managed instance group – heath checks
Correct Answer: B
Reference:
Stackdriver Monitoring Automation Part 3: Uptime Checks
QUESTION 16
You are load testing your server application. During the first 30 seconds, you observe that a previously inactive Cloud Storage bucket is now servicing 2000 write requests per second and 7500 read requests per second. Your application is now receiving intermittent 5xx and 429 HTTP responses from the Cloud Storage JSON API as the demand escalates. You want to decrease the failed responses from the Cloud Storage API.
What should you do?
- A. Distribute the uploads across a large number of individual storage buckets.
- B. Use the XML API instead of the JSON API for interfacing with Cloud Storage.
- C. Pass the HTTP response codes back to clients that are invoking the uploads from your application.
- D. Limit the upload rate from your application clients so that the dormant bucket’s peak request rate is reached more gradually.
Correct Answer: A
Reference:
Request rate and access distribution guidelines
QUESTION 17
Your application is controlled by a managed instance group. You want to share a large read-only data set between all the instances in the managed instance group.
You want to ensure that each instance can start quickly and can access the data set via its filesystem with very low latency. You also want to minimize the total cost of the solution.
What should you do?
- A. Move the data to a Cloud Storage bucket, and mount the bucket on the filesystem using Cloud Storage FUSE.
- B. Move the data to a Cloud Storage bucket, and copy the data to the boot disk of the instance via a startup script.
- C. Move the data to a Compute Engine persistent disk, and attach the disk in read-only mode to multiple Compute Engine virtual machine instances.
- D. Move the data to a Compute Engine persistent disk, take a snapshot, create multiple disks from the snapshot, and attach each disk to its own instance.
Correct Answer: C
QUESTION 18
You are developing an HTTP API hosted on a Compute Engine virtual machine instance that needs to be invoked by multiple clients within the same Virtual Private Cloud (VPC). You want clients to be able to get the IP address of the service.
What should you do?
- A. Reserve a static external IP address and assign it to an HTTP(S) load balancing service’s forwarding rule. Clients should use this IP address to connect to the service.
- B. Reserve a static external IP address and assign it to an HTTP(S) load balancing service’s forwarding rule. Then, define an A record in Cloud DNS. Clients should use the name of the A record to connect to the service.
- C. Ensure that clients use Compute Engine internal DNS by connecting to the instance name with the url https://[INSTANCE_NAME].[ZONE].c. [PROJECT_ID].internal/.
- D. Ensure that clients use Compute Engine internal DNS by connecting to the instance name with the url https://[API_NAME]/[API_VERSION]/.
Correct Answer: D
QUESTION 19
You are planning to deploy your application in a Google Kubernetes Engine (GKE) cluster. Your application can scale horizontally, and each instance of your application needs to have a stable network identity and its own persistent disk.
Which GKE object should you use?
- A. Deployment
- B. StatefulSet
- C. ReplicaSet
- D. ReplicaController
Correct Answer: B
Reference:
Chapter 10. StatefulSets: deploying replicated stateful applications
QUESTION 20
You are using Cloud Build to build a Docker image. You need to modify the build to execute unit and run integration tests. When there is a failure, you want the build history to clearly display the stage at which the build failed.
What should you do?
- A. Add RUN commands in the Dockerfile to execute unit and integration tests.
- B. Create a Cloud Build build config file with a single build step to compile unit and integration tests.
- C. Create a Cloud Build build config file that will spawn a separate cloud build pipeline for unit and integration tests.
- D. Create a Cloud Build build config file with separate cloud builder steps to compile and execute unit and integration tests.
Correct Answer: D
QUESTION 21
Your code is running on Cloud Functions in project A. It is supposed to write an object in a Cloud Storage bucket owned by project B. However, the write call is failing with the error “403 Forbidden”.
What should you do to correct the problem?
- A. Grant your user account the roles/storage.objectCreator role for the Cloud Storage bucket.
- B. Grant your user account the roles/iam.serviceAccountUser role for the service-PROJECTA@gcf-admin-robot.iam.gserviceaccount.com service account.
- C. Grant the service-PROJECTA@gcf-admin-robot.iam.gserviceaccount.com service account the roles/storage.objectCreator role for the Cloud Storage bucket.
- D. Enable the Cloud Storage API in project B
Correct Answer: B
QUESTION 22
Please check “HipLoca” of Case Study.
HipLocal’s APIs are showing occasional failures, but they cannot find a pattern. They want to collect some metrics to help them troubleshoot.
What should they do?
- A. Take frequent snapshots of all of the VMs.
- B. Install the Stackdriver Logging agent on the VMs.
- C. Install the Stackdriver Monitoring agent on the VMs.
- D. Use Stackdriver Trace to look for performance bottlenecks.
Correct Answer: C
QUESTION 23
Please check “HipLoca” of Case Study.
HipLocal has connected their Hadoop infrastructure to GCP using Cloud Interconnect in order to query data stored on persistent disks.
Which IP strategy should they use?
- A. Create manual subnets.
- B. Create an auto mode subnet.
- C. Create multiple peered VPCs.
- D. Provision a single instance for NAT.
Correct Answer: A
Comments are closed