Courseiva

CCNA Setting Up a Cloud Solution Environment Questions

73 questions · Setting Up a Cloud Solution Environment · All types, answers revealed

1
MCQmedium

A company wants to manage multiple GCP projects with different configurations (e.g., different regions and accounts) on the same workstation. Which gcloud feature should they use to switch between these configurations?

A.Environment variables
B.gcloud init each time
C.Configuration profiles
D.Multiple gcloud installations
AnswerC

gcloud config configurations (also called profiles) let you create and store named sets of properties including project, account, and region, then switch between them instantly with 'gcloud config configurations activate PROFILE'. Each profile can have its own authenticated credentials because 'gcloud auth login' can be run while a profile is active, so you can maintain distinct identities and project scopes simultaneously — this is the built-in, designed mechanism for multi-project management.

Why this answer

Configuration profiles allow setting different sets of properties (project, region, account) and switching between them with 'gcloud config configurations activate'.

2
MCQeasy

What is the basic role that grants full control over all resources in a GCP project?

A.Editor
B.Owner
C.Viewer
D.Admin
AnswerB

The Owner basic role is the highest-level predefined role in Cloud IAM, encompassing all Editor permissions plus the ability to manage IAM policies, set billing accounts, and configure organization-level settings when applied at the project or organization level. An Owner can grant any role to any principal, including making another user an Owner, and can view or change the project's billing account and payment details. This role is typically reserved for a small number of administrators because it provides unrestricted management of the project and its entire resource hierarchy.

Why this answer

The Owner role (roles/owner) grants full access, including the ability to manage roles and billing.

3
MCQmedium

An organization needs to separate development, staging, and production environments using the GCP resource hierarchy. Which approach is most effective?

A.Create folders for dev, staging, and prod under the organization, then place projects in each folder
B.Use labels on projects to denote environment, but keep all in one folder
C.Create separate projects for each environment without folders
D.Create a single project and use separate VPC networks per environment
AnswerA

Folders in the Google Cloud resource hierarchy allow you to organize projects under the organization node, and you can apply IAM policies and organization policies at the folder level, which are inherited by all projects within. This gives you a natural separation between dev, staging, and prod while enabling consistent controls, e.g., different approval workflows or network configurations. Placing projects in environment-specific folders is the standard best practice for multi-environment governance.

Why this answer

Using folders under the organization node allows isolating environments, and organization policies can be applied at the folder level for governance.

4
MCQhard

An organization has multiple Google Cloud projects and wants to enforce a policy that all Compute Engine instances must use a specific set of approved machine types. Which tool should be used to implement this constraint?

A.Organization policies
B.IAM custom roles
C.VPC Service Controls
D.Cloud Scheduler
AnswerA

Organization policies allow hierarchical enforcement of constraints like allowed machine types.

Why this answer

Organization policies are used to enforce constraints across projects, folders, or the entire organization. The constraint 'compute.constraints.allowMachineTypes' can be set to restrict machine types. IAM roles control access, not resource configuration.

Cloud Scheduler is for cron jobs. VPC Service Controls is for data exfiltration prevention.

5
MCQeasy

An engineer needs to create a new GCP project using the Cloud SDK. They have already installed and initialized gcloud with a user account that has Billing Account Administrator and Project Creator roles. Which command creates the project 'my-new-project'?

A.gcloud config set project my-new-project
B.gcloud projects create my-new-project
C.gcloud alpha projects create my-new-project
D.gcloud init my-new-project
AnswerB

This is the canonical command for creating a new Google Cloud project via the CLI. It calls the Cloud Resource Manager projects.create API method, and requires the resourcemanager.projects.create permission (provided by the Project Creator IAM role). The command returns a project ID and number, and initially places the project in the 'ACTIVE' lifecycle state unless an organization policy restricts it. Use `--organization` or `--folder` flags to specify the parent resource.

Why this answer

The correct command to create a project is 'gcloud projects create'. It creates a new project with the specified ID.

6
MCQmedium

An organization wants to manage GCP resources for multiple teams using a hierarchy of folders and projects. They need to apply a uniform policy that restricts the regions where VM instances can be created across all projects in a folder. Which approach should they use?

A.Apply an organization policy with the `compute.allowedExternalIpAccess` constraint
B.Apply an organization policy with the `compute.restrictResourceCreation` constraint
C.Set an IAM policy on the folder that denies compute.instances.create permission in disallowed regions
D.Use gcloud config set compute/region and enforce with a script
AnswerC

Applying a folder-level IAM deny policy that denies compute.instances.create with a condition on resource.location is the correct approach because IAM conditions are evaluated at access time against the requested resource's attributes. You can specify that the request is denied unless resource.location is one of the allowed regions, and this applies to all projects in the folder. Deny policies override any allow bindings chain-wide, providing deterministic enforcement that works for Console, CLI, and API calls.

Why this answer

The correct approach uses IAM conditions to restrict resource creation based on location. While organization policies with the 'gcp.resource-locations' constraint are the recommended method, option C is the only valid choice among the given options. IAM policies on the folder with conditions can effectively deny compute.instances.create permission in disallowed regions, enforcing uniform control across all projects in the folder.

Exam trap

Candidates may confuse organization policy constraints with IAM policies. While organization policies are designed for such restrictions, IAM conditions can also achieve the same result.

7
MCQmedium

You need to list all projects in your organization using the gcloud CLI. Which command is correct?

A.gcloud compute projects list
B.gcloud config list
C.gcloud projects list
D.gcloud resource-manager projects list
AnswerC

gcloud projects list is correct: it calls the Cloud Resource Manager API (projects.list) and returns all projects that your authenticated account has permission to view, including those from your organization if you have the appropriate IAM roles. It supports flags like --filter, --limit, and --format to narrow and shape the output. This is the standard, documented command for enumerating projects.

Why this answer

'gcloud projects list' lists projects accessible to the authenticated user. To list all projects in an organization, you need the --filter or use organizations. But 'gcloud projects list' with appropriate permissions shows all projects.

The other commands are incorrect: 'gcloud config list' shows config, 'gcloud compute projects list' doesn't exist, 'gcloud resource-manager projects list' is not a command.

8
Multi-Selectmedium

A team wants to export GCP billing data for detailed analysis using SQL. Which three steps are necessary? (Choose THREE)

Select 3 answers
A.Enable Cloud Billing API
B.Create a Cloud Storage bucket
C.Create a BigQuery dataset
D.Set up billing export in the Cloud Console
E.Enable BigQuery API
AnswersC, D, E

Creating a BigQuery dataset is the necessary container that receives the exported billing tables. When you configure billing export, you must specify an already-existing dataset in the selected project; the export then creates and manages the underlying tables (e.g., `gcp_billing_export_v1_*`) within that dataset. Without a dataset, the billing export setup page in the Cloud Console will not allow you to proceed.

Why this answer

Billing export to BigQuery requires enabling BigQuery, creating a dataset, and configuring the export from billing.

9
Multi-Selectmedium

A developer wants to use Cloud Shell for managing GCP resources. Which three statements about Cloud Shell are true? (Choose THREE.)

Select 3 answers
A.It allows unlimited session duration without any timeout
B.It can be used only for projects that have billing enabled
C.It provides a web-based terminal in the GCP Console
D.It provides 5 GB of persistent disk storage in the user's home directory
E.It has gcloud, kubectl, and terraform pre-installed
AnswersC, D, E

Cloud Shell is a web-based terminal that launches directly from the Google Cloud Console, giving you authenticated command-line access to your GCP environment without needing to install the Google Cloud SDK locally. It automatically authenticates you using the same credentials as the console, and it also sets the current project so you can immediately run gcloud commands. This integration makes it the quickest way to test API calls, run kubectl against GKE clusters, or inspect resources while staying in the browser.

