Courseiva
mediumMultiple ChoiceObjective-mapped

Google ACE Practice Question: During a gcloud CLI session, a developer runs…

During a gcloud CLI session, a developer runs `gcloud config list` and sees the output shows `project = old-project`. They need to work in `new-project`. Which sequence of commands correctly switches projects and verifies the change?

⚠ Common exam trap

Google Cloud often tests the distinction between environment variables and configuration file settings, trapping candidates who think setting `GCLOUD_PROJECT` will update the output of `gcloud config list`.

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 new-project; gcloud config list

`gcloud config set project new-project` updates the active project in the local CLI configuration, and `gcloud config list` then displays the current configuration, confirming the change. This is the standard method to switch the working project for subsequent gcloud commands.

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 activate new-project; gcloud config list

    Why it's wrong here

    The `gcloud projects` command group does not include an `activate` subcommand; valid subcommands include `list`, `describe`, `create`, `delete`, and `get-iam-policy`. As a result, `gcloud projects activate new-project` returns an invalid command error and leaves the current project unchanged. To switch the active project, the correct command is `gcloud config set project new-project`, which updates the `core/project` property in the current configuration.

  • gcloud config set project new-project; gcloud config list

    Why this is correct

    Running `gcloud config set project new-project` updates the `core/project` property in the active configuration, making new-project the default project for subsequent gcloud commands. Following that with `gcloud config list` displays the configuration properties, including the newly set project value, providing immediate verification. This is the clean, targeted approach because it directly changes the persistent configuration and uses the built-in command for project selection.

  • gcloud auth login --project=new-project; gcloud config list

    Why it's wrong here

    Authentication and project selection are separate concerns in gcloud. `gcloud auth login` establishes credentials for a user account, while `--project` is not a command-specific flag for that subcommand; even if accepted as a global flag, it would only affect the invocation and would not update the active configuration's project setting. Therefore, after this command pair, `gcloud config list` would still show the original project, and the user's active project would remain unchanged.

  • export GCLOUD_PROJECT=new-project; gcloud config list

    Why it's wrong here

    The `GCLOUD_PROJECT` environment variable is not recognized by the gcloud CLI; the supported project-related variables are `GOOGLE_CLOUD_PROJECT` and `CLOUDSDK_CORE_PROJECT`. Even when one of those valid variables is set, it only overrides the project for certain SDK invocations and does not write to the persistent `core/project` property in the active configuration. Running `gcloud config list` still shows the original project, so this command sequence neither changes nor confirms the active project.

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.