Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are setting up a local development environment on an IPv4-only Linux workstation for a Python microservice that integrates Pub/Sub, Cloud Spanner, Cloud Bigtable, and Firestore (Native mode). Your workflow must meet the following requirements:
Which sequence of actions should you perform?
gcloud components install bigtable-emulator firestore-emulator and gcloud components update.gcloud pubsub emulators start, gcloud bigtable emulators start, gcloud spanner emulators start, and gcloud firestore emulators start.gcloud config set api_endpoint_overrides/pubsub http://localhost:8085/ and gcloud config set auth/disable_credentials true so all Python client libraries and gcloud CLI commands automatically route to the emulators.Control+C to automatically restore production connectivity.This option attempts to install emulator components using incorrect component IDs, invokes non-existent gcloud command hierarchies, and relies on Google Cloud CLI configuration properties (api_endpoint_overrides and auth/disable_credentials) to redirect Python client libraries.
gcloud components install command recognizes pubsub-emulator, cloud-spanner-emulator, and cloud-datastore-emulator, not bigtable-emulator or firestore-emulator.gcloud emulators or gcloud beta emulators command groups (for example, gcloud beta emulators pubsub start), not under individual service groups such as gcloud pubsub emulators.gcloud CLI properties like api_endpoint_overrides/pubsub or auth/disable_credentials; they require *_EMULATOR_HOST environment variables. Furthermore, the Pub/Sub emulator explicitly does not support gcloud pubsub commands.Control+C terminates the processes, but any persistent gcloud config overrides or active *_EMULATOR_HOST variables remain active until manually reverted.api_endpoint_overrides only affects gcloud CLI commands (such as gcloud spanner), not application client libraries.gcloud beta emulators (or alpha), rather than top-level service commands.While the command syntax here is invalid, using gcloud config set api_endpoint_overrides/spanner http://localhost:9020/ alongside gcloud config set auth/disable_credentials true inside a dedicated gcloud configuration would be appropriate if the goal were specifically to run gcloud spanner CLI commands against a running Cloud Spanner emulator.
Developers often confuse gcloud CLI configuration overrides with client library environment variables. Always verify whether a tool reads gcloud properties or *_EMULATOR_HOST environment variables.
gcloud components install pubsub-emulator cloud-spanner-emulator and gcloud components update.--host-port flags so they bind to default addresses and reuse persisted local data across runs.gcloud config configurations create emulator and set auth/disable_credentials true so the Python client libraries automatically detect and connect to all four emulators.gcloud config configurations activate default after testing finishes.This approach installs the Pub/Sub and Spanner emulator components, launches all four emulators with default host and port settings, and uses Google Cloud CLI named configurations (gcloud config configurations) in an attempt to switch client library targets between local emulators and production.
[::1]:8085). Without --host-port=127.0.0.1:8085, it cannot accept IPv4 connections on an IPv4-only Linux workstation. Additionally, running multiple emulators concurrently requires explicitly specifying host and port bindings to prevent conflicts.gcloud configurations: Named gcloud configurations only control the gcloud CLI tool itself. Python client libraries do not consult gcloud config configurations or auth/disable_credentials; they require PUBSUB_EMULATOR_HOST, SPANNER_EMULATOR_HOST, BIGTABLE_EMULATOR_HOST, and FIRESTORE_EMULATOR_HOST.gcloud configurations does not stop running emulator processes or clear environment variables.gcloud components update beta and explicit --host-port arguments when running alongside other emulators.gcloud config configurations is designed to manage profiles for CLI administration, not runtime routing for application SDKs.Using gcloud config configurations create emulator and switching back with activate default would be the right pattern specifically for managing gcloud spanner CLI commands alongside api_endpoint_overrides/spanner, rather than configuring Python client libraries across all four services.
gcloud components install pubsub-emulator cloud-spanner-emulator, followed by gcloud components update and gcloud components update beta.gcloud beta emulators pubsub start --project=local-dev --host-port=127.0.0.1:8085, gcloud beta emulators bigtable start --host-port=localhost:8086, gcloud emulators spanner start, and gcloud emulators firestore start --host-port=127.0.0.1:8080.$(gcloud beta emulators pubsub env-init), $(gcloud emulators spanner env-init), export BIGTABLE_EMULATOR_HOST=localhost:8086, and export FIRESTORE_EMULATOR_HOST=127.0.0.1:8080.unset all four *_EMULATOR_HOST environment variables when testing finishes.Google Cloud CLI local emulators simulate the APIs of Pub/Sub, Cloud Spanner, Cloud Bigtable, and Firestore entirely on a local machine. They enable developers to build and run integration tests without incurring cloud costs or affecting production data.
gcloud components install pubsub-emulator cloud-spanner-emulator installs the standalone Pub/Sub and Spanner emulator packages. Running gcloud components update and gcloud components update beta ensures the Firestore emulator and beta command groups (including Bigtable, which downloads its binary automatically on first start if missing) are up to date.[::1]:8085) by default, passing --host-port=127.0.0.1:8085 ensures it binds cleanly on an IPv4-only system. Explicitly specifying --host-port for Bigtable (localhost:8086) and Firestore (127.0.0.1:8080), while Spanner uses localhost:9010 (gRPC) and localhost:9020 (REST), prevents port collisions across concurrent emulators.PUBSUB_EMULATOR_HOST, SPANNER_EMULATOR_HOST, BIGTABLE_EMULATOR_HOST, and FIRESTORE_EMULATOR_HOST. Using env-init for Pub/Sub and Spanner captures dynamically assigned or default ports, while exporting the Bigtable and Firestore variables directs those clients locally.Control+C or POST /shutdown for Firestore) and running unset on all four *_EMULATOR_HOST variables ensures subsequent Python executions target real Google Cloud endpoints.env-init subcommands to avoid hardcoding dynamically assigned ports.Unlike approaches that rely on gcloud config overrides or skip environment variable cleanup, this workflow properly isolates network bindings on IPv4 hosts, satisfies each service's exact installation and startup syntax, and cleanly resets shell state after tests finish.
gcloud components install cloud-datastore-emulator and gcloud components update.gcloud emulators firestore start --database-mode=datastore-mode, and start Pub/Sub, Bigtable, and Spanner with gcloud beta emulators <service> start.$(gcloud beta emulators pubsub env-init) to your shell startup profile (~/.bashrc) once so the emulator host and port remain valid across future restarts.POST request to /reset on each emulator's port.This option installs the legacy Cloud Datastore emulator, starts Firestore in Datastore mode, permanently caches env-init output in a shell profile, and attempts to terminate all four emulators using the /reset HTTP endpoint.
--database-mode=datastore-mode emulates Datastore-mode behavior, and cloud-datastore-emulator is only for the legacy Datastore emulator.env-init output must be evaluated each time an emulator starts because dynamically assigned port numbers can change upon restart. Placing it once in ~/.bashrc fails if the emulator restarts on a new port or is not running.POST request to /reset only clears stored data inside the Firestore emulator without shutting it down (stopping Firestore via HTTP requires /shutdown), and Pub/Sub, Bigtable, and Spanner do not shut down via /reset.cloud-spanner-emulator, pubsub-emulator, BIGTABLE_EMULATOR_HOST, FIRESTORE_EMULATOR_HOST, and unset cleanup./reset endpoint is a Firestore emulator feature for clearing test data between test suites without restarting the server.*_EMULATOR_HOST variables permanently in ~/.bashrc breaks production connectivity whenever emulators are not running.Starting gcloud emulators firestore start --database-mode=datastore-mode and calling POST http://HOST:PORT/reset would be appropriate if you were testing a Firestore in Datastore mode application and wanted to wipe database state between integration tests without restarting the emulator.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated