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.
Your engineering team is refactoring a monolithic Java web application into containerized microservices to deploy on Cloud Run and Google Kubernetes Engine (GKE). During initial testing, you identify three issues:
latest tag in Artifact Registry, making it difficult to trace running containers back to source commits or perform reliable rollbacks.Which refactoring and container management strategy should you implement?
RUN rm -rf instruction to delete build caches, bundle per-environment configuration files into separate image builds, and use --cache-from with the latest tag in Artifact Registry.This approach attempts to reduce image size by deleting temporary build files in a subsequent Dockerfile instruction while continuing to bake configuration files into environment-specific images and relying on Docker build caching with a mutable latest tag.
Dockerfile creates an immutable filesystem layer. Deleting build caches or source files in a separate RUN rm -rf command only marks those files as deleted in the new top layer; the underlying layers still retain all the data, keeping the image over 1.2 GB and leaving the heavy JDK in place.latest tag overwrites the previous reference in Artifact Registry, stripping the tag from older images and obscuring which commit is deployed.--cache-from scope: The --cache-from flag reuses prior layers to speed up build execution time, not to shrink the resulting runtime image.The goal were simply to accelerate incremental CI build times in Cloud Build using --cache-from for a single-purpose utility where image size and multi-environment promotion were not concerns.
This approach combines Twelve-Factor App principles with multi-stage Docker builds and Artifact Registry best practices. Separating build-time environments from minimal runtime environments keeps containers lean, while decoupling configuration from code produces immutable artifacts that can be promoted reliably across environments.
MAJOR.MINOR.PATCH) and enabling immutable tags in Artifact Registry prevents accidental overwrites and guarantees every running container maps deterministically to a specific codebase state.Unlike single-stage cleanups or build caching flags, multi-stage builds physically exclude intermediate build layers from the final image while preserving strict environment parity and deployment auditability.
openjdk JDK base image, export the image as a tarball to Cloud Storage instead of using Artifact Registry, and configure database connections with instance startup scripts.This pattern lifts and shifts the entire monolithic codebase into a single container built on a full JDK, bypasses a dedicated container registry by archiving tarballs in Cloud Storage, and relies on VM-style startup scripts to inject runtime settings.
You were migrating an unmodified legacy application onto standalone Compute Engine VMs using custom boot disk images and startup scripts rather than refactoring into cloud-native microservices.
--cache-from in Cloud Build to shrink the runtime image, and configure an Artifact Registry connector repository to proxy the built images from Docker Hub.This option splits the application into services but keeps session state inside the container filesystem, attempts to use Cloud Build's --cache-from flag to reduce image size, and misapplies an Artifact Registry connector repository to manage internally built microservices.
--cache-from: Adding --cache-from in Cloud Build pulls an existing image to reuse unchanged layers and speed up the build duration; it does not strip build-time dependencies or shrink the final container image.You needed to enforce an audit trail on external open-source packages from Docker Hub without caching third-party dependencies inside your Google Cloud project.
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