Courseiva
Deploying and Implementing a Cloud SolutionmediumMultiple ChoiceObjective-mapped

Google ACE Deploying and Implementing a Cloud Solution Practice Question

A data scientist wants to deploy a Python function that processes messages from a Pub/Sub topic whenever a new message arrives. The function should be stateless and run in a serverless environment. Which deployment command should be used?

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

gcloud functions deploy my-function --runtime python39 --trigger-topic my-topic --entry-point my_entry --region us-central1

Cloud Functions is serverless and can be triggered by Pub/Sub. The command 'gcloud functions deploy' with --trigger-topic creates a function that is triggered by messages on the specified topic.

Answer analysis

Option-by-option breakdown

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

  • gcloud run deploy my-function --source . --region us-central1 --trigger-topic my-topic

    Why it's wrong here

    Cloud Run (fully managed) is designed for HTTP-triggered request handling; its deploy command accepts --image or --source and exposes a container via an HTTPS endpoint. There is no native --trigger-topic flag in gcloud run deploy; to connect Cloud Run to Pub/Sub you'd create a push subscription that forwards messages to the service's HTTP endpoint, not a direct trigger flag. Also the function code expected for Cloud Functions (with entry-point style) isn't the same as a Cloud Run service deployment.

  • gcloud functions deploy my-function --runtime python39 --trigger-topic my-topic --entry-point my_entry --region us-central1

    Why this is correct

    gcloud functions deploy with --trigger-topic creates an event-driven Cloud Function subscribed to a Pub/Sub topic. The --runtime python39 specifies the Python 3.9 execution environment, --entry-point my_entry identifies the function name inside main.py to invoke, and --region sets the deployment location. This is the only valid command that directly deploys the function and wires it to the specified Pub/Sub topic.

  • gcloud pubsub subscriptions create my-sub --topic my-topic --push-endpoint https://my-function-url

    Why it's wrong here

    This creates a push subscription that delivers messages to an existing HTTPS endpoint; it does not deploy or create any function. It assumes the function already exists and has a reachable URL. Also, using push subscriptions requires the function to be deployed first; this command alone cannot satisfy the requirement.

  • gcloud functions deploy my-function --runtime python39 --trigger-http --entry-point my_entry --region us-central1

    Why it's wrong here

    This deploys a Cloud Function triggered by HTTP requests, not Pub/Sub. The flag --trigger-topic is what links the function to a Pub/Sub subscription; --trigger-http exposes a public HTTPS endpoint but never connects to my-topic. Even though other parameters are correct, the trigger type is wrong for the stated requirement.

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

One of 769 original ACE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.