Why this answer

Cloud Shell provides a browser-based terminal with persistent 5GB home directory, and comes pre-installed with common tools like gcloud, kubectl, and terraform. It also includes a code editor.

10
Multi-Selecthard

You are designing a resource hierarchy for a company with three departments: Engineering, Sales, and HR. Each department should have its own projects, and policies should be applied at the department level. Which THREE steps should you take? (Choose three.)

Select 3 answers
A.Create a folder for each department
B.Use labels to separate departments
C.Create an organization node
D.Create a project for each department
E.Apply IAM policies at the project level only
AnswersA, C, D

Folders allow grouping projects per department.

Why this answer

Create an organization node (if not already present). Under it, create a folder for each department. Then create projects within each folder.

Apply IAM policies at the folder level.

11
MCQmedium

A developer wants to authenticate to GCP from their local machine using their own user account to run gcloud commands that interact with a project. They have already installed the Cloud SDK. Which command should they use to authenticate with their Google account?

A.gcloud init
B.gcloud auth activate-service-account
C.gcloud auth login
D.gcloud auth application-default login
AnswerC

gcloud auth login is the correct command because it launches an OAuth 2.0 authorization flow, typically opening a browser where the developer signs in with their Google account and grants consent to GCP scopes. Upon successful authentication, it saves the resulting user credentials in the credentials directory and sets them as the active account for subsequent gcloud CLI operations. This is the standard, direct way for a human developer to authenticate the gcloud command-line tool with their personal or Google Workspace user identity from a local machine.

Why this answer

`gcloud auth login` authenticates using a user account (OAuth 2.0) and is appropriate for interactive use. `gcloud auth application-default login` is for application credentials.

12
Multi-Selectmedium

You are setting up a new GCP project for a microservices application. You need to select which APIs to enable. Which THREE APIs are likely required? (Choose 3)

Select 3 answers
A.storage.googleapis.com
B.cloudbuild.googleapis.com
C.container.googleapis.com
D.compute.googleapis.com
E.bigquery.googleapis.com
AnswersB, C, D

Cloud Build (cloudbuild.googleapis.com) is the managed CI/CD service used to compile source code and build container images. For microservices, each service is typically packaged as a separate container, and Cloud Build provides a reliable, serverless way to automate those builds via triggers and build steps. It integrates with Artifact Registry to store the resulting images, which are then deployed to GKE, making it a common and often essential part of a microservices deployment pipeline.

Why this answer

For a microservices application on Kubernetes, you need the Kubernetes Engine API (container.googleapis.com), and often the Cloud Build API (cloudbuild.googleapis.com) for CI/CD and Compute Engine API (compute.googleapis.com) as a dependency for GKE. Cloud Storage API is not necessarily required unless using Cloud Storage. BigQuery is for analytics.

13
MCQmedium

A company wants to set up a budget alert at 50% and 90% of their projected monthly spending. Which service should they use?

A.Cloud Billing budgets
B.Cost breakdown reports
C.Cloud Scheduler
D.Cloud Monitoring alerts
AnswerA

Correct.

Why this answer

Cloud Billing budgets allow setting budget amounts and alerts at specified thresholds.

14
MCQeasy

A new engineer needs to set up the gcloud CLI on their local machine and authenticate with a user account. Which command should they run after installing the SDK?

A.gcloud init
B.gcloud auth application-default login
C.gcloud config set account
D.gcloud auth login
AnswerA

gcloud init is the intended bootstrap command for a new user because it performs the entire initial setup in one interactive flow: authenticating your Google account via the browser, then prompting you to choose or create a default project and set a default compute region/zone. It writes the resulting credentials and configuration properties into the active gcloud configuration file, leaving your environment ready for immediate use. This one-command workflow is exactly why it's the recommended starting point on a fresh workstation.

Why this answer

The 'gcloud init' command initializes the SDK, sets properties, and runs auth login. Alternatively, 'gcloud auth login' only authenticates without setting project/defaults.

15
MCQmedium

A company wants to track costs for each department by using labels on resources. What is the next step after labeling resources to view costs per label?

A.View billing reports filtered by label
B.Export billing to Cloud Storage and analyze
C.Create a billing account budget
D.Use the Cost Table in Cloud Console
AnswerA

Billing reports in Cloud Console support filtering by resource labels, which can be applied at project or resource level. By assigning a label like 'department=marketing' to resources, you can view cost breakdowns per department directly in the billing reports. This is the intended lightweight method for cost allocation without additional data processing.

Why this answer

Labels are key-value pairs attached to resources. To view cost breakdown, you can use billing reports or export to BigQuery and query by label.

16
MCQeasy

You are using Cloud Shell and need to access a file you created two weeks ago. What is the persistence behavior of Cloud Shell home directories?

A.Cloud Shell home directories are stored in Cloud Storage and are always available.
B.Cloud Shell home directories persist for 30 days after last use.
C.Cloud Shell home directories are temporary and are deleted after each session.
D.Cloud Shell home directories persist across sessions, with 5 GB of storage.
AnswerD

Cloud Shell provides each user with a persistent 5 GB home directory stored on a zonal persistent disk that is independent of the underlying compute instance. Because it is not tied to the VM's lifecycle, files you create remain available across all future Cloud Shell sessions, making it a reliable place to keep small scripts or configuration files.

Why this answer

Cloud Shell provides 5 GB of persistent home storage backed by Cloud Filestore or persistent disk. It persists across sessions, even if Cloud Shell is idle. However, it is not backed up; if the instance is reset, data may be lost.

But under normal use, data persists.

17
MCQmedium

A company has multiple Google Cloud projects and wants to track costs by department. They have already applied labels to resources with key 'department'. What is the next step to view costs grouped by department?

A.Run gcloud billing accounts list and parse the output
B.Set up a budget alert with department labels
C.Enable billing export to BigQuery and run a query
D.Go to Billing > Reports and filter by 'department' label
AnswerD

The Cloud Billing Reports page provides a native console view of cost data and includes filtering by labels such as 'department'. Once you select the appropriate time range and filter by the 'department' label, the report dynamically groups costs by that label, giving you the required department-level breakdown instantly and without any additional configuration. This is the correct and most direct tool for this task.

Why this answer

Costs can be viewed in the Cloud Console under Billing > Reports. You can filter by labels to see costs grouped by label values.

18
MCQhard

Your organization wants to enforce that all Compute Engine instances are created only in us-central1 and europe-west1. You need to implement this constraint across all projects in the organization. What should you do?

A.Apply an organization policy with constraint gcp.resourceLocations to allow only us-central1 and europe-west1.
B.Use VPC Service Controls to restrict access to Compute Engine API from other regions.
C.Use labels to tag instances and run a script to delete non-compliant ones.
D.Create an IAM policy denying the compute.instances.create permission in all other regions.
AnswerA

The gcp.resourceLocations organization policy constraint is a list constraint that defines the exact set of Google Cloud locations where new resources, including Compute Engine instances, may be created. Setting it to allow only us-central1 and europe-west1 at the organization or folder level makes non-compliance impossible at creation time, since the API call itself is rejected. This is a preventive, centralized governance mechanism that is inheritable across projects, making it the correct solution for enforcing geographic restrictions.

Why this answer

Organization policies can enforce constraints on resource locations. The constraint 'gcp.resourceLocations' restricts allowed locations. You set this at the organization level so it applies to all projects.

IAM roles don't enforce location. VPC Service Controls control data exfiltration, not location restrictions. Labels don't enforce location.

