Professional Cloud Developer · Domain 2: Building and testing applications · 23% of the exam
Task 2.1: Setting up your development environment.
Local emulators for Google Cloud services, the console, the Google Cloud CLI, Cloud Code, Gemini Cloud Assist, Cloud Shell and Cloud Workstations, and IDE integrations such as AI coding assistants and MCP servers.
Study it
Local development: emulators, the Google Cloud CLI, Cloud Code, Cloud Shell and Cloud Workstations
Lesson coming
AI tooling in the IDE: coding assistants, Gemini Cloud Assist and MCP servers
Try each one before opening the answer. Every option is explained, with the Google Cloud documentation page that proves it.
Question 1 · choose 1
Developers test a service against the local Firestore emulator. Before each
test run they start the emulator and run a script that loads 40,000 seed
documents, which takes four minutes:
gcloud emulators firestore start --host-port=localhost:8080
python seed.py
The team exported the seeded state once to ./seed with the emulator's export
feature. It wants each run to start from that seed without running seed.py,
and writes made by the tests must not change ./seed. How should the emulator
be started?
--import-data loads the exported data at startup, and without --export-on-exit the test writes are discarded at shutdown.
The Firestore emulator stores data only in memory and clears its contents when it shuts down, so seeded documents don't survive between runs. The gcloud emulators firestore start command takes --import-data, a file path to data loaded into the emulator at startup, and --export-on-exit, a directory where data is saved at shutdown. Importing the export at startup, without exporting on exit, gives every run the same starting data.
An app uses Firestore in Native mode. Its team runs the data-access tests against the Firestore emulator, started with gcloud emulators firestore start in its default Firestore Native mode, so that the tests never touch a shared database. It plans four new tests. Which test still needs a real Firestore database, because the emulator can't show what it checks?
AA test that removes all documents between test cases without restarting or shutting down the emulator
BA test that a new query filtering on status and ordering by updatedAt has every index it needs in production
CA test that starts every run from a set of documents exported earlier from the emulator
DA test that the test script can stop the emulator with an HTTP request when the run ends
Show the answer and why
AA test that removes all documents between test cases without restarting or shutting down the emulator
Incorrect
The emulator has a REST endpoint that deletes all of its data between tests without shutting it down.
BA test that a new query filtering on status and ordering by updatedAt has every index it needs in production
Correct
The emulator doesn't track composite indexes and runs any valid query, so it can't reveal a missing index.
CA test that starts every run from a set of documents exported earlier from the emulator
Incorrect
The emulator supports this locally: the gcloud reference lists a start flag that loads earlier exported data.
DA test that the test script can stop the emulator with an HTTP request when the run ends
Incorrect
The emulator can be stopped with a POST to its /shutdown endpoint.
The Firestore emulator replicates the production service with some notable limitations. It doesn't track composite indexes and instead executes any valid query, so the indexes an app needs must be checked against a real Firestore database. Clearing all data through the emulator's REST endpoint, starting from earlier exported data, and stopping the emulator with a POST to /shutdown all work locally.
An engineer starts a three-hour data migration script from a laptop with gcloud cloud-shell ssh --command="./migrate.sh", so that the script runs in Cloud Shell, close to the project. Each attempt stops after about 40 minutes, even with the laptop online the whole time. What should the engineer do?
ARun the migration from a Compute Engine VM instead of Cloud Shell
BStart the script with nohup inside the same Cloud Shell command
CTurn on Cloud Shell's ephemeral mode for faster sessions
DMove the script and its files into the $HOME directory first
Show the answer and why
ARun the migration from a Compute Engine VM instead of Cloud Shell
Correct
Cloud Shell is intended for interactive use only, and it ends non-interactive sessions automatically after 40 minutes.
BStart the script with nohup inside the same Cloud Shell command
Incorrect
The session itself is ended, and the script runs inside that session's VM.
CTurn on Cloud Shell's ephemeral mode for faster sessions
Incorrect
Ephemeral mode trades persistent storage for faster startup; it doesn't change how long a session may run.
DMove the script and its files into the $HOME directory first
Incorrect
Where the files live doesn't change the limit that ends the session.
Cloud Shell is intended for interactive use only: non-interactive sessions are ended automatically after 40 minutes. A long scripted job belongs on a resource meant to run unattended, such as a Compute Engine VM. Ephemeral mode and the location of files don't affect when a session ends.
A developer uses Cloud Code for VS Code on a new laptop and runs the Run on Cloud Run Emulator command for a service with a Dockerfile, so that the service rebuilds and reruns on every change. The command fails at the build step. The laptop has the gcloud CLI and Cloud Code, but no Docker or buildpacks tools. What should the developer do?
AEnable the Cloud Build API so that the emulator builds the image remotely
BGrant the developer Artifact Registry Writer on the team's repository
CClear the option that rebuilds and reruns automatically on changes
DInstall Docker or the buildpacks tools on the laptop and choose that builder
Show the answer and why
AEnable the Cloud Build API so that the emulator builds the image remotely
Incorrect
The emulator builds with locally installed tools; it doesn't hand the build to Cloud Build.
BGrant the developer Artifact Registry Writer on the team's repository
Incorrect
The failure is the missing local builder, not access to a repository.
CClear the option that rebuilds and reruns automatically on changes
Incorrect
Manual runs still need a builder to build the image locally.
DInstall Docker or the buildpacks tools on the laptop and choose that builder
Correct
Only locally installed build tools are available to the Cloud Run Emulator, which builds with Docker or buildpacks.
Cloud Code lets developers run a Cloud Run service locally on a Cloud Run emulator before deploying it. In the Run/Debug on Cloud Run Emulator dialog, the developer chooses Docker or buildpacks as the builder, and only locally installed build tools are available. Automatic rebuilds on change are an option, but every run needs a local builder.
A platform team governs developers' AI coding assistants with IAM, and in the production project nobody holds the MCP Tool User role (roles/mcp.toolUser). A developer's assistant, using the developer's own credentials, is denied when it calls tools of the Firestore remote MCP server at https://firestore.googleapis.com/mcp. Its calls to the Developer Knowledge MCP server at https://developerknowledge.googleapis.com/mcp succeed. Security asks why the IAM setup didn't stop those calls. What is the explanation?
AThe Developer Knowledge server runs on the developer's laptop and talks to the assistant over stdio, outside IAM
BDeveloper Knowledge is a Google MCP server, so the MCP Tool User role and IAM policies don't apply to it
CCalls to tools that only read data don't need the mcp.tools.call permission, whatever the server
DIAM changes take a few minutes to apply, so the Developer Knowledge calls will soon be denied as well
Show the answer and why
AThe Developer Knowledge server runs on the developer's laptop and talks to the assistant over stdio, outside IAM
Incorrect
It is a remote server that offers an HTTP endpoint on Google infrastructure; local servers are the ones that use stdio.
BDeveloper Knowledge is a Google MCP server, so the MCP Tool User role and IAM policies don't apply to it
Correct
Google remote MCP servers don't require MCP Tool User, and IAM policies or permissions can't control access to them.
CCalls to tools that only read data don't need the mcp.tools.call permission, whatever the server
Incorrect
On Google Cloud MCP servers every tool call needs mcp.tools.call; the difference here is the kind of server.
DIAM changes take a few minutes to apply, so the Developer Knowledge calls will soon be denied as well
Incorrect
No IAM policy controls access to Google remote MCP servers, however long the team waits.
Google Cloud remote MCP servers, such as the Firestore server, check the mcp.tools.call permission of the MCP Tool User role plus the roles on the resources. Google remote MCP servers, such as the Developer Knowledge API server listed among the Google MCP servers, don't require the MCP Tool User role, and IAM policies or permissions can't control access to them; they are governed with the existing administrative controls. Remote servers offer an HTTP endpoint, while local servers use stdio.
A team runs its unit and integration tests against the Spanner emulator. A new test measures how many read-write transactions per second two competing writers can commit on different rows. Why shouldn't the team trust its result for production?
AThe emulator supports only the PostgreSQL dialect
BThe emulator can't run read-write transactions at all
CThe emulator requires IAM roles that slow each transaction
DIn the emulator, a read-write transaction locks the entire database until it completes
Show the answer and why
AThe emulator supports only the PostgreSQL dialect
Incorrect
The emulator supports both the GoogleSQL and PostgreSQL dialects.
BThe emulator can't run read-write transactions at all
Incorrect
It runs them; it just runs them differently from production.
CThe emulator requires IAM roles that slow each transaction
Incorrect
The emulator doesn't support authentication or IAM at all.
DIn the emulator, a read-write transaction locks the entire database until it completes
Correct
This differs from production, so concurrency and throughput results don't carry over.
The Spanner emulator serves local development and testing. Among its documented differences from production: read-write transactions and schema changes lock the entire database for exclusive access until completion, and its performance and scalability don't compare to the production service. It doesn't support TLS, authentication or IAM.
Developers on a team use Cloud Shell as their main environment every working day and keep hitting the point where Cloud Shell can't be used until a reset date. What does Google suggest for them?
ASwitch Cloud Shell to ephemeral mode
BStart a new Cloud Shell session every few hours
CMove to Cloud Workstations
DInstall the tools in $HOME so that they load faster
Show the answer and why
ASwitch Cloud Shell to ephemeral mode
Incorrect
Ephemeral mode changes storage and startup time, not the weekly quota.
BStart a new Cloud Shell session every few hours
Incorrect
New sessions draw on the same weekly quota.
CMove to Cloud Workstations
Correct
Cloud Shell has a weekly quota of 50 hours by default; Google recommends Cloud Workstations for more use.
DInstall the tools in $HOME so that they load faster
Incorrect
Where tools live doesn't change how many hours Cloud Shell can be used.
The default weekly Cloud Shell quota is 50 hours; once it is reached, Cloud Shell can't be used until the quota resets. For more use, Google strongly recommends upgrading to Cloud Workstations, which doesn't have weekly usage limitations.
A developer connects an AI assistant to a Google Cloud remote MCP server and wants to add a custom prompt template of the team's own to that server. What does the MCP overview say about prompts on these servers?
AAny team can add its own prompts to a remote server from its client configuration
BPrompts are only available on local MCP servers
CPrompts must be uploaded to the server as resources
DThe server's own prompts can be used, but users can't define their own
Show the answer and why
AAny team can add its own prompts to a remote server from its client configuration
Incorrect
Prompts come from the server; clients can't add their own to it.
BPrompts are only available on local MCP servers
Incorrect
Remote servers also provide prompts as a feature.
CPrompts must be uploaded to the server as resources
Incorrect
Resources share data for context; they aren't a way to define prompts.
DThe server's own prompts can be used, but users can't define their own
Correct
The overview describes prompts as predefined inputs provided by MCP servers.
MCP servers support tools, prompts, resources and elicitation. Prompts are predefined inputs provided by MCP servers that help users interact with tools; a client can use the prompts that a server provides but can't define its own. Resources share data that gives context to language models.