0
0
GCPcloud~20 mins

Cloud Functions pricing in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cloud Functions Pricing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Cloud Functions invocation pricing

Google Cloud Functions charges based on the number of function invocations. Suppose you have a function that is triggered 1,000,000 times in a month. The first 2 million invocations are free each month. How much will you be charged for invocations?

AYou will not be charged because 1,000,000 is less than the free 2 million invocations.
BYou will be charged for all 1,000,000 invocations.
CYou will be charged only for 500,000 invocations.
DYou will be charged a flat monthly fee regardless of invocations.
Attempts:
2 left
💡 Hint

Remember the free tier covers the first 2 million invocations per month.

service_behavior
intermediate
2:00remaining
Effect of function memory size on billing

You deploy a Cloud Function with 256 MB memory and it runs for 2 seconds per invocation. You then change the memory to 512 MB but the function runtime stays the same. How does this affect your billing?

ABilling cost halves because more memory means faster execution.
BBilling cost stays the same because runtime did not change.
CBilling cost doubles because memory doubled, even though runtime is the same.
DBilling cost is based only on number of invocations, so no change.
Attempts:
2 left
💡 Hint

Billing depends on memory size and execution time together.

Architecture
advanced
2:00remaining
Optimizing Cloud Functions cost for high CPU usage

You have a Cloud Function that performs CPU-intensive tasks and runs for 5 seconds with 256 MB memory. You want to reduce cost and improve performance. Which approach is best?

AIncrease memory to 1 GB to get more CPU power and reduce runtime.
BDecrease memory to 128 MB to save cost, even if runtime increases.
CKeep memory at 256 MB and reduce number of invocations.
DSwitch to a different cloud service that charges per CPU second.
Attempts:
2 left
💡 Hint

More memory means more CPU power in Cloud Functions.

security
advanced
2:00remaining
Impact of Cloud Functions pricing on security design

You want to secure a Cloud Function that processes sensitive data. You add logging for every invocation, which increases execution time by 1 second. How does this affect your Cloud Functions pricing?

ACost increases only if logs are stored in Cloud Storage.
BCost increases because billing is based on execution time including logging overhead.
CCost decreases because logging optimizes function performance.
DCost stays the same because logging is free and does not affect billing.
Attempts:
2 left
💡 Hint

Execution time includes all code running inside the function.

Best Practice
expert
2:00remaining
Choosing Cloud Functions region for cost efficiency

You deploy identical Cloud Functions in two different regions: Region A charges $0.0000025 per GB-second and Region B charges $0.0000030 per GB-second. Both have the same free tier. You expect 10 million GB-seconds usage monthly. Which region is more cost-effective and why?

ARegion B is more cost-effective because it has better network latency.
BRegion B is cheaper because it offers discounts for high usage.
CBoth regions cost the same because free tier covers all usage.
DRegion A is more cost-effective because it has a lower GB-second price.
Attempts:
2 left
💡 Hint

Compare price per GB-second after free tier.