19
Multi-Selecthard

A startup wants to control costs across multiple GCP projects. They want to track spending by department and set budget alerts. Which THREE actions should they take?

Select 3 answers
A.Assign labels to resources indicating department
B.Use Cloud Monitoring to track costs
C.Enable billing export to BigQuery
D.Create separate billing accounts for each department
E.Set up a budget with threshold alerts in the billing account
AnswersA, C, E

Correct.

Why this answer

Using labels, budgets, and billing export enables tracking and alerts.

20
MCQhard

A company wants to grant a contractor read-only access to all Compute Engine instances in a specific project, but no other resources. Which IAM role should be assigned?

A.roles/compute.instanceAdmin.v1
B.roles/viewer
C.roles/compute.viewer
D.roles/iam.securityReviewer
AnswerC

This predefined role contains only read permissions for Compute Engine resources, including instances, disks, images, snapshots, instance templates, and usage metrics, and it allows you to see them in the Cloud Console without any write or administrative actions. It precisely matches the contractor's access need and nothing more, upholding the principle of least privilege. As the correct answer, it is the best fit for granting read-only access to Compute Engine resources only.

Why this answer

Predefined roles like 'compute.viewer' provide read-only access to Compute Engine resources. The basic 'Viewer' role would also grant read access to other services, which is not desired.

21
MCQeasy

A new engineer wants to set up their local environment to interact with Google Cloud. Which command initializes the gcloud CLI and configures the project, region, and zone?

A.gcloud auth login
B.gcloud auth application-default login
C.gcloud init
D.gcloud config set project my-project
AnswerC

gcloud init is the correct command because it performs a complete guided initialization of the local gcloud environment: it authenticates using either a user account or service account, sets a default project, and optionally configures compute/region and compute/zone properties in a new or existing configuration. It also runs an initial diagnostic to verify the installation and, if needed, can re-initialize an existing configuration. This one command provides the foundational project and location context that other gcloud commands depend on.

Why this answer

The 'gcloud init' command initializes the SDK, sets default project, region, and zone interactively. 'gcloud auth login' only handles authentication. 'gcloud config set' sets individual properties but doesn't initialize. 'gcloud auth application-default login' is for application default credentials.

22
MCQhard

After creating a new GCP project, an engineer attempts to delete it using `gcloud projects delete PROJECT_ID` but receives an error. What is the most likely cause?

A.The project still has running resources (e.g., VM instances)
B.The IAM policy prevents deletion
C.The project ID is invalid
D.The project is linked to a billing account that must be disabled first
AnswerD

Before a GCP project can be deleted, its billing account attachment must be removed by disabling billing or unlinking the billing account. GCP will reject the deletion if the project is still linked to an active Cloud Billing account, returning an error such as 'Project is linked to a billing account'. You must disable the project's billing association first, then retry the deletion. This is the typical failure after creating a new project because billing is enabled by default.

Why this answer

A project cannot be deleted if it has a billing account attached. The billing account must be disabled (disassociated) first.

23
MCQhard

You are setting up billing for a new GCP project. You want to receive an alert when the projected cost for the month exceeds 80% of your budget. You also want to be notified if the actual cost reaches 100%. Which budget alert thresholds should you set?

A.Set a single alert at 100% and use the 'forecast' option to get projected cost alerts
B.Set a single alert at 80% and another at 100%
C.Set alerts at 50%, 80%, and 100%
D.Set a single alert at 80% for projected cost; GCP automatically alerts at 100%
AnswerB

Configuring two budget alerts at 80% and 100% satisfies the requirement precisely: the 80% threshold warns you that costs are approaching the limit while there is still time to act, and the 100% threshold notifies you the moment the budget is fully consumed. Google Cloud's budget feature allows multiple alert thresholds on the same budget, each published to your selected notification channels. This approach avoids alert fatigue and covers both proactive and reactive notification needs.

Why this answer

Budget alerts can be set at specific percentages, but only whole numbers are allowed. Typically, you set alerts at 80% and 100%. The 80% alert is for projected cost, and 100% is for actual cost.

24
MCQmedium

You need to delete a GCP project, but the deletion fails with an error. What is the most likely cause?

A.The project has IAM policies attached
B.The project still has active resources such as Compute Engine instances
C.The project is in a folder
D.The project's billing account is still linked
AnswerD

The correct answer is that a linked billing account prevents project deletion. Google Cloud requires you to disable billing for a project before it can be deleted, because deletion finalizes cost responsibility and prevents accidental ongoing charges. The console will display an error such as 'Billing must be disabled' if the project is still linked to a billing account. You must detach the billing account or disable the project's billing, then initiate the deletion process.

Why this answer

GCP requires that billing be disabled before a project can be deleted. If billing is still active, deletion will fail.

25
MCQeasy

You need to install the Google Cloud SDK on a Linux machine. Which command should you use to add the Cloud SDK distribution URI as a package source?

A.curl https://sdk.cloud.google.com | bash
B.gcloud init
C.sudo apt-get install google-cloud-sdk
D.echo 'deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main' | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
AnswerD

This command correctly configures the official Cloud SDK apt repository on a Debian or Ubuntu system by appending a sources.list entry with the signed-by parameter pointing to the imported Google signing key at /usr/share/keyrings/cloud.google.gpg. Using signed-by binds the repository to that specific key instead of trusting the global apt keyring, which is the recommended security practice. After running this, you still need to run sudo apt-get update and sudo apt-get install google-cloud-sdk, but this repository definition is the essential correct foundation for the package-manager installation method.

Why this answer

The Cloud SDK installation guide for Linux uses echo to add the URI to /etc/apt/sources.list.d/google-cloud-sdk.list.

26
MCQmedium

An engineer needs to enable the Compute Engine API for a project using the gcloud command line. Which command should they run?

A.gcloud compute instances enable-api
B.gcloud services list --enabled
C.gcloud api enable compute
D.gcloud services enable compute.googleapis.com
AnswerD

This is the correct command to enable the Compute Engine API. `gcloud services enable compute.googleapis.com` tells the Service Usage API to enable the service in the current project. It uses the fully-qualified service name and is the standard gcloud method for this operation. After running it, you can create and manage Compute Engine instances via gcloud or the Console.

Why this answer

The command 'gcloud services enable compute.googleapis.com' enables the Compute Engine API for the current project. The other options either list services or are incorrect.

27
MCQmedium

You want to use gcloud CLI to set the default project to 'my-project' and the default compute zone to 'us-central1-a'. Which two gcloud config commands should you run?

A.gcloud config configurations set project my-project and gcloud config configurations set zone us-central1-a
B.gcloud config set project my-project and gcloud config set compute/zone us-central1-a
C.gcloud config set project my-project and gcloud config set zone us-central1-a
D.gcloud projects set my-project and gcloud compute zones set us-central1-a
AnswerB

The correct way to set the default project is `gcloud config set project my-project`, which updates the active configuration's core project property. The zone must be set as `compute/zone` because it belongs to the compute section of the property hierarchy; `gcloud config set compute/zone us-central1-a` is the accepted syntax. Together these commands ensure that subsequent gcloud commands automatically use the intended project and zone, which is essential for quick CLI workflows.

Why this answer

The commands are 'gcloud config set project my-project' and 'gcloud config set compute/zone us-central1-a'.

28
MCQmedium

An engineer needs to enable the Compute Engine API for a project using the CLI. Which command should they run?

A.gcloud compute enable
B.gcloud services enable compute
C.gcloud api enable compute.googleapis.com
D.gcloud services enable compute.googleapis.com
AnswerD

