0
0
GCPcloud~20 mins

Event triggered functions in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Event Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
What happens when a Cloud Function is triggered by a Pub/Sub event?

You have a Google Cloud Function set to trigger on a Pub/Sub topic message. What is the expected behavior when a new message is published to that topic?

AThe Cloud Function runs on a fixed schedule unrelated to message publishing.
BThe Cloud Function runs once for each message published to the topic.
CThe Cloud Function runs only if the message contains a specific attribute named 'trigger'.
DThe Cloud Function runs only once regardless of how many messages are published.
Attempts:
2 left
💡 Hint

Think about how event-driven systems respond to each event.

Architecture
intermediate
2:00remaining
Choosing the right trigger for a Cloud Function

You want to run a Cloud Function whenever a new file is uploaded to a Cloud Storage bucket. Which trigger should you configure?

ATrigger the function on Cloud Storage 'finalize' event.
BTrigger the function on HTTP request.
CTrigger the function on Pub/Sub topic messages.
DTrigger the function on Cloud Scheduler job.
Attempts:
2 left
💡 Hint

Consider which event corresponds to file uploads in Cloud Storage.

security
advanced
2:00remaining
Securing event-triggered Cloud Functions

You have a Cloud Function triggered by Pub/Sub messages. How can you ensure only authorized publishers can trigger the function?

ASet IAM permissions so only authorized identities can publish to the Pub/Sub topic.
BAdd a secret token in the message payload and verify it inside the function.
CMake the Cloud Function public and rely on message content validation.
DUse a firewall rule to block all incoming traffic except from known IPs.
Attempts:
2 left
💡 Hint

Think about controlling who can send messages to the event source.

Configuration
advanced
2:00remaining
Handling retries in event-triggered Cloud Functions

You deploy a Cloud Function triggered by Cloud Storage events. If the function fails, what is the default retry behavior?

AThe function retries only if manually triggered again.
BThe function is never retried; failed executions are discarded immediately.
CThe function retries only once after a fixed delay of 5 minutes.
DThe function is retried automatically until it succeeds or the event expires.
Attempts:
2 left
💡 Hint

Consider how event delivery guarantees work in Cloud Functions.

Best Practice
expert
2:00remaining
Optimizing Cloud Function cold start times for event triggers

You notice your event-triggered Cloud Function has high cold start latency. Which approach best reduces cold start delays?

AIncrease the function timeout to allow longer execution time.
BDisable concurrency to force single execution at a time.
CKeep the function code small and dependencies minimal to speed startup.
DUse a larger memory allocation to slow down the function.
Attempts:
2 left
💡 Hint

Think about what affects how fast a function starts.