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 use Cloud Shell and the gcloud CLI to orchestrate and manage Google Cloud resources across multiple environments. To streamline switching between development, staging, and production workloads, you need to meet the following requirements:
gcloud CLI configurations with distinct project IDs, default compute regions, and zones.Which approach should you use?
export CLOUDSDK_CONFIG=$HOME/.config/gcloud to the end of your $HOME/.bashrc file, and then run gcloud config configurations create to create your named configurations.By default, Cloud Shell stores gcloud CLI preferences inside a temporary tmp folder scoped only to the current browser tab and ephemeral VM session. Setting the CLOUDSDK_CONFIG environment variable to $HOME/.config/gcloud inside $HOME/.bashrc redirects the Google Cloud CLI to read and write all configuration profiles onto Cloud Shell's 5 GB persistent disk mounted as your $HOME directory.
gcloud config configurations create creates isolated named profiles (such as dev, staging, and prod), each storing its own project ID, default compute region, default zone, and active account.$HOME/.bashrc executes on every interactive shell login, every new browser tab and restarted Cloud Shell session automatically inherits CLOUDSDK_CONFIG=$HOME/.config/gcloud and accesses the exact same configuration files.$HOME are preserved between Cloud Shell sessions, ensuring your named configurations survive VM restarts.gcloud config configurations activate without re-entering flags or settings.core/project, compute/region, and compute/zone across every terminal tab.gcloud, Terraform, and kubectl.gcloud init or gcloud config set commands at the start of every session.Unlike manually reinitializing settings or running gcloud config commands inside a root-level boot script, pointing CLOUDSDK_CONFIG to $HOME/.config/gcloud in $HOME/.bashrc uses the native Cloud SDK configuration directory mechanism on persistent storage. It natively supports multiple named profiles while keeping user-level configuration files safe across sessions.
GOOGLE_CLOUD_PROJECT and CLOUD_SHELL environment variables in your terminal session before running gcloud config set commands to write settings to persistent storage.GOOGLE_CLOUD_PROJECT and CLOUD_SHELL are pre-configured environment variables automatically populated by Cloud Shell when a session initializes. GOOGLE_CLOUD_PROJECT provides the active project ID for Application Default Credentials (ADC) libraries and tools like Terraform, while CLOUD_SHELL is set to true so applications can detect whether they are running inside Cloud Shell.
gcloud storage location: Neither GOOGLE_CLOUD_PROJECT nor CLOUD_SHELL controls where the gcloud CLI writes its configuration files; gcloud continues writing preferences to its temporary tmp folder.GOOGLE_CLOUD_PROJECT stores only a single project ID string and cannot maintain separate named configurations with distinct compute regions, zones, and account settings.GOOGLE_CLOUD_PROJECT at startup to match the currently selected console project.CLOUD_SHELL=true serves strictly as a runtime detection flag for scripts and applications.gcloud config set writes properties to the configuration directory controlled by CLOUDSDK_CONFIG, not GOOGLE_CLOUD_PROJECT.$HOME/.bashrc.A client application using Application Default Credentials or a Terraform deployment needed to read the active project ID from an environment variable, or if a script needed to verify whether it was executing inside Cloud Shell.
$HOME/.customize_environment script that runs gcloud config configurations create and gcloud config set commands so configurations are recreated whenever Cloud Shell boots.The $HOME/.customize_environment script is a Cloud Shell environment customization hook that executes automatically once when a Cloud Shell VM instance boots up. It runs in the background with root privileges and is intended for installing system-level Debian packages (such as using apt-get update and apt-get install) so custom utilities remain available across VM restarts.
root, not your user: Because $HOME/.customize_environment executes under the root account during VM startup, running gcloud config commands there applies settings to root's context rather than your active Cloud Shell user shell.gcloud: Without overriding CLOUDSDK_CONFIG, Cloud Shell still stores interactive user gcloud preferences in a temporary tmp folder per tab, so any changes made during work are lost in new tabs./var/log/customize_environment and creates /google/devshell/customize_environment_done upon completion.You needed to automatically install additional Linux packages, language runtimes, or command-line tools (such as erlang or system libraries) into your Cloud Shell VM image whenever the instance boots.
gcloud init inside your Cloud Shell tmux session to initialize your named configurations and rely on tmux to preserve them across new tabs and sessions.gcloud init is an interactive setup command in the Google Cloud CLI used to authorize credentials, create or select a Cloud SDK configuration, and configure default project, region, and zone properties. tmux is a terminal multiplexer enabled in Cloud Shell that preserves active shell state and running terminal processes when a browser tab refreshes or disconnects.
gcloud init forces you to interactively step through configuration setup whenever your Cloud Shell VM recycles after inactivity, violating the requirement to avoid manual reconfiguration.gcloud CLI preferences are stored in a temporary tmp folder scoped to a single tab, meaning opening a new browser tab or starting a fresh VM loses your named configurations.tmux is not permanent storage: While tmux improves continuity across brief browser refreshes or reconnections from another machine, it does not write gcloud configuration files to your $HOME persistent disk.gcloud init is designed for interactive initialization of the Cloud SDK, not automatic cross-session persistence in Cloud Shell.tmux only preserves live terminal session state while the underlying ephemeral Cloud Shell VM remains running.CLOUDSDK_CONFIG to $HOME, named configurations created by gcloud init are discarded when the VM shuts down.You were performing an initial interactive setup of the Google Cloud CLI on a local workstation, or if you only needed to resume an active terminal screen after refreshing your browser tab during an ongoing session.
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