'gcloud services enable compute.googleapis.com' is the correct command to enable the Compute Engine API for the active project. The 'gcloud services' command group interacts with the Service Usage API to manage service availability. This command uses the fully qualified service name 'compute.googleapis.com', which is required for successful enablement. You can also specify a project with the '--project' flag if the API should be enabled for a different project than the current one.

Why this answer

The 'gcloud services enable' command enables APIs in a project. The service name for Compute Engine is compute.googleapis.com.

29
MCQeasy

Your organization has multiple Google Cloud projects. You want to separate development and production environments. Which resource hierarchy structure is recommended?

A.Create two separate organizations.
B.Use labels on projects to differentiate environments.
C.Use a single project with separate VPC networks.
D.Use folders under the organization node to separate dev and prod projects.
AnswerD

Folders provide logical grouping and policy inheritance.

Why this answer

Using folders under an organization node allows grouping projects by environment. Folders support IAM policies and org policies, enabling environment separation. Projects alone cannot nest; folders provide the logical grouping.

30
Multi-Selectmedium

An administrator needs to create a custom IAM role that allows listing projects and viewing billing accounts. Which TWO permissions should be included?

Select 2 answers
A.billing.accounts.list
B.billing.accounts.create
C.resourcemanager.projects.create
D.resourcemanager.projects.list
E.resourcemanager.projects.delete
AnswersA, D

Correct. The billing.accounts.list permission is the specific IAM permission that allows a principal to enumerate the billing accounts they can access. Including this permission in the custom role is essential and sufficient for the read-only task of listing billing accounts; without it, any API call or console view that attempts to list billing accounts will fail with a permission denied error.

Why this answer

resourcemanager.projects.list and billing.accounts.list allow these actions.

31
MCQmedium

An administrator wants to set up a budget alert that triggers at 50%, 90%, and 100% of the monthly spending limit. What is the correct way to configure this?

A.Create a budget with a single threshold of 100% and rely on Cloud Monitoring
B.Use Cloud Billing reports to manually track
C.Create three separate budgets, each with a single threshold
D.Create one budget with three threshold rules: 50%, 90%, 100%
AnswerD

Creating one budget with three threshold rules is the recommended and most efficient approach because Cloud Billing budgets natively support multiple thresholds—each can be a percentage of the budget amount and trigger an alert independently. For example, you can set actual-cost thresholds at 50%, 90%, and 100%, and optionally add forecasted-cost thresholds as well. This gives you the desired notification at each stage without duplicating budget resources.

Why this answer

Budget alerts can have multiple threshold rules with different percentages. You can create a single budget with three threshold rules.

32
MCQmedium

A developer needs to authenticate to Google Cloud from their local machine to run application code that reads from Cloud Storage. They use a service account. Which gcloud command should they use to obtain application credentials?

A.gcloud auth login
B.gcloud config set account service-account@project.iam.gserviceaccount.com
C.gcloud auth application-default login
D.gcloud auth activate-service-account --key-file=KEY_FILE
AnswerD

The command `gcloud auth activate-service-account --key-file=KEY_FILE` is the correct way to authenticate gcloud with a service account using its private key JSON file. It reads the key file, derives the service account email, and establishes that identity as the active authenticated account for gcloud CLI operations. This command both authenticates and activates the service account in one step, enabling subsequent gcloud commands to inherit that identity.

Why this answer

The command 'gcloud auth application-default login' obtains user credentials for Application Default Credentials (ADC). For a service account, they would use 'gcloud auth activate-service-account' or set the GOOGLE_APPLICATION_CREDENTIALS environment variable.

33
Multi-Selecthard

An engineer needs to choose a location for a new GCP project's resources to maximize availability and minimize latency for users in Europe and Asia. Which three actions should they take? (Choose THREE)

Select 3 answers
A.Use a global load balancer to distribute traffic
B.Set the project default region to us-central1
C.Deploy resources in europe-west1 and asia-east1
D.Use a single zone in europe-west1 for simplicity
E.Enable Cloud CDN to cache content at edge locations
AnswersA, C, E

Global external HTTPS load balancing leverages a single anycast IP address and Google's global backbone to forward each user request to the optimal backend based on latency and health. It performs traffic distribution at L7 to the nearest available region, allowing active/active serving across multiple regions without DNS round-robin. This is the standard control plane that unifies multi-region deployments into one global endpoint.

Why this answer

Using multiple regions, load balancing, and a global resource like Cloud CDN can help achieve high availability and low latency.

34
Multi-Selectmedium

A DevOps engineer wants to set up budget alerts for a GCP project so that the finance team is notified when costs reach 50% and 90% of the budget. Which two configurations are required? (Choose TWO.)

Select 2 answers
A.Enable billing export to BigQuery
B.Create a budget in the Cloud Billing console
C.Set up a Cloud Function to monitor billing
D.Configure alert thresholds at 50% and 90%
E.Assign the roles/billing.admin IAM role to the finance team
AnswersB, D

Creating a budget in the Cloud Billing console is the foundational action that enables all budget alerting. You define the total budget amount, optionally scope it to specific projects, folders, or billing accounts, and then attach alert threshold rules. Without an actual budget object, there is nothing to trigger a notification, so this is the non-negotiable first step in the workflow.

Why this answer

To set up a budget alert with thresholds, you need to create a budget (specifying the amount and scope) and then set alert thresholds (percentages). The budget can also include Pub/Sub notifications, but the question asks for required configurations.

35
MCQeasy

Which gcloud command is used to set the default project for a configuration profile?

A.gcloud init
B.gcloud config set project
C.gcloud projects set
D.gcloud projects list
AnswerB

gcloud config set project PROJECT_ID is the correct command because it updates the core/project property in the active gcloud configuration. This directly sets the default project used by subsequent gcloud commands when no --project flag or CLOUDSDK_CORE_PROJECT environment variable is provided. It is the standard, non-interactive method to change the current default project within a given configuration.

Why this answer

The command 'gcloud config set project [PROJECT_ID]' sets the default project in the current active configuration. The other commands are for other purposes.

36
MCQmedium

An organization wants to enforce a policy that disables the creation of VMs with external IPs across all projects. Which resource hierarchy level should the policy be attached to for maximum coverage?

A.Project
B.Resource (VM)
C.Organization
D.Folder
AnswerC

The organization node is the root of the GCP resource hierarchy, and it is the correct place to attach an organization-wide policy. Any IAM role binding or organization policy constraint set at this level is inherited by every folder, project, and resource in the hierarchy, thereby ensuring the policy is enforced across all projects while also applying automatically to any future projects created under the organization.

Why this answer

Organization policies can be applied at the organization level to affect all projects and folders underneath. This ensures the policy covers all resources.

37
Multi-Selectmedium

Your company has a production project and a development project. You want to ensure that no one can delete the production project accidentally. Which TWO actions should you take? (Choose 2)

Select 2 answers
A.Apply an organization policy constraint that blocks project deletion.
B.Set a deletion protection policy on the project.
C.Set a budget alert at 100% of projected spend.
D.Remove the Owner role from all users and grant only Editor.
E.Add a label to the project indicating it is production.
AnswersA, B

Organization policy constraints are centralized guardrails evaluated by Google Cloud Resource Manager before IAM. Applying a boolean constraint such as `constraints/resourcemanager.projectDelete` at the organization or folder level explicitly denies the `resourcemanager.projects.delete` action for every principal, overriding project-level IAM roles. This makes it an authoritative, non-bypassable control that prevents a production project from being deleted from any console or API path.

Why this answer

To prevent accidental deletion, you can set a deletion protection policy at the project level. Additionally, using an organization policy constraint 'constraints/resourcemanager.projectDelete' at the folder or organization level can block deletion. Labels don't prevent deletion.

