Professional Cloud Developer Practice Exam (v20200505) (English)

Professional Cloud Developer Practice Exam (v20200505) (English)

Professional Cloud Developer certification is available in English or Japanese.

There is “Professional Cloud Developer 模擬試験(v20200505)(日本語)” for the Japanese version.


Google Exam & Answers – Professional Cloud Developer

From GratisExam’s v2020-05-05.by.david.33q


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 Google Cloud DataProc Hadoop cluster in a Google Cloud Platform environment.
Which command should you use?

A. gsutil cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/
B. gcloud cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/
C. hadoop fs cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/
D. gcloud dataproc cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/

Correct Answer: A

Explanation:
The gsutil cp command allows you to copy data between your local file. storage. boto files generated by running “gsutil config”


QUESTION 2

You have deployed an HTTP(s) Load Balancer with the gcloud commands shown below.

export NAME-load-balancer

# create network
gcloud compute networks create ${NAME}

# add instance gcloud compute instances create ${NAME) -backend-instance-1 --subnet $ (NAME) --no address

# create the instance group
gcloud compute instance-groups unmanaged create $ (NAME) -i
gcloud compute instance-groups unmanaged set-named-ports ${NAME}-i --named-ports http:80
gcloud compute instance-groups unmanaged add-instances $ (NAME) -i --instances $ (NAME)-instance-1

# configure health checks
gcloud compute health-checks create http $ (NAME) -http-hc --port 80

# create backend service
gcloud compute backend-services create $ (NAME) -http-bes --health-checks ${NAME} -http-hc --protocol HTTP --port-name http --global
gcloud compute backend-services add-backend ${NAME} -http-bes --instance-group ${NAME} -i --balancing-mode RATE --max-rate 100000 --capacity-scaler 1.0 --global --instance-group-zone us-easti-d

# create urls maps and forwarding rule
gcloud compute url-maps create $ (NAME) -http-urlmap--default-service $ (NAME) -http-bes
gcloud compute target-http-proxies create ${NAME) -http-proxy --url-map ${NAME} -http-urlmap
gcloud compute forwarding-rules create $ (NAME) -http-fw --global --ip-protocol ICP--target-http-proxy $ (NAME) -http-proxy --ports 80

Health checks to port 80 on the Google 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?

  • A. gcloud compute instances add-access-config ${NAME}-backend-instance-1
  • B. gcloud compute instances add-tags ${NAME}-backend-instance-1 –tags http-server
  • 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
  • D. gcloud 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

Correct Answer: C

Reference
Configuring VMs for networking use cases


QUESTION 3

You need to copy directory local-scripts and all of its contents from your local workstation to a Google 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 4

You are deploying your application to a Google Compute Engine virtual machine instance with the Google 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 behavior


QUESTION 5

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 6

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 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 Google BigQuery table. 

BigQuery service = BigQueryOptions.newBuilder().build().getService();

  public void writeToBigQuery(Collection<Map<String, String>> rows){
    for(Map<String, String> row : rows) {
      InsertAllRequest insertRequest = InsertAllRequest.newBuilder(
        "datasetId", "tableID",
        InsertAllRequest.RowToInsert.of(row)).build();
      service.insertAll(insertRequset);
  }
}

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 Google Cloud Storage object, then load into Google BigQuery.
  • D. Write each row to a Google Cloud Storage object in parallel, then load into Google BigQuery.

Correct Answer: B


QUESTION 8

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

  • A. Install the Google Stackdriver Logging Agent and configure it to send the application logs.
    B. Use a Google Stackdriver Logging Library to log directly from the application to Google Stackdriver Logging.
  • C. Provide the log file folder path in the metadata of the instance to configure it to send the application logs.
  • D. Change the application to log to /var/log so that its logs are automatically sent to Google Stackdriver Logging. 

Correct Answer: A


QUESTION 9

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

  • A. Add a cache-control header to the objects.
  • B. Request a quota increase from the GCP Console.
  • C. Retry the request with a truncated exponential backoff strategy.
  • D. Change the storage class of the Google Cloud Storage bucket to Multi-regional. 

Correct Answer: C

Reference:
Usage Limits 


QUESTION 10

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 11

Your application takes an input from a user and publishes it to the user’s contacts.
This input is stored in a table in Google Cloud Spanner. Your application is more sensitive to latency and less sensitive to consistency. 
How should you perform reads from Google 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
Reads


QUESTION 12

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 Google Cloud Storage.
  • B. Upload your application to an Google App Engine environment.
  • C. Create a Google 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 13

You want to notify on-call engineers about a service degradation in production while minimizing development time. 
What should you do? 

  • A. Use Google Cloud Function to monitor resources and raise alerts.
  • B. Use Google Cloud Pub/Sub to monitor resources and raise alerts.
  • C. Use Google Stackdriver Error Reporting to capture errors and raise alerts.
  • D. Use Google Stackdriver Monitoring to monitor resources and raise alerts. 

Correct Answer: A


QUESTION 14

