GCP Google Cloud Platform (GCP) CE 4 — Questions and Answers
Question 1: A developer needs to call a GCP API from a Compute Engine VM without storing service account keys on disk. What is the recommended approach?
- Download a JSON key file and store it in /etc/gcp/
- Use the VM's attached service account and Application Default Credentials (Correct answer)
- Hard-code the API key in the application environment variables
- Generate a short-lived OAuth token with gcloud each time
Correct answer: Use the VM's attached service account and Application Default Credentials
Attaching a service account to a Compute Engine VM and using Application Default Credentials (ADC) is the recommended keyless authentication approach.
Question 2: Which Cloud Storage feature enables you to automatically transition objects to cheaper storage classes over time?
- Object Versioning
- Retention Policies
- Lifecycle Management Rules (Correct answer)
- Object Hold
Correct answer: Lifecycle Management Rules
Cloud Storage Lifecycle Management Rules allow automatic transitions of objects to Nearline, Coldline, or Archive storage classes based on age or other conditions.
Question 3: What is the maximum duration for which a GCP Preemptible VM can run before being automatically terminated by Google?
- 6 hours
- 12 hours
- 24 hours (Correct answer)
- 48 hours
Correct answer: 24 hours
Preemptible VMs are terminated by Google after a maximum of 24 hours, and may be reclaimed sooner when Compute Engine needs capacity.
Question 4: Which GCP tool helps you understand and optimize your cloud spending by providing cost allocation, budgets, and recommendations?
- Cloud Billing Reports with Cost Table (Correct answer)
- Active Assist Recommender
- Cloud Cost Management (formerly Cost Optimization Hub)
- Cloud Billing Budget API only
Correct answer: Cloud Billing Reports with Cost Table
Cloud Billing Reports with Cost Table provides detailed cost allocation, filtering, and grouping to understand and optimize GCP spending.
Question 5: Which feature of Cloud Run allows it to automatically scale down to zero instances when there is no traffic?
- Cloud Run's always-on minimum instance setting
- Serverless autoscaling with concurrency-based request buffering (Correct answer)
- Cloud Armor's traffic shaping rules
- Cloud Endpoints rate limiting
Correct answer: Serverless autoscaling with concurrency-based request buffering
Cloud Run uses serverless autoscaling that scales to zero instances during idle periods and buffers incoming requests while new instances start.
Question 6: An organization requires that all GCP resources be created only in specific geographic regions. Which control enforces this?
- VPC firewall rules restricted to region CIDRs
- Cloud Armor geo-restriction policies
- Organization Policy constraints/gcp.resourceLocations (Correct answer)
- IAM conditions on location attributes
Correct answer: Organization Policy constraints/gcp.resourceLocations
The Organization Policy constraint `constraints/gcp.resourceLocations` restricts resource creation to a defined list of allowed regions or multi-regions.
Question 7: What is the role of Cloud Interconnect compared to Cloud VPN when connecting on-premises networks to GCP?
- Cloud Interconnect uses the public internet; Cloud VPN uses dedicated fiber
- Cloud Interconnect provides dedicated physical connections with higher throughput and lower latency; Cloud VPN tunnels over the public internet (Correct answer)
- They are equivalent options with different pricing models only
- Cloud VPN supports BGP routing; Cloud Interconnect does not
Correct answer: Cloud Interconnect provides dedicated physical connections with higher throughput and lower latency; Cloud VPN tunnels over the public internet
Cloud Interconnect provides dedicated or partner connections with guaranteed bandwidth and lower latency, while Cloud VPN encrypts traffic over the public internet.
A developer needs to call a GCP API from a Compute Engine VM without storing service account keys on disk.
What is the recommended approach?