Removing the Owner role from all users would break management. Budget alerts don't prevent deletion.

38
Multi-Selectmedium

An engineer is setting up a new GCP project for a containerized application. They need to enable the required APIs. Which TWO APIs must be enabled to deploy and manage a Kubernetes cluster and build container images?

Select 2 answers
A.compute.googleapis.com
B.bigquery.googleapis.com
C.cloudbuild.googleapis.com
D.container.googleapis.com
E.cloudfunctions.googleapis.com
AnswersC, D

Cloud Build is Google Cloud's CI/CD service that can compile source code and build Docker container images. If the engineer's containerized application is built from a repository, enabling cloudbuild.googleapis.com is required before Cloud Build can push built images to Container Registry or Artifact Registry. Thus, for a project that automates image creation for GKE, this API is a correct and necessary dependency.

Why this answer

Kubernetes Engine API and Cloud Build API are needed for cluster management and building images.

39
Multi-Selectmedium

You need to view the current gcloud configuration settings, including the active account, project, and compute region. Which TWO commands can you use? (Choose two.)

Select 2 answers
A.gcloud config list
B.gcloud config describe
C.gcloud projects list
D.gcloud auth list
E.gcloud info
AnswersA, E

Running `gcloud config list` displays all the active property settings in your current gcloud configuration, such as account, project, and compute region/zone, in a clean key=value format. You can use `gcloud config list --all` to view every settable property, including those with unset defaults. This is the standard, most direct way to inspect your working configuration.

Why this answer

gcloud config list displays all configuration properties. gcloud info provides detailed information, including configuration.

40
MCQeasy

Which of the following is true about Cloud Shell?

A.Cloud Shell has 5 GB of persistent home directory storage.
B.Cloud Shell requires installation of gcloud and kubectl manually.
C.Cloud Shell only supports the gcloud CLI, not kubectl.
D.Cloud Shell provides a persistent VM that can run for hours.
AnswerA

Cloud Shell provides a temporary, ephemeral VM, but your home directory is backed by a persistent 5 GB disk in Google-managed storage. That 5 GB is the permanent part of the environment — it survives session restarts, VM recycling, and timeouts. This means any files you save under $HOME, including SSH keys, configuration files, and scripts, remain available across all future Cloud Shell sessions, while the compute instance itself is recreated as needed.

Why this answer

Cloud Shell provides a temporary virtual machine with 5 GB of persistent home directory storage, and the gcloud, kubectl, and terraform tools are pre-installed. The home directory persists across sessions, but the VM is ephemeral (after 20 minutes of inactivity the VM is terminated, but home directory persists).

41
MCQmedium

A company wants to track and forecast GCP spending across different departments. They have already set up labels on resources to indicate the department. Which additional step should they take to analyze costs by department in BigQuery?

A.Enable billing export to BigQuery in the Cloud Billing console
B.Use the Cloud Billing API to programmatically fetch cost data and write it to BigQuery
C.Run a scheduled query in BigQuery that calls the Cloud Billing API
D.Create a Cloud Function that captures billing events and inserts them into BigQuery
AnswerA

Enabling billing export to BigQuery in the Cloud Billing console is the native, fully managed integration for this use case. It automatically creates a set of BigQuery tables (e.g., gcp_billing_export_resource_v1) that contain detailed line items including cost, usage, labels, and resource hierarchy, updated on an ongoing basis. This export requires no custom code and provides the historical, labelled data needed to track and forecast GCP spending across departments using standard SQL and BI tools.

Why this answer

Enabling billing export to BigQuery will stream billing data (including labels) into a BigQuery dataset, allowing custom queries and analysis.

42
MCQmedium

You are managing a project and need to create a custom IAM role that allows only the permissions compute.instances.list and compute.instances.get. What is the correct way to create this role using gcloud?

A.gcloud iam service-accounts create viewer --permissions="compute.instances.list,compute.instances.get"
B.gcloud iam roles create viewer --organization=123456 --permissions="compute.instances.*"
C.gcloud iam roles create viewer --project=my-project --permissions="compute.instances.list,compute.instances.get"
D.gcloud iam custom-roles create viewer --project=my-project --permissions='compute.instances.list,compute.instances.get'
AnswerC

This is the correct command: `gcloud iam roles create` creates a custom role scoped to the specified project, and the `--permissions` flag explicitly lists the two required read-only permissions. Using specific permission names without wildcards enforces least privilege and aligns with IAM's requirement for fully qualified permission identifiers. The resulting role can then be bound to users or groups with `gcloud projects add-iam-policy-binding`.

Why this answer

The command 'gcloud iam roles create' is used to create custom roles. The permissions are specified with the --permissions flag.

43
MCQmedium

An engineer is setting up Cloud Shell for the first time. They notice that their home directory persists across sessions. How much storage is allocated to the home directory in Cloud Shell?

A.10 GB
B.1 GB
C.20 GB
D.5 GB
AnswerD

Correct. Cloud Shell provisions a 5 GB persistent home directory, mounted at $HOME, that survives between sessions. This is the documented, fixed quota for free Cloud Shell usage, regardless of session time or usage patterns.

Why this answer

Cloud Shell provides 5 GB of persistent home directory storage.

44
MCQmedium

An engineer wants to authenticate to Google Cloud using their own user credentials and also set up application default credentials for a local development environment. Which sequence of gcloud auth commands should they use?

A.gcloud auth login then gcloud auth application-default login
B.gcloud auth application-default login then gcloud auth login
C.gcloud init then gcloud auth login
D.gcloud auth configure-docker then gcloud auth login
AnswerA

This is the correct setup sequence for local development. First, `gcloud auth login` authenticates your user account and stores credentials for gcloud CLI commands in the user's config directory. Then, `gcloud auth application-default login` creates the `application_default_credentials.json` file, which allows Google Cloud client libraries to discover credentials via Application Default Credentials. Having both ensures gcloud and code-based SDKs use the same identity.

Why this answer

First, use 'gcloud auth login' to authenticate the gcloud CLI with user credentials. Then, use 'gcloud auth application-default login' to set up application default credentials for local development. The other options are incorrect or reversed.

45
MCQhard

A team is using gcloud configurations to manage multiple projects. They want to create a new configuration for a production project. How can they achieve this?

A.Run 'gcloud init' and select 'Create a new configuration'
B.Run 'gcloud config configurations create prod' then 'gcloud config set project prod-project'
C.Run 'gcloud config set project prod-project' with a flag to create new config
D.Edit the gcloud config file manually
AnswerB

The correct method is to first run gcloud config configurations create prod, which generates a new empty named configuration and automatically activates it. With the prod configuration active, gcloud config set project prod-project then sets the project property for that configuration, providing a clean, isolated environment for managing the prod project.

Why this answer

Manage configurations with 'gcloud config configurations create' and then set properties. Switching is done with 'gcloud config configurations activate'.

46
MCQeasy

A developer wants to use gcloud CLI with application default credentials (ADC) to authenticate to Google APIs from their local machine. Which command should they run first?

A.gcloud auth login
B.gcloud init
C.gcloud auth application-default login
D.gcloud config set auth/application_default true
AnswerC

gcloud auth application-default login is the correct command because it explicitly generates Application Default Credentials, storing them in the standard location (typically ~/.config/gcloud/application_default_credentials.json). These credentials are then picked up automatically by Google Cloud client libraries when no explicit service account key is supplied, enabling local development to use your user account's permissions as ADC.

Why this answer

gcloud auth application-default login sets up ADC for the user. This stores credentials that can be used by Google client libraries.

