0
0
GCPcloud~20 mins

Function deployment and testing in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cloud Function Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Function cold start behavior

You deploy a Google Cloud Function that processes HTTP requests. After a period of inactivity, the first request takes longer to respond than subsequent requests.

What causes this delay on the first request?

AThe HTTP request is blocked by firewall rules before reaching the function.
BThe function container is being created and initialized for the first time (cold start).
CThe function code has a syntax error causing retries and delays.
DThe function is scaling down to zero instances after each request.
Attempts:
2 left
💡 Hint

Think about what happens when a function has not been used for a while.

Configuration
intermediate
2:00remaining
Setting environment variables for a Cloud Function

You want to deploy a Cloud Function that uses an API key stored as an environment variable named API_KEY. Which gcloud command correctly sets this environment variable during deployment?

Agcloud functions deploy my-function --runtime python39 --trigger-http --set-env-vars API_KEY=abcd1234
Bgcloud functions deploy my-function --runtime python39 --trigger-http --env-vars-file API_KEY=abcd1234
Cgcloud functions deploy my-function --runtime python39 --trigger-http --env API_KEY=abcd1234
Dgcloud functions deploy my-function --runtime python39 --trigger-http --set-env API_KEY=abcd1234
Attempts:
2 left
💡 Hint

Check the official flag for setting environment variables inline.

Architecture
advanced
2:00remaining
Designing a Cloud Function for high concurrency

You need to deploy a Cloud Function that handles many simultaneous HTTP requests efficiently. Which configuration helps maximize concurrency and reduce cold starts?

AUse a single instance with minimal CPU to save costs.
BDisable concurrency and deploy multiple functions with different triggers.
CSet max instances to 1 and use a low memory allocation.
DIncrease max instances and allocate more memory to allow more concurrent executions.
Attempts:
2 left
💡 Hint

Think about how instance limits and memory affect concurrency.

security
advanced
2:00remaining
Securing Cloud Function HTTP triggers

You deploy a Cloud Function with an HTTP trigger. You want to restrict access so only authenticated users from your organization can invoke it. Which is the best approach?

AMake the function public and check user identity inside the function code.
BDisable authentication and rely on IP address filtering in the function code.
CUse IAM to grant the 'Cloud Functions Invoker' role only to your organization's users.
DUse a firewall rule to block all external traffic to the function.
Attempts:
2 left
💡 Hint

Consider built-in Google Cloud security features for access control.

Best Practice
expert
3:00remaining
Optimizing Cloud Function deployment for CI/CD pipelines

You want to automate Cloud Function deployments in a CI/CD pipeline. Which practice ensures reliable and repeatable deployments?

AUse Infrastructure as Code tools like Terraform or Deployment Manager to define and deploy functions.
BUse random function names for each deployment to avoid conflicts.
CDeploy functions by copying code files directly to the Cloud Storage bucket.
DManually deploy functions from the Cloud Console after each code change.
Attempts:
2 left
💡 Hint

Think about automation and version control in deployments.