Question 16 of 500
Building and testing applicationsmediumMultiple SelectObjective-mapped

Quick Answer

The answer is to run tests inside the container as a separate layer using Docker multi-stage builds, combined with executing those tests within a Cloud Build pipeline. This is correct because multi-stage builds allow you to create a dedicated test stage with all necessary dependencies, run your unit and integration tests, and then discard that layer before producing the final, lean production image—ensuring the test environment exactly mirrors the runtime environment. On the Google Professional Cloud Developer exam, this concept tests your understanding of CI/CD best practices for containerized applications on Google Cloud, often appearing as a distractor where candidates mistakenly choose to test outside the container or use separate VMs. A common trap is thinking Cloud Build only builds images; in reality, it natively supports custom build steps for testing. Memory tip: think “test inside, strip outside”—keep the test layer for validation, then strip it away for deployment.

PCD Building and testing applications Practice Question

This PCD practice question tests your understanding of building and testing applications. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Which TWO are best practices for testing containerized applications on Google Cloud?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "best"

    Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

Question 1mediummulti select
Full question →

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

Use Cloud Build to build and test containers.

Cloud Build is a managed CI/CD platform that can build container images from source code and execute tests as part of the build pipeline. It integrates natively with Google Cloud services like Container Registry and Artifact Registry, and supports custom build steps, making it an ideal tool for building and testing containerized applications in a consistent, automated environment.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use Kubernetes for testing only.

    Why it's wrong here

    Kubernetes is a full orchestration platform, overkill for just testing.

  • Use Distroless images for testing.

    Why it's wrong here

    Distroless images lack shells and tools needed for test execution.

  • Use Cloud Build to build and test containers.

    Why this is correct

    Cloud Build integrates seamlessly with container workflows.

    Clue confirmation

    The clue word "best" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Use a different base image for testing than production.

    Why it's wrong here

    Using different base images can cause environment discrepancies.

  • Run tests inside the container as a separate layer using Docker multi-stage builds.

    Why this is correct

    Multi-stage builds allow testing in a separate stage before production.

    Clue confirmation

    The clue word "best" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Cisco often tests the misconception that testing should use a different base image to avoid production bloat, but the correct practice is to use the same base image for testing and production to ensure consistency, while leveraging multi-stage builds to separate build and test dependencies from the final runtime image.

Detailed technical explanation

How to think about this question

Multi-stage builds (Option E) allow you to define multiple FROM statements in a single Dockerfile, where each stage can use a different base image. The final stage typically copies only the compiled artifacts from earlier stages, keeping the production image lean. For testing, you can run unit tests in an intermediate stage that includes all build tools and test frameworks, then discard that stage, ensuring the final image contains only what is needed for runtime. Cloud Build (Option C) supports custom build steps via the `steps` field in `cloudbuild.yaml`, where you can run tests in a containerized environment with the exact same base image as production, avoiding drift.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PCD practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free PCD practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCD question test?

Building and testing applications — This question tests Building and testing applications — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Use Cloud Build to build and test containers. — Cloud Build is a managed CI/CD platform that can build container images from source code and execute tests as part of the build pipeline. It integrates natively with Google Cloud services like Container Registry and Artifact Registry, and supports custom build steps, making it an ideal tool for building and testing containerized applications in a consistent, automated environment.

What should I do if I get this PCD question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "best". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCD 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 PCD exam.