47
MCQhard

A team is using Cloud Shell to manage resources. They notice that their home directory is persistent across sessions, but they want to ensure that configuration files and scripts are also available after they stop and restart Cloud Shell. What should they do?

A.Use gcloud config configurations and save scripts in a Cloud Storage bucket
B.Create a startup script that runs every time Cloud Shell starts
C.Store files in /tmp
D.Store files in the home directory (~)
AnswerD

Cloud Shell automatically mounts a persistent home directory at ~ on a small but durable disk that is attached to your user profile across sessions. Any files, Bash scripts, or gcloud configuration files you place in ~ remain available even when the underlying VM is replaced. This is the intended and simplest way to preserve your work in Cloud Shell, and it also houses the .config directories used by gcloud.

Why this answer

Cloud Shell's home directory persists 5 GB of data. As long as files are stored in the home directory ($HOME), they will persist across sessions.

48
MCQhard

An organization has multiple GCP projects and wants to centralize billing analysis across all projects. They need to export detailed billing data (e.g., cost per SKU per project) to a BigQuery dataset. Which billing export option should they configure?

A.Export to CSV to Cloud Storage
B.Export to Cloud Billing report
C.Export to a Pub/Sub topic
D.Export detailed billing data to BigQuery
AnswerD

Exporting detailed billing data to BigQuery is the correct approach because it automatically creates and maintains tables like `gcp_billing_export_v1` within your project's BigQuery dataset. Every project that shares the billing account is included, and you can immediately run SQL queries to analyze costs by project, service, SKU, or label, as well as build dashboards and scheduled queries. This export is the official Google-recommended method for centrally managing and analyzing billing information across an organization.

Why this answer

The standard usage cost export to BigQuery provides detailed billing data for analysis.

49
Multi-Selecthard

An engineer needs to create a new project and set up the environment. They are using the gcloud command-line tool. Which two commands are required to create a project and link it to a billing account? (Choose TWO.)

Select 2 answers
A.gcloud billing projects link PROJECT_ID --billing-account=BILLING_ACCOUNT_ID
B.gcloud projects create PROJECT_ID
C.gcloud alpha billing accounts create
D.gcloud services enable cloudbilling.googleapis.com
E.gcloud config set project PROJECT_ID
AnswersA, B

This command explicitly associates a specified project with a specified billing account. It is the standard gcloud operation for setting up the billing relationship after project creation, enabling the project to consume paid services. The command requires both the project ID and the billing account ID as arguments, and it performs an API call to the Cloud Billing API. Once run, the project's billing is active and can be used for resource consumption.

Why this answer

To create a project and link a billing account, you need to create the project (gcloud projects create) and then link the billing account (gcloud billing projects link).

50
Multi-Selectmedium

A company wants to manage multiple Google Cloud projects and enforce consistent security policies across all of them. Which TWO resources should they use? (Choose two.)

Select 2 answers
A.Cloud Audit Logs
B.Organization policies
C.Shared VPC
D.Folders
E.Labels
AnswersB, D

Organization policies — The Organization Policy service is the correct mechanism for centrally governing multiple projects. It applies constraints like `compute.vmExternalIpAccess` or `iam.disableServiceAccountKeyCreation` at the organization, folder, or project level, and these constraints are inherited by all descendant resources. This provides a hierarchy-wide, enforceable governance layer that either permits or denies certain API calls before they execute. It directly meets the requirement to manage and enforce rules across all projects in the organization.

Why this answer

Organization policies are used to enforce constraints across projects. Folders allow grouping projects and applying common IAM policies.

51
MCQhard

Your company wants to track costs per department. Each department has its own project. You need to set up a budget alert in the billing account for each project. What is the most efficient approach?

A.Use Billing Export to BigQuery and create custom alerts using Cloud Monitoring.
B.Create one budget per project by selecting the project in the 'Scoped to' field.
C.Create a budget for each project by manually enabling billing for each project.
D.Create a single budget for the entire billing account and rely on labels.
AnswerB

Creating one budget per project and setting the 'Scoped to' field to that project is the correct, efficient approach. In the Google Cloud console, budgets are created at the billing account level but can be scoped to a specific project, which allows the budget amount and alert thresholds to apply exclusively to that project's costs. This directly enables per-department tracking if each department maps to a project, and it provides native budget alert notifications, exactly as required.

Why this answer

You can create budgets at the billing account level with scoped projects. This allows one budget per project. Creating budgets per project individually is manual.

Using labels requires tagging resources. Billing export to BigQuery is for analysis, not alerts.

52
MCQhard

You are configuring a new project and need to enable the Compute Engine API. However, the command 'gcloud services enable compute.googleapis.com' fails with a permission error. Your user has the role roles/editor on the project. What is the likely cause?

A.The Compute Engine API is already enabled.
B.The user needs to authenticate again.
C.The user does not have the serviceusage.services.enable permission.
D.The project does not have a billing account associated.
AnswerD

Enabling the Compute Engine API requires the project to have a billing account associated with it, because even though Compute Engine offers a free tier, the service's resource management, quotas, and metering are tied to billing to prevent abuse and allow for usage tracking. When a project has no billing account, the Service Usage API returns an error like "Billing account must be linked to project" or "Billing is required for usage", and this occurs regardless of the user's IAM role or authentication state. Associating a billing account at the project level—through the Cloud Console or the gcloud billing projects link command—is the prerequisite that resolves this error.

Why this answer

The role roles/editor includes serviceusage.services.enable permission, so it should work. However, if the organization has an org policy 'constraints/compute.restrictResourceCreation' that restricts API usage, it might block. But the most common issue is that the project is new and the billing account is not associated, preventing API enablement.

Editor role has permission, but billing must be active.

53
MCQhard

An organization wants to enforce that all projects under a specific folder have a set of constraints, such as disabling default network creation and requiring shielded VMs. What is the most efficient way to achieve this?

A.Use Cloud Shell to run scripts in each project.
B.Create IAM roles to restrict default network creation.
C.Use a service account to enforce policies.
D.Apply organization policies at the folder level.
AnswerD

Applying organization policies at the folder level is correct because constraints are inherited by all projects and subfolders under that folder. For example, the compute.skipDefaultNetworkCreation constraint can be set at a folder to prevent any project inside it from creating the default VPC network at project creation time. This ensures consistent, centrally managed governance across an entire team or environment without needing to configure each project individually.

Why this answer

Organization policies can be applied at the folder level, inheriting to all projects within that folder. This is more efficient than applying per project. Using Cloud Shell is irrelevant.

IAM cannot enforce such constraints. Service accounts are for authentication.

54
MCQeasy

A startup wants to create a new GCP project for development. They've already created a billing account. Which command can they use to create the project?

A.gcloud config set project PROJECT_ID
B.gcloud projects create PROJECT_ID
C.gcloud alpha projects create
D.gcloud resource-manager projects create
AnswerB

gcloud projects create PROJECT_ID is the correct command because it sends a create request to the Cloud Resource Manager API, which provisions a new project with the specified ID. This command requires the resourcemanager.projects.create permission and the PROJECT_ID must be globally unique across all Google Cloud projects. Once created, the project can be used for development and managed via gcloud.

Why this answer

The 'gcloud projects create' command creates a new project. The billing association is separate, but the project can be created without billing immediately.

55
MCQmedium

You need to grant a user the ability to create and manage Compute Engine instances in a specific project. You want to follow the principle of least privilege. Which IAM role should you assign?

A.roles/compute.admin
B.roles/compute.instanceAdmin.v1
C.roles/editor
D.roles/owner
AnswerB

