Courseiva
hardMultiple ChoiceObjective-mapped

Google ACE Practice Question: Your organization uses Cloud Functions to process…

Your organization uses Cloud Functions to process messages from a Pub/Sub topic. Each function processes a single message and writes results to BigQuery. Recently, the function has been timing out and the Pub/Sub subscription's unacknowledged message count is growing rapidly. The function's memory is set to 256 MB and timeout is 60 seconds. The function logs show occasional 'memory limit exceeded' errors. You suspect that the function is leaking memory when processing large messages. What should you do to resolve the issue while minimizing cost and complexity?

⚠ Common exam trap

Google Cloud often tests the misconception that increasing timeout alone (Option C) or adding a dead-letter queue (Option B) solves memory-related failures, when in fact memory must be increased to prevent 'memory limit exceeded' errors.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Increase the function's memory to 512 MB and timeout to 120 seconds.

The function is timing out and running out of memory due to large messages. Increasing memory to 512 MB provides more headroom for processing, and raising the timeout to 120 seconds gives the function enough time to complete without unnecessary cost. This directly addresses the memory leak and timeout issues while keeping complexity low.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Increase the function's memory to 1 GB and timeout to 540 seconds.

    Why it's wrong here

    Choosing 1 GB of memory and a 540-second timeout is excessive over-provisioning. Cloud Functions bill proportionally to allocated memory and duration, so this combination sharply increases cost without addressing the underlying processing inefficiency. Unless profiling shows the function genuinely requires that much memory, a smaller setting like 512 MB is sufficient, and a longer timeout doesn't prevent memory-exhaustion crashes.

  • Set up a retry policy on the Pub/Sub subscription to dead-letter undelivered messages.

    Why it's wrong here

    A Pub/Sub dead-letter subscription with retry policy is designed to quarantine messages that repeatedly fail processing; it does not alter the function's memory footprint. The function will still exhaust its allocated memory and crash, and only the failed message gets moved aside, allowing the rest of the backlog to continue failing. You would still need to fix the memory leak to actually make progress on the queue.

  • Increase the function's timeout to 120 seconds and reduce the batch size.

    Why it's wrong here

    Raising only the timeout to 120 seconds gives the function more time, but if it is being terminated for exceeding memory, more time cannot help. The 'batch size' here refers to Pub/Sub subscription's batch delivery settings, yet Cloud Functions push subscriptions deliver one message per invocation, so that knob has no effect. Memory is the constraining resource, and it remains unchanged at the default 256 MB.

  • Increase the function's memory to 512 MB and timeout to 120 seconds.

    Why this is correct

    Allocating 512 MB gives the function enough headroom to handle the message payload without exhausting the default 256 MB limit, and extending the timeout to 120 seconds ensures slower processing steps aren't cut off. This directly addresses both the memory-termination error and the short timeout, while keeping costs significantly lower than the 1 GB option. It is a right-sized adjustment based on the observed failure pattern.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

Courseiva writes every ACE question from scratch — 769 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.