You are writing a single-page web application with a user-interface that communicates with a third-party API for content using XMLHttpRequest (XHR).
The data displayed on the UI by the API results is less critical than other data displayed on the same web page, so it is acceptable for some requests to not have the API data displayed in the UI. However, calls made to the API should not delay rendering of other parts of the user interface.
You want your application to perform well when the API response is an error or a timeout. 
What should you do? 

  • A. Set the asynchronous option for your requests to the API to false and omit the widget displaying the API results when a timeout or error is encountered.
  • B. Set the asynchronous option for your request to the API to true and omit the widget displaying the API results when a timeout or error is encountered.
    C. Catch timeout or error exceptions from the API call and keep trying with exponential backoff until the API response is successful.
  • D. Catch timeout or error exceptions from the API call and display the error response in the UI widget. 

Correct Answer: A


QUESTION 15

You are parsing a log file that contains three columns: a timestamp, an account number (a string), and a transaction amount (a number).
You want to calculate the sum of all transaction amounts for each unique account number efficiently. 
Which data structure should you use? 

  • A. A linked list
  • B. A hash table
  • C. A two-dimensional array
  • D. A comma-delimited string 

Correct Answer: B


QUESTION 16

Your company has a Google 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 17 

You are load testing your server application.
During the first 30 seconds, you observe that a previously inactive Google 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 Google Cloud Storage JSON API as the demand escalates.
You want to decrease the failed responses from the Google Cloud Storage API. 
What should you do? 

  • A. Distribute the uploads across a large number of individual Google Cloud Storage buckets.
  • B. Use the XML API instead of the JSON API for interfacing with Google 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 18

You are developing an HTTP API hosted on a Google 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 Google Cloud DNS. Clients should use the name of the A record to connect to the service.
  • C. Ensure that clients use Google 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 Google 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 building a new API.
You want to minimize the cost of storing and reduce the latency of serving images. 
Which architecture should you use? 

  • A. Google App Engine backed by Google Cloud Storage.
  • B. Google Compute Engine backed by Persistent Disk.
  • C. Transfer Appliance backed by Google Cloud Filestore.
  • D. Google Cloud Content Delivery Network (CDN) backed by Google Cloud Storage.

Correct Answer: B


QUESTION 20

Your code is running on Google Cloud Functions in project A. It is supposed to write an object in a Google 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 Google Cloud Storage bucket.
  • B. Grant your user account the roles/iam.serviceAccountUser role for the [email protected] service account.
  • C. Grant the [email protected] service account the roles/storage.objectCreator role for the Google Cloud Storage bucket.
  • D. Enable the Google Cloud Storage API in project B. 

Correct Answer: B


QUESTION 21 

For this question, refer to the HipLocal 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 Google Stackdriver Logging agent on the VMs.
  • C. Install the Google Stackdriver Monitoring agent on the VMs.
  • D. Use Google Stackdriver Trace to look for performance bottlenecks. 

Correct Answer: C


QUESTION 22

For this question, refer to the HipLocal case study.
HipLocal wants to reduce the number of on-call engineers and eliminate manual scaling. 
Which two services should they choose? (Choose two.) 

  • A. Use Google App Engine services.
  • B. Use serverless Google Cloud Functions.
  • C. Use Knative to build and deploy serverless applications.
  • D. Use Google Kubernetes Engine for automated deployments.
  • E. Use a large Google Compute Engine cluster for deployments. 

Correct Answer: B, C


QUESTION 23

For this question, refer to the HipLocal case study.
In order to meet their business requirements, how should HipLocal store their application state? 

  • A. Use local SSDs to store state.
  • B. Put a memcache layer in front of MySQL.
  • C. Move the state storage to Google Cloud Spanner.
  • D. Replace the MySQL instance with Google Cloud SQL. 

Correct Answer: B


QUESTION 24

For this question, refer to the HipLocal case study.
HipLocal wants to improve the resilience of their MySQL deployment, while also meeting their business and technical requirements. 
Which configuration should they choose? 

  • A. Use the current single instance MySQL on Google Compute Engine and several read-only MySQL servers on Google Compute Engine.
  • B. Use the current single instance MySQL on Google Compute Engine, and replicate the data to Google Cloud SQL in an external master configuration.
  • C. Replace the current single instance MySQL instance with Google Cloud SQL, and configure high availability.
  • D. Replace the current single instance MySQL instance with Google Cloud SQL, and Google provides redundancy without further configuration. 

Correct Answer: B


QUESTION 25

You want to view the memory usage of your application deployed on Compute Engine.
What should you do? 

  • A. Install the Google Stackdriver Client Library.
  • B. Install the Google Stackdriver Monitoring Agent.
  • C. Use the Google Stackdriver Metrics Explorer.
  • D. Use the Google Cloud Platform Console. 

Correct Answer: C

Reference:
Google Cloud Platform: how to monitor memory usage of VM instances


QUESTION 26

You are working on a social media application.
You plan to add a feature that allows users to upload images. These images will be 2 MB – 1 GB in size.
You want to minimize their infrastructure operations overhead for this feature. What should you do? 

  • A. Change the application to accept images directly and store them in the database that stores other user information.
  • B. Change the application to create signed URLs for Google Cloud Storage. Transfer these signed URLs to the client application to upload images to Google Cloud Storage.
  • C. Set up a web server on GCP to accept user images and create a file store to keep uploaded files. Change the application to retrieve images from the file store.
  • D. Create a separate bucket for each user in Google Cloud Storage. Assign a separate service account to allow write access on each bucket. Transfer service account credentials to the client application based on user information. The application uses this service account to upload images to Google Cloud Storage. 