This role is scoped specifically to compute instances. It allows creating, deleting, starting, stopping, and modifying instances, but not managing networks, subnets, firewalls, or other global Compute Engine resources. This is the correct least-privilege choice because it covers all instance lifecycle operations without granting access to the broader infrastructure.

Why this answer

roles/compute.instanceAdmin.v1 provides full control over Compute Engine instances but not other services. roles/editor is broader. roles/owner is too permissive. roles/compute.admin includes all compute resources, not just instances.

56
MCQmedium

You create a new Google Cloud project using the Cloud Console. After creating the project, you need to enable the Compute Engine API. What is the correct command to do this using the Cloud Shell?

A.gcloud projects enable compute.googleapis.com
B.gcloud compute enable compute.googleapis.com
C.gcloud api enable compute
D.gcloud services enable compute.googleapis.com
AnswerD

gcloud services enable compute.googleapis.com is the correct command to enable the Compute Engine API in the current project. It interacts with the Service Usage API to set the service's enabled state for the active project. After running this command, you can start using Compute Engine features, assuming a billing account is linked and the IAM permission serviceusage.services.enable is granted. The full service name compute.googleapis.com uniquely identifies the API.

Why this answer

The gcloud services enable command is used to enable APIs for a project. The correct syntax is 'gcloud services enable compute.googleapis.com'.

57
MCQhard

A developer is using Cloud Shell and wants to ensure that their gcloud configuration persists after the Cloud Shell session ends. They have set the compute and access settings using `gcloud config set`. What should they do to keep these settings for future sessions?

A.They need to create a startup script to apply the settings each time
B.The settings are automatically preserved because Cloud Shell's home directory persists
C.They must run `gcloud config configurations save default` before ending the session
D.They must use `gcloud config set --persist` flag
AnswerB

Cloud Shell provisions an ephemeral VM but attaches a persistent 5 GB home directory for each user. gcloud configurations are stored as files under ~/.config/gcloud, so whenever the developer runs `gcloud config set project`, the value is written to disk and remains available in future sessions. When the session ends, any new VM in a future session mounts the same home directory, preserving the settings automatically.

Why this answer

gcloud configurations are stored in the user's home directory and persist across Cloud Shell sessions because the $HOME directory is persistent (with 5GB of persistent disk storage). No additional action is needed.

58
MCQhard

You are setting up a new organization in Google Cloud. You want to restrict the regions where resources can be created to comply with data residency requirements. What should you do?

A.Set an organization policy with a constraint on allowed resource locations
B.Create a service account with limited permissions
C.Set a budget alert that notifies when resources are created outside allowed regions
D.Use IAM roles to restrict which users can create resources in specific regions
AnswerA

An organization policy with the constraints/gcp-resource-locations constraint defines an explicit allowlist of regions where resources can be created. When set at the organization, folder, or project level, it is enforced synchronously at resource creation time, and any API request targeting a location outside the allowlist is rejected with an error. This is the intended, preventative control for enforcing data residency or regulatory location requirements across Google Cloud.

Why this answer

Organization policies allow you to set constraints at the organization, folder, or project level. The 'gcp.resource-locations' constraint can restrict resource locations.

59
MCQeasy

What is the purpose of the gcloud init command?

A.To create a billing account.
B.To initialize a new project in Google Cloud.
C.To enable APIs for a project.
D.To set up a new gcloud configuration and authenticate.
AnswerD

The primary purpose of gcloud init is to bootstrap the gcloud command-line tool by creating a new configuration, authenticating with your Google account or service account, and setting properties like the default project, region, and zone. It is the standard first step when installing or reinstalling the gcloud SDK on a new machine or for setting up an isolated environment.

Why this answer

gcloud init is used to initialize or reinitialize the gcloud environment, including setting default project, authentication, and compute region/zone. It can also create a new configuration profile.

60
MCQeasy

You want to switch between multiple GCP projects frequently using the gcloud CLI. What is the recommended approach?

A.Open separate terminal windows for each project.
B.Run gcloud init every time you switch projects.
C.Use gcloud config set project each time you switch.
D.Create multiple configuration profiles and activate them as needed.
AnswerD

Creating multiple named configurations with gcloud config configurations create and activating them via gcloud config configurations activate is the officially recommended pattern for frequent context switching. Each configuration stores its own project, account, region, and other properties, so you can define a distinct environment for every GCP project or workflow. Activation is instantaneous and deterministic, and you can even use the --configuration flag to run a single command in a non-default configuration without changing your active context, enabling safe automation and parallel work.

Why this answer

Configuration profiles (gcloud config configurations) allow you to create named configurations with different project, region, and zone settings. You can activate one with 'gcloud config configurations activate'. Setting individual properties each time is error-prone.

Running gcloud init each time is slow. Using separate terminals isn't efficient.

61
Multi-Selectmedium

A developer needs to use gcloud CLI to manage multiple projects. They want to switch between configurations quickly. Which three commands are part of managing gcloud configuration profiles? (Choose THREE.)

Select 3 answers
A.gcloud config configurations export
B.gcloud config configurations activate
C.gcloud config configurations list
D.gcloud config configurations create
E.gcloud config set project
AnswersB, C, D

Activates an existing configuration.

Why this answer

gcloud config configurations provides commands to create, activate, and list configurations. The other options are not valid commands.

62
MCQmedium

Your organization uses Cloud Identity to manage users. A new employee joins and needs access to a GCP project. What is the correct sequence to grant access?

A.Grant the user an IAM role directly; Cloud Identity is not required.
B.Create a service account for the user and grant roles to the service account.
C.Add the user to Cloud Identity, then grant the appropriate IAM role in the project.
D.Add the user to a Cloud Identity group, then grant the group an IAM role.
AnswerC

This is the correct sequence: adding the user to Cloud Identity provisions a managed user account in your organization's directory, which then can be used as a principal in IAM. After the user exists, you grant the appropriate IAM role on the project, and the user can authenticate via their new Cloud Identity account and receive the role's permissions. Without that initial provisioning, the IAM role cannot be assigned to the user at all.

Why this answer

First, you add the user to Cloud Identity (if not already there). Then, in the GCP project, you grant an IAM role to the user. Cloud Identity provides the user account; IAM grants permissions.

You cannot skip adding to Cloud Identity.

63
MCQmedium

A team wants to enable Compute Engine API in their project using gcloud. Which command should they run?

A.gcloud compute enable api
B.gcloud services list --enabled
C.gcloud api enable compute
D.gcloud services enable compute.googleapis.com
AnswerD

gcloud services enable compute.googleapis.com is the correct command to enable the Compute Engine API for a project. The gcloud services enable command accepts the fully qualified service name (compute.googleapis.com) and provisions access for the project, making it available for use with gcloud compute commands, API calls, and console operations. This is the standard, documented way to turn on a Google API in a project.

Why this answer

The command 'gcloud services enable compute.googleapis.com' enables the Compute Engine API.

64
MCQmedium

You want to enable the Kubernetes Engine API for your project using the command line. Which gcloud command should you use?

A.gcloud services enable container.googleapis.com
B.gcloud container clusters create my-cluster
C.gcloud config set project my-project
D.gcloud auth login
AnswerA

The correct command to enable the Kubernetes Engine API is `gcloud services enable container.googleapis.com`. This calls the Service Usage API to activate the service in the current Google Cloud project, making it possible to later create and manage GKE clusters. Enabling the API is a prerequisite that also links the service to the project's billing account; until this is done, any GKE resource creation will fail with an error indicating the API is disabled.

Why this answer

'gcloud services enable container.googleapis.com' enables the required API. 'gcloud auth login' authenticates. 'gcloud config set' sets project. 'gcloud container clusters create' creates a cluster but doesn't enable the API.

