mediumMultiple ChoiceObjective-mapped
Google ACE Practice Question: A developer works across five different GCP…
A developer works across five different GCP projects daily and wants to switch their active project in the gcloud CLI without rerunning `gcloud init`. Which command should they use?
⚠ Common exam trap
Google Cloud often tests the distinction between `gcloud config set` and `gcloud init`, trapping candidates who think they must reinitialize the CLI to change the active project, when in fact only a property update is needed.
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 config set project [PROJECT_ID]
The `gcloud config set project [PROJECT_ID]` command updates the `core/project` property in the active gcloud CLI configuration, allowing the developer to switch the active project without re-running `gcloud init`. This is the standard method for changing the project context in the current configuration, which persists across sessions until changed again.
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 projects switch [PROJECT_ID]
Why it's wrong here
The `gcloud projects switch` command does not exist; the `gcloud projects` group only manages project metadata such as create, describe, delete, and list. It never alters the active project for CLI calls. Changing the active project is a function of the gcloud configuration system, which is why `gcloud config set project [PROJECT_ID]` is the correct non-interactive approach.
- ✓
gcloud config set project [PROJECT_ID]
Why this is correct
Correct: `gcloud config set project [PROJECT_ID]` modifies the `project` property inside the current gcloud configuration. This persistently changes the default project for subsequent commands without rerunning the interactive `gcloud init` wizard. The change takes effect immediately, and it can be verified with `gcloud config get-value project` or overridden per-command using the `--project` flag.
- ✗
gcloud auth set-project [PROJECT_ID]
Why it's wrong here
`gcloud auth set-project` is not a valid command; the `gcloud auth` group only manages login credentials, like `gcloud auth login` and `gcloud auth activate-service-account`. Project selection is a separate configuration concern, not an authentication concern. Instead, use `gcloud config set project [PROJECT_ID]`, which specifically targets the project property in your active configuration.
- ✗
gcloud init --project=[PROJECT_ID]
Why it's wrong here
The `--project` flag is not accepted by `gcloud init`; this command is an interactive setup wizard that guides account authorization, default project selection, and region/zone configuration. Running `gcloud init --project=[PROJECT_ID]` results in an error because the flag is unrecognized. For a scriptable, non-interactive change to just the default project, `gcloud config set project [PROJECT_ID]` is the appropriate command.
Go deeper
Related to this question
Learn chapter
GCP Projects, Folders, and Organizations
Key term
gcloud CLI
The gcloud CLI is a command-line tool that lets you manage Google Cloud resources by typing commands instead of clicking through a web interface.
Key term
Switch
A switch is a networking device that connects devices on a local area network and uses MAC addresses to forward data only to the intended recipient.
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 →
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.