Correct Answer: B

Reference:
Uploading images directly to Cloud Storage using Signed URL


QUESTION 27

Your application performs well when tested locally, but it runs significantly slower when you deploy it to Google App Engine standard environment.
You want to diagnose the problem.
What should you do? 

  • A. File a ticket with Google Cloud Support indicating that the application performs faster locally.
  • B. Use Google Stackdriver Debugger Snapshots to look at a point-in-time execution of the application.
  • C. Use Google Stackdriver Trace to determine which functions within the application have higher latency.
  • D. Add logging commands to the application and use Google Stackdriver Logging to check where the latency problem occurs. 

Correct Answer: D


QUESTION 28

Your Google App Engine standard configuration is as follows: 
– service: production
– instance_class: B1
You want to limit the application to 5 instances.
Which code snippet should you include in your configuration? 

  • A. manual_scaling:
    instances: 5
    min_pending_latency: 30ms
  • B. manual_scaling:
    max_instances: 5
    idle_timeout: 10m
  • C. basic_scaling:
    instances: 5
    min_pending_latency: 30ms
  • D. basic_scaling:
    max_instances: 5
    idle_timeout: 10m

Correct Answer: C


QUESTION 29

Your analytics system executes queries against a Google BigQuery dataset. The SQL query is executed in batch and passes the contents of a SQL file to the Google BigQuery CLI. Then it redirects the Google BigQuery CLI output to another process. However, you are getting a permission error from the Google BigQuery CLI when the queries are executed.
You want to resolve the issue.
What should you do? 

  • A. Grant the service account Google BigQuery Data Viewer and BigQuery Job User roles.
  • B. Grant the service account Google BigQuery Data Editor and BigQuery Data Viewer roles.
  • C. Create a view in Google BigQuery from the SQL query and SELECT* from the view in the CLI.
  • D. Create a new dataset in Google BigQuery, and copy the source table to the new dataset Query the new dataset and table from the CLI. 

Correct Answer:


QUESTION 30

You have an application controlled by a managed instance group (MIG).
When you deploy a new version of the application, costs should be minimized and the number of instances should not increase. You want to ensure that, when each new instance is created, the deployment only continues if the new instance is healthy.
What should you do? 

  • A. Perform a rolling-action with maxSurge set to 1, maxUnavailable set to 0.
  • B. Perform a rolling-action with maxSurge set to 0, maxUnavailable set to 1.
  • C. Perform a rolling-action with maxHealthy set to 1, maxUnhealthy set to 0.
  • D. Perform a rolling-action with maxHealthy set to 0, maxUnhealthy set to 1. 

Correct Answer: A

Reference:
Rolling out updates to MIGs


QUESTION 31

Your company is planning to migrate their on-premises Hadoop environment to the cloud.
Increasing storage cost and maintenance of data stored in HDFS is a major concern for your company. You also want to make minimal changes to existing data analytics jobs and existing architecture.
How should you proceed with the migration? 

  • A. Migrate your data stored in Hadoop to Google BigQuery. Change your jobs to source their information from Google BigQuery instead of the on-premises Hadoop environment.
  • B. Create Google Compute Engine instances with HDD instead of SSD to save costs. Then perform a full migration of your existing environment into the new one in Google Compute Engine instances.
  • C. Create a Google Cloud Dataproc cluster on Google Cloud Platform, and then migrate your Hadoop environment to the new Google Cloud Dataproc cluster. Move your HDFS data into larger HDD disks to save on storage costs.
  • D. Create a Google Cloud Dataproc cluster on Google Cloud Platform, and then migrate your Hadoop code objects to the new cluster. Move your data to Google Cloud Storage and leverage the Google Cloud Dataproc connector to run jobs on that data. 

Correct Answer: D


QUESTION 32

Your data is stored in Google Cloud Storage buckets. Fellow developers have reported that data downloaded from Google Cloud Storage is resulting in slow API performance. You want to research the issue to provide details to the GCP support team.
Which command should you run? 

  • A. gsutil test –o output.json gs://my-bucket
  • B. gsutil perfdiag –o output.json gs://my-bucket
  • C. gcloud compute scp example-instance:~/test-data –o output.json gs://my-bucket
  • D. gcloud services test –o output.json gs://my-bucket 

Correct Answer: B

Reference:
Sometimes get super-slow download rates from Google Cloud Storage, severely impacting workflow


QUESTION 33

You are using Google Cloud Build build to promote a Docker image to Development, Test, and Production environments. You need to ensure that the same Docker image is deployed to each of these environments.
How should you identify the Docker image in your build? 

  • A. Use the latest Docker image tag.
  • B. Use a unique Docker image name.
  • C. Use the digest of the Docker image.
  • D. Use a semantic version Docker image tag. 

Correct Answer: D

模擬問題集カテゴリの最新記事