65
MCQhard

An engineer needs to give a data analyst access to run BigQuery queries but prevent them from viewing or modifying data in Cloud Storage. The analyst should be able to create new datasets. Which IAM role should the engineer assign at the project level?

A.roles/storage.objectViewer
B.roles/bigquery.dataEditor
C.roles/bigquery.dataOwner
D.roles/bigquery.user
AnswerB

roles/bigquery.dataEditor is the correct choice because it provides the necessary permissions for a data analyst to run queries, including bigquery.jobs.create to execute query jobs and bigquery.tables.getData to read table contents. It also allows creating and updating tables within datasets, striking the right balance between access and control. Unlike broader roles, it does not grant dataset-level deletion or permission management, aligning with the principle of least privilege for a typical analyst use case.

Why this answer

The role roles/bigquery.dataEditor allows creating datasets and querying data, but does not grant any Cloud Storage permissions.

66
Multi-Selecteasy

A Cloud Architect needs to understand the GCP resource hierarchy to set up proper access control. Which three resources are part of the GCP resource hierarchy? (Choose THREE.)

Select 3 answers
A.Billing Account
B.Folder
C.Project
D.Organization
E.Cloud Identity
AnswersB, C, D

Folders are correct because they serve as intermediate grouping nodes within the resource hierarchy, sitting directly below an Organization and above Projects. They allow you to group teams, products, or departments and apply IAM policies and organization policies at that group level, which are inherited by all contained projects. Folders can also nest other folders, enabling multi-level administrative boundaries that align with corporate structure.

Why this answer

The GCP resource hierarchy includes Organization, Folder, Project, and Resources (like VMs). Cloud Identity and Billing Account are separate services.

67
Multi-Selectmedium

A company wants to set up a new GCP project and ensure that only approved APIs can be used. Which two steps should they take? (Choose TWO)

Select 2 answers
A.Create a custom role with permissions to enable APIs
B.Use an organization policy to restrict the set of allowed APIs
C.Set a budget to limit API usage costs
D.Assign the Owner role to the project
E.Disable all APIs and enable only the required ones
AnswersB, E

Use an organization policy with the constraints/serviceusage.services constraint on the organization, folder, or project to define an allowlist of Google API service names, such as compute.googleapis.com and storage.googleapis.com. This policy is enforced at access time and inherited hierarchically, so no project-level IAM change can bypass the allowed set. It is the proper guardrail to ensure that only approved APIs can be enabled across a new project, regardless of who holds IAM permissions.

Why this answer

To restrict API usage, you can disable unapproved APIs and use organization policies to enforce restrictions.

68
Multi-Selecthard

A company wants to organize their GCP resources into a hierarchy to separate development, staging, and production environments. Which THREE resources can be used to create this separation?

Select 3 answers
A.Folders
B.Organization node
C.Billing accounts
D.Projects
E.Labels
AnswersA, B, D

Folders are hierarchical containers that sit between the organization node and projects, allowing you to group projects based on business units, teams, or deployment stages (e.g., development, staging, production). As nodes in the resource hierarchy, folders inherit policies from the organization node and propagate their own IAM policies and resource constraints to all projects and folders underneath them, making them a correct and essential component for organizing GCP resources.

Why this answer

GCP resource hierarchy includes Organization, Folders, Projects, and Resources. Folders can be used to group projects (e.g., dev folder, prod folder). Projects are the containers for resources.

Labels are metadata tags but not part of the hierarchy. Billing accounts are separate from the hierarchy. IAM policy is not a resource for separation.

69
MCQhard

A multinational corporation requires that all GCP resources across multiple projects are tagged with a key-value pair 'environment: production' and 'environment: development'. They want to enforce that any resource created without the appropriate label is automatically denied. How can this be achieved?

A.Use Cloud Asset Inventory to monitor and alert on missing labels.
B.Use IAM conditions to check labels at resource creation.
C.Create a custom IAM role that denies creation without labels.
D.Use an organization policy constraint to require labels.
AnswerD

An organization policy custom constraint (e.g., a CEL-based constraint on the resource's `labels` field) is evaluated synchronously when a create or update request is made, and the request is rejected if the labels do not satisfy the rule. This is the only option that provides native, proactive enforcement at the API layer, preventing unlabeled resources from being created across supported GCP services. You can define it in the Resource Manager and attach it at the organization, folder, or project level.

Why this answer

Organization policy constraints like 'compute.googleapis.com/requireLabels' can enforce that certain labels must be present on resources. IAM conditions can restrict access based on labels, but they don't automatically deny creation of unlabeled resources. Cloud Asset Inventory is for monitoring, not enforcement.

Custom roles cannot enforce labeling.

70
MCQeasy

A Cloud Shell user wants to persist Terraform state files across sessions. What is the best approach?

A.Store them in /tmp
B.Store them in a Cloud Storage bucket and mount via gcsfuse
C.Store them on the instance's local SSD
D.Store them in the home directory ($HOME)
AnswerD

The home directory ($HOME) in Cloud Shell is the designated persistent storage area, backed by a 5GB disk that survives across sessions and idle timeouts. Files saved there, including Terraform state files, are retained for later use and are protected from session cleanup. This makes $HOME the simplest and correct choice for persisting state in a personal Cloud Shell environment.

Why this answer

Cloud Shell provides a persistent 5GB home directory. Storing state files there ensures they persist across sessions.

71
MCQmedium

An engineer is setting up Cloud Identity for a new domain. What is a prerequisite for creating a Cloud Identity account?

A.A G Suite account
B.A billing account
C.Domain verification
D.An existing Google Cloud project
AnswerC

Cloud Identity requires proof that you own the custom domain (e.g., @yourdomain.com) before it can create user accounts and manage access for that domain. You must add a unique verification code as a DNS TXT record, or follow the alternate HTML file method, to prove control of the domain. Without this step, Google cannot legally or technically assign identity administration to your domain.

Why this answer

Cloud Identity requires domain verification to prove ownership. This is done via DNS TXT record or other methods.

72
MCQmedium

An engineer wants to ensure that no one in their organization can create VMs with public IP addresses. Which Google Cloud tool should they use to enforce this restriction?

A.Organization policies
B.Labels
C.IAM roles
D.Quotas
AnswerA

Organization policies are the correct tool because they directly enforce restrictions on resource configurations across the entire hierarchy (folders and projects). For example, the compute.vmExternalIpAccess constraint can be set to only allow certain VMs to have external IPs, or require a dedicated VPC peering. They act as guardian rules that cannot be overridden by users without the necessary admin permissions.

Why this answer

Organization policies (Org Policies) allow setting constraints at the organization, folder, or project level to restrict configurations.

73
MCQeasy

A new engineer needs to enable the Compute Engine API for a project using the gcloud command-line tool. Which command should they run?

A.gcloud compute enable-api
B.gcloud projects enable compute.googleapis.com
C.gcloud api enable compute
D.gcloud services enable compute.googleapis.com
AnswerD

The correct command is `gcloud services enable compute.googleapis.com`. The `gcloud services` group is the standard interface for enabling and disabling Google Cloud APIs, and `compute.googleapis.com` is the unique service name for Compute Engine. This command works asynchronously, so you can verify the operation with `gcloud services list --enabled` or the console. It requires the `serviceusage.services.enable` IAM permission on the project.

Why this answer

The correct command to enable an API is `gcloud services enable`, specifying the service name. For Compute Engine the service name is `compute.googleapis.com`.

Ready to test yourself?

Try a timed practice session using only Setting Up a Cloud Solution Environment questions.