Courseiva

LPIC-3 Exam 305: Virtualization and Containerization (305-300) (305-300) (305-300) — Questions 151–210

210 questions total · 3 pages · All types, answers revealed

Page 2

Page 3 of 3

151
MCQeasy

Which command-line option is used to run a Docker container in the background (detached mode)?

A.-i
B.--bg
C.-d
D.-b
E.-t
AnswerC

The -d flag detaches the container, running it in the background and returning the container ID to the shell. This satisfies the detached-mode requirement, unlike -it which attaches an interactive TTY to the foreground process.

Why this answer

The -d (or --detach) flag runs a Docker container in the background, returning the container ID and freeing the terminal. This is the standard way to start long-running services like web servers without blocking the shell. Combined with -p for port mapping and --name for identification, it is the canonical detached-mode invocation.

Exam trap

The trap is that -i and -t are commonly used together for interactive containers, so candidates may confuse them with detachment; the exam expects recognition that only -d (--detach) backgrounds the container.

How to eliminate wrong answers

Option A is wrong because -i keeps STDIN open for interactive input; it does not detach the container. Option B is wrong because --bg is not a Docker flag; the correct long form is --detach. Option D is wrong because -b is not a valid Docker run flag for background mode (it was historically used for bridge networking in some contexts, but not detachment).

Option E is wrong because -t allocates a pseudo-TTY; it is often paired with -i for interactive sessions but does not detach.

152
MCQmedium

You are managing an LXC container and need to create a snapshot of the container's root file system. Which command achieves this?

A.lxc-snapshot -n container_name
B.lxc-checkpoint -n container_name
C.lxc-copy -s container_name
D.lxc-backup
E.lxc-clone --snapshot
AnswerA

`lxc-snapshot -n container_name` invokes the LXC snapshot utility against the named container, capturing the root file system state through the container's backing storage. It satisfies the stem's requirement to snapshot an LXC container's root file system directly, without manual copy or export steps.

Why this answer

The `lxc-snapshot -n <container_name>` command creates a snapshot of an LXC container's root filesystem. It is the standard LXC utility for snapshotting containers, allowing you to capture the current state of the container's filesystem for backup or rollback purposes.

Exam trap

The trap is confusing filesystem snapshots (`lxc-snapshot`) with checkpoint/restore (`lxc-checkpoint`) or cloning (`lxc-copy`/`lxc-clone`) — candidates must distinguish between capturing filesystem state versus process state versus creating a new container.

How to eliminate wrong answers

Option B is wrong because `lxc-checkpoint` is used for checkpoint/restore of a running container's state (processes, memory, etc.) via CRIU, not for creating a filesystem snapshot. Option C is wrong because `lxc-copy -s` is not the correct syntax for snapshotting — `lxc-copy` is used to copy or clone containers, and while it has snapshot-related options, the dedicated snapshot command is `lxc-snapshot`. Option D is wrong because `lxc-backup` is not a valid LXC command — there is no such utility.

Option E is wrong because `lxc-clone --snapshot` is not the correct command — `lxc-clone` is an older/deprecated tool for cloning containers, and the snapshot-specific command is `lxc-snapshot`.

153
MCQhard

In an OpenVZ environment, you need to limit the number of processes a container can create. Which parameter in the container configuration file should be modified?

A.PHYSPAGES
B.NUMPROC
C.KMEMSIZE
D.PRIVVMPAGES
AnswerB

NUMPROC directly caps the process count within an OpenVZ container, satisfying the requirement to limit process creation. Set in the container configuration file, it enforces this per-container barrier independently of host-wide limits, unlike CPU or memory parameters that govern different resources entirely.

Why this answer

In OpenVZ, the NUMPROC parameter in the container's configuration file (e.g., /etc/vz/conf/CTID.conf) directly controls the maximum number of processes and threads that can exist within that container. It acts as a hard limit on the total process count, preventing a single container from exhausting the host's process table. This is the correct parameter to modify when you need to restrict process creation for a specific container.

Exam trap

The trap here is confusing memory-related parameters (PHYSPAGES, KMEMSIZE, PRIVVMPAGES) with process-count limits, as candidates may assume any resource parameter affects process creation.

How to eliminate wrong answers

Option A is wrong because PHYSPAGES limits the amount of physical memory (in pages) a container can allocate, not the number of processes. Option C is wrong because KMEMSIZE controls the size of kernel memory that can be allocated to a container, which is unrelated to process count. Option D is wrong because PRIVVMPAGES limits the number of private virtual memory pages a container can use, which governs memory usage, not process creation.

154
MCQeasy

Which of these is a valid virtualization storage pool type supported by libvirt?

A.cpu
B.interface
C.network
D.dir
AnswerD

The dir pool type stores volumes as ordinary files within an existing host directory, and libvirt supports it natively alongside disk, logical, iSCSI, and similar backends. It satisfies the stem's requirement for a valid libvirt storage pool type.

Why this answer

libvirt supports several storage pool types, including 'dir' (directory), 'disk', 'fs', 'logical', 'netfs', 'iscsi', 'scsi', 'mpath', 'rbd', 'sheepdog', and 'gluster'. The 'dir' type is a directory-based storage pool that uses a local directory to store volume files. Options like 'cpu', 'interface', and 'network' are not storage pool types; they are related to other libvirt objects such as CPU models, network interfaces, and virtual networks.

Exam trap

The trap here is confusing libvirt object types: candidates might think 'network' or 'interface' are storage-related because they involve I/O, but they are separate concepts.

How to eliminate wrong answers

Option A is wrong because 'cpu' is not a storage pool type; it refers to CPU configuration or models in libvirt. Option B is wrong because 'interface' is not a storage pool type; it relates to network interfaces. Option C is wrong because 'network' is not a storage pool type; it refers to virtual networks managed by libvirt.

155
MCQhard

In systemd-nspawn, how do you specify a different root directory for the container?

A.--path
B.--root
C.-D
D.-r
AnswerC

The `-D` flag sets the container's root directory, satisfying the requirement to specify a different root filesystem. It accepts a path to a directory tree or image, which systemd-nspawn then uses as the container's root, rather than defaulting to a machine-name-derived location under `/var/lib/machines`.

Why this answer

The -D flag (long form --directory) in systemd-nspawn specifies the root directory for the container. This is the documented option for pointing nspawn at a directory tree that should be used as the container's filesystem root. For example, 'systemd-nspawn -D /var/lib/machines/mycontainer' boots the container using that path as its root.

Exam trap

The trap here is confusing systemd-nspawn's -D/--directory with similarly named flags from other container tools (podman --root, chroot's positional root, or Docker's --workdir), causing candidates to pick a plausible-sounding but nonexistent nspawn option.

How to eliminate wrong answers

Option A is wrong because --path is not a valid systemd-nspawn option; nspawn uses --directory/-D for the root filesystem location. Option B is wrong because --root is not a systemd-nspawn flag — that naming convention belongs to tools like chroot or podman, not nspawn. Option D is wrong because -r is not the root-directory switch in nspawn; in some tools -r means read-only or recursive, and nspawn reserves -D for the directory.

156
MCQeasy

What is the primary difference between a container image and a container instance?

A.Images are stored in RAM, instances are on disk
B.The image is the template; the instance is the running process
C.Instances cannot be stopped
D.The instance is the template; the image is the running process
E.They are the same thing
AnswerB

An image is an immutable, layered filesystem template stored locally or in a registry; a container instance is that image instantiated as a running process with a writable layer. This template-versus-process distinction directly answers the stem's request for the primary difference.

Why this answer

A container image is an immutable, layered filesystem template (built from a Dockerfile) that packages the application and its dependencies. A container instance is a running (or stopped) instantiation of that image with its own writable layer, process namespace, and runtime state. The image is the blueprint; the instance is the executing process.

Exam trap

The trap is the classic template-vs-instance confusion — candidates sometimes pick the reversed option (D) or assume images live in RAM, missing that images are on-disk immutable layers and instances are the running processes.

How to eliminate wrong answers

Option A is wrong because images are stored on disk (in a registry or local image store), not in RAM; running instances consume RAM. Option C is wrong because container instances can absolutely be stopped (docker stop, pod termination) — they are not immortal. Option D is wrong because it reverses the relationship: the image is the template, not the instance.

Option E is wrong because image and instance are distinct concepts in the container lifecycle, analogous to class vs. object.

157
MCQeasy

You are managing a KVM host and need to gracefully shut down a running guest named 'dbserver'. Which virsh command should you use?

A.virsh stop dbserver
B.virsh shutdown dbserver
C.virsh destroy dbserver
D.virsh halt dbserver
AnswerB

virsh shutdown sends an ACPI shutdown signal to the guest, requesting a graceful shutdown. The guest OS will then initiate its normal shutdown process, closing services and unmounting filesystems. This is the correct way to gracefully shut down a guest. It requires that the guest OS supports ACPI and has the necessary drivers, which is typical for modern operating systems.

Why this answer

The virsh shutdown command sends an ACPI shutdown request to the guest, allowing the guest operating system to perform a clean shutdown. This is the preferred method for gracefully stopping a virtual machine. The virsh destroy command forcibly powers off the guest, which can cause data loss.

The other options are not valid virsh commands.

Exam trap

The trap here is assuming that virsh destroy performs a graceful shutdown because the word 'destroy' might imply a clean removal, but it actually performs a hard power off.

158
MCQeasy

What is the primary function of the ENTRYPOINT instruction in a Dockerfile?

A.Setting environment variables
B.Defining volume mount points
C.Configuring the executable that runs when the container starts
D.Specifying metadata
E.Installing software packages
AnswerC

ENTRYPOINT sets the executable that runs when the container starts, satisfying the stem's requirement. Unlike CMD, which supplies default arguments that a docker run command can override, ENTRYPOINT fixes the process itself, with CMD values passed to it as parameters.

Why this answer

ENTRYPOINT defines the executable that runs when the container starts, making the container behave like a self-contained command. Unlike CMD, which provides default arguments that can be overridden at 'docker run', ENTRYPOINT is not replaced by command-line arguments — those arguments are appended to it. This is why ENTRYPOINT is used to configure a container as an executable.

Exam trap

The trap is conflating ENTRYPOINT with CMD — candidates often pick the answer describing default commands or environment setup, forgetting that ENTRYPOINT is the non-overridable executable definition while CMD supplies overridable defaults.

How to eliminate wrong answers

Option A is wrong because environment variables are set with ENV, not ENTRYPOINT. Option B is wrong because volume mount points are declared with VOLUME. Option D is wrong because metadata such as author and description is set with LABEL (or the deprecated MAINTAINER).

Option E is wrong because package installation happens via RUN during build, not via ENTRYPOINT at runtime.

159
Multi-Selectmedium

Which THREE of the following are necessary components for a successful KVM virtualization environment on Linux?

Select 3 answers
A.The kvm kernel module
B.QEMU userspace tools
C.Hardware support for Intel VT-x or AMD-V
D.A dedicated storage network switch
E.A full Xen hypervisor installed
AnswersA, B, C

The kvm kernel module provides the hardware-assisted virtualisation layer, exposing Intel VT-x or AMD-V extensions to userspace so guests execute near-natively. Without it, QEMU falls back to slow software emulation, failing the stem's requirement for a genuine KVM environment. It is the foundational component every other KVM tool depends upon.

Why this answer

Option A (the kvm kernel module) is correct because KVM is implemented as a Linux kernel module that exposes the /dev/kvm interface and provides the core virtualization capability, so without loading kvm (or kvm_intel/kvm_amd) no guest can execute. Option B (QEMU userspace tools) is correct because KVM only handles CPU and memory virtualization in the kernel; QEMU provides the userspace device emulation, BIOS/firmware, and the qemu-system-x86_64 process that actually creates and runs the VM. Option C (hardware support for Intel VT-x or AMD-V) is correct because KVM requires CPU virtualization extensions (vmx or svm) exposed in the CPU flags; without them KVM cannot run hardware-accelerated guests.

Option D (a dedicated storage network switch) is not required, since KVM guests can use local disks, files, or any existing network via virtio, and a separate storage switch is only an optional design choice. Option E (a full Xen hypervisor installed) is not required and is in fact an alternative hypervisor; KVM does not depend on Xen, and installing Xen would be a different virtualization stack.

Exam trap

305-300 often tests whether candidates can distinguish core KVM prerequisites from optional management or networking components — picking a storage switch or Xen reflects confusion between essential and peripheral requirements.

160
MCQhard

You are using Packer to build a KVM-compatible QEMU image for an on-premises OpenStack cloud. The build completes successfully, but the resulting image fails to boot because the virtual disk is not recognized. You verify that the QEMU builder is configured with accelerator 'kvm' and the correct machine type. Which QEMU builder option should you review to ensure the disk image is created in a format that OpenStack can use?

A.net_device
B.format
C.disk_image
D.headless
AnswerB

The format option in the QEMU builder defines the output disk image format, such as qcow2 or raw. OpenStack Glance commonly requires qcow2 for KVM-based instances. If the format is set incorrectly, the image may not be recognized. Reviewing and setting format to qcow2 ensures compatibility with OpenStack's default disk format expectations.

Why this answer

The QEMU builder's format option determines the output disk image format. For OpenStack KVM instances, qcow2 is typically required. If the image is built in a format that Glance or the hypervisor cannot interpret, the instance fails to boot.

Ensuring format is set to qcow2 aligns with OpenStack's expected disk format and resolves the recognition issue.

Exam trap

The trap here is assuming that disk_image or net_device controls the output format, when actually the format option is responsible for the disk image type.

161
MCQeasy

How do you view the logs of a running container?

A.docker logs [container]
B.docker show-logs
C.cat /var/lib/docker/logs
D.docker log
AnswerA

`docker logs [container]` retrieves stdout and stderr captured by the container's configured logging driver, streaming them to your terminal without entering the container. This satisfies the scenario's requirement to view a running container's logs directly, since Docker retains that output for the container's lifetime.

Why this answer

The correct command to view the logs of a running container is `docker logs [container]`. This command retrieves the standard output (stdout) and standard error (stderr) from the container's main process, which Docker captures and stores using a logging driver (default is json-file). It works for both running and stopped containers, and options like `-f` (follow) and `--tail` allow real-time monitoring or limiting output.

Exam trap

The trap here is confusing the correct plural command `docker logs` with the singular `docker log`, or assuming logs are stored in a central directory like `/var/lib/docker/logs`, when they are actually per-container and accessed via the Docker CLI.

How to eliminate wrong answers

Option B is wrong because `docker show-logs` is not a valid Docker command; there is no such subcommand. Option C is wrong because Docker does not store container logs in a single file at `/var/lib/docker/logs`; instead, logs are stored per container under `/var/lib/docker/containers/<container-id>/<container-id>-json.log` when using the default json-file driver, and directly reading them is not the standard method. Option D is wrong because `docker log` is not a valid command; the correct subcommand is `logs` (plural).

162
MCQmedium

Which instruction in a Dockerfile is best suited for installing packages to minimize image size?

A.COPY apt-cache /
B.CMD apt-get install package
C.RUN apt-get update && apt-get install -y package
D.RUN apt-get update && apt-get install -y package && rm -rf /var/lib/apt/lists/*
AnswerD

Combining update, install and cache removal in a single RUN layer prevents apt metadata persisting in the final image, directly satisfying the minimise-image-size constraint. Separate instructions would each commit a layer, retaining the lists irreversibly. The `rm -rf` executes before the layer is committed, so nothing is left behind.

Why this answer

The RUN instruction with apt-get update, install, and cleanup in a single layer is best because it prevents the apt package lists from being stored in the final image. By combining update, install, and rm -rf /var/lib/apt/lists/* in one RUN, Docker creates a single layer where the lists are downloaded, used, and then deleted before the layer is committed. This minimizes image size because the intermediate files never persist in any layer.

Other options either don't install packages (COPY, CMD) or leave cached lists in the image (RUN without cleanup).

Exam trap

305-300 often tests the misconception that any RUN with apt-get install is sufficient, but the trap is forgetting that cleanup must happen in the same RUN instruction to avoid leaving cached package lists in the image layer.

How to eliminate wrong answers

Option A is wrong because COPY apt-cache / does not install any packages; it merely copies a file or directory named 'apt-cache' into the root, which is not a valid package installation method and would likely fail or add unnecessary files. Option B is wrong because CMD sets the default command for the container at runtime, not during build; it does not execute apt-get install during image build, so packages are not installed into the image. Option C is wrong because while it installs packages, it leaves the apt package lists in /var/lib/apt/lists/, which adds unnecessary size to the image; without cleanup, those lists persist in the layer.

163
MCQeasy

Which command is used to start a VM that has been defined?

A.virsh launch vm_name
B.virsh start vm_name
C.virsh boot vm_name
D.virsh run vm_name
AnswerB

virsh start instructs libvirt to boot a previously defined but inactive domain, matching the requirement to start an already-defined VM. Alternatives such as virsh define or create either register or transiently launch domains rather than starting a persistent definition.

Why this answer

The correct command to start a defined but inactive libvirt domain (VM) is `virsh start vm_name`. This command initiates the domain from its persistent XML definition, transitioning it from the 'shut off' state to 'running'. It is the standard counterpart to `virsh shutdown` and `virsh destroy`.

Exam trap

The trap here is confusing the correct virsh subcommand with similar-sounding verbs like 'launch', 'boot', or 'run', which are not valid in libvirt. Candidates often assume any intuitive verb works, but only 'start' is recognized.

How to eliminate wrong answers

Option A is wrong because `virsh launch` is not a valid virsh subcommand; the correct verb is 'start'. Option C is wrong because `virsh boot` does not exist; booting is implied by starting the domain. Option D is wrong because `virsh run` is not a valid subcommand; 'run' is used in other contexts (e.g., `virsh run` does not exist in standard libvirt).

164
MCQmedium

How do you define a new libvirt virtual network from an XML file named 'net.xml'?

A.virsh net-define net.xml
B.virsh net-load net.xml
C.virsh define net.xml
D.virsh net-create net.xml
AnswerA

The virsh net-define subcommand parses the supplied XML and registers a persistent libvirt network definition without starting it, satisfying the requirement to define a new network from net.xml. It creates the configuration only; a separate net-start is needed to activate it.

Why this answer

The virsh net-define command parses an XML file and defines a persistent libvirt virtual network from it, registering the network configuration with libvirt without starting it. This is the correct command to load a network definition from net.xml into libvirt's configuration.

Exam trap

The trap is confusing 'virsh define' (for domains/VMs) with 'virsh net-define' (for networks), and confusing 'net-define' (persistent, inactive) with 'net-create' (transient, active) — candidates often pick net-create thinking it 'creates' the persistent network.

How to eliminate wrong answers

Option B is wrong because virsh net-load is not a valid virsh subcommand — there is no net-load operation in libvirt's CLI. Option C is wrong because virsh define net.xml defines a domain (VM) from XML, not a network; the correct domain command is 'virsh define', but for networks you must use 'virsh net-define'. Option D is wrong because virsh net-create creates and starts a transient (non-persistent) network from XML — it does not define a persistent network, and the network disappears after shutdown.

165
MCQhard

You are troubleshooting a KVM guest that fails to start with the error 'unsupported configuration: CPU mode 'host-passthrough' requires KVM'. Which of the following is the most likely cause?

A.The host CPU is too old and does not support the host-passthrough mode.
B.The guest's XML configuration has a typo in the CPU mode attribute.
C.The guest is configured to use a CPU mode that is only supported by the KVM hypervisor, but the hypervisor is not KVM (e.g., QEMU TCG).
D.The host CPU does not support hardware virtualization extensions.
AnswerC

The host-passthrough CPU mode exposes the host CPU features directly to the guest and requires hardware virtualization (KVM). If libvirt is using a different hypervisor, such as QEMU's TCG (software emulation), this mode is not supported. The error clearly states that host-passthrough requires KVM, so the most likely cause is that the guest is running under a non-KVM hypervisor, possibly due to KVM not being enabled or the domain XML specifying a different hypervisor.

Why this answer

The error 'unsupported configuration: CPU mode 'host-passthrough' requires KVM' occurs when the guest is configured with <cpu mode='host-passthrough'/> but libvirt is not using the KVM hypervisor. This can happen if KVM is not enabled on the host, or if the domain XML explicitly sets a different hypervisor type. host-passthrough exposes the host CPU model and features directly to the guest, which is only possible with hardware virtualization.

Exam trap

The trap here is assuming the error relates to CPU hardware capabilities, when it is actually about the hypervisor type not being KVM.

166
MCQmedium

In a Packer build process for OpenStack, which 'post-processor' type is typically used to upload the resulting image to the Glance image service?

A.manifest
B.shell-local
C.openstack
D.compress
AnswerC

The openstack post-processor authenticates to the OpenStack APIs and uploads the built artefact to Glance, registering it as an image. It is the only post-processor type that targets Glance directly, satisfying the requirement to publish the Packer output there.

Why this answer

Packer's `openstack` post-processor takes the artifact produced by the builder (typically a qcow2 or raw image) and uploads it to the OpenStack Glance image service, registering it as a bootable image. It handles authentication against Keystone and can set image metadata such as name, visibility, and tags. This makes it the standard way to publish a Packer-built image into an OpenStack cloud.

Exam trap

305-300 often tests the distinction between post-processors that transform artifacts locally (compress, manifest, shell-local) versus those that publish to a cloud service (openstack), so candidates who pick a local-only processor miss the upload requirement.

How to eliminate wrong answers

Option A is wrong because the `manifest` post-processor only writes a JSON file listing the artifacts produced by the build; it does not interact with OpenStack or upload anything. Option B is wrong because `shell-local` runs a shell script on the machine running Packer, useful for local automation but not for uploading to Glance. Option D is wrong because `compress` creates a compressed archive of the artifact (e.g., .tar.gz) for storage or transfer, not for registering an image with OpenStack.

167
Multi-Selecthard

Which THREE of the following XML elements are used to define a virtual disk in a domain?

Select 3 answers
A.<driver name='qemu' type='qcow2'/>
B.<mount-point path='/'>
C.<filesystem name='...'>
D.<target dev='vda' bus='virtio'/>
E.<source file='...'/>
AnswersA, D, E

The `<driver>` element specifies the hypervisor's disk image format and backend, here qemu with qcow2. This satisfies the stem's requirement for an XML element defining a virtual disk, since libvirt uses `<driver>` within the disk device to declare how the storage is presented and handled.

Why this answer

In libvirt domain XML, a virtual disk is defined inside a <disk> element, and the three marked options are its core components. Option A, <driver name='qemu' type='qcow2'/>, specifies the hypervisor driver (qemu) and the disk image format (qcow2), which tells libvirt how to handle the backing file. Option D, <target dev='vda' bus='virtio'/>, defines the guest-visible device name and the bus/controller (virtio) used to attach the disk to the VM.

Option E, <source file='...'/>, points to the host-side disk image file that backs the virtual disk. The unmarked options do not belong: <mount-point path='/'> and <filesystem name='...'> are used in filesystem/container or guest-agent contexts (e.g., <filesystem> devices for virtio-9p or virtiofs), not for defining a standard virtual disk in a domain.

Exam trap

305-300 often tests the confusion between storage-related XML elements, tricking candidates into selecting <filesystem> or mount-point tags for disk definitions when only <source>, <target>, and <driver> belong inside a <disk> element.

168
Multi-Selectmedium

Which TWO commands are valid for inspecting container network settings?

Select 2 answers
A.docker inspect
B.docker show net
C.docker net status
D.docker list network
E.docker network inspect
AnswersA, E

Docker inspect returns the container's full configuration as JSON, including the NetworkSettings object with IP address, gateway, MAC address, port bindings and connected networks. That directly satisfies the stem's requirement to inspect container network settings, unlike commands that only list or alter them.

Why this answer

Option A, `docker inspect`, is correct because it returns the full JSON configuration of a container, including its NetworkSettings section with IP address, gateway, MAC address, and attached networks. Option E, `docker network inspect`, is correct because it inspects a Docker network object and shows connected containers, subnet, gateway, and driver details. Options B, C, and D are not valid Docker CLI commands, so they cannot be used to inspect container network settings.

Exam trap

The trap is accepting plausible-sounding but non-existent Docker subcommands like 'docker show net' or 'docker net status' — candidates must know the exact CLI verbs (inspect, network inspect, network ls).

169
MCQmedium

What is the purpose of the 'rkt' (Rocket) container runtime?

A.To replace the kernel
B.To run pods in a secure, pluggable manner
C.To manage cloud infrastructure
D.To provide a GUI for Docker
AnswerB

Rocket runs application containers grouped as pods, using a pluggable execution stage and signature-verified images to isolate workloads securely. This pod-centric, pluggable design satisfies the scenario's requirement for running pods in a secure, pluggable manner, distinguishing it from single-container runtimes.

Why this answer

The 'rkt' (Rocket) container runtime was developed by CoreOS as an alternative to Docker, designed to run application containers (often grouped into pods) with a strong focus on security, composability, and adherence to open standards. It implements a pluggable execution model where different isolation mechanisms (e.g., KVM, cgroups) can be used, and it supports pod-level networking and image formats like ACI (App Container Image). Its primary purpose is to securely and portably run containerized workloads, especially pods, in a pluggable manner.

Exam trap

The trap here is confusing a container runtime with an orchestrator or a kernel component; candidates might think 'rkt' manages infrastructure or replaces the kernel, but it is strictly a runtime for executing containers/pods securely.

How to eliminate wrong answers

Option A is wrong because a container runtime does not replace the kernel; it relies on kernel features like namespaces and cgroups for isolation, and rkt specifically can optionally use a hypervisor but never substitutes the OS kernel. Option C is wrong because managing cloud infrastructure is the domain of orchestration and infrastructure-as-code tools (e.g., Kubernetes, Terraform), not a container runtime like rkt. Option D is wrong because rkt is a command-line runtime with no graphical user interface; GUI tools for Docker are separate projects like Portainer or Docker Desktop.

170
Multi-Selecthard

Which THREE of the following steps are involved in performing a manual disk migration of a VM?

Select 3 answers
A.Editing the domain XML on the target host
B.Reformatting the disk image
C.Redefining the domain using virsh define
D.Copying the disk image to the target host
E.Updating the host kernel
AnswersA, C, D

Manual migration requires the target host's domain XML to reference the copied disk's new path and correct host-specific devices. Editing that XML on the target is therefore a necessary step before the domain can be redefined and started there.

Why this answer

Manual disk migration of a VM requires copying the VM's disk image to the target host (D), since the storage must be present there before the domain can run; this is typically done with tools like rsync, scp, or cp. The target host's domain XML must then be edited (A) to point to the new disk path and any host-specific settings, because the original XML references the source host's storage location. Finally, the domain is registered on the target host with virsh define (C), which loads the edited XML into libvirt so the VM can be started.

Options B and E are not part of the process: reformatting the disk image would destroy the guest's data and filesystem, and updating the host kernel is unrelated to migrating a VM's disk and domain definition.

Exam trap

The trap here is assuming migration is a single copy operation; candidates forget that the libvirt domain definition must be edited and redefined on the target, not just the disk image copied.

171
MCQmedium

You are using Docker and need to inspect the metadata of a running container, including its IP address, environment variables, and mounted volumes. Which command provides all this information in a single JSON output?

A.docker logs <container>
B.docker inspect <container>
C.docker ps --format json
D.docker stats <container>
AnswerB

docker inspect returns detailed JSON metadata about a container, including its network settings (IP address), environment variables, mounts, and much more. It is the primary tool for retrieving low-level configuration and runtime information. The output can be filtered with --format to extract specific fields. This command satisfies all the requirements in the scenario with a single invocation.

Why this answer

The docker inspect command outputs comprehensive JSON metadata for a container, including network settings, environment variables, and mounts. Other commands like docker ps, docker stats, and docker logs serve different purposes such as listing, monitoring, or retrieving logs. Only docker inspect provides the full configuration details required in this scenario.

Exam trap

The trap here is confusing container listing or monitoring commands with inspection commands, and assuming that docker ps or docker stats can provide detailed configuration metadata like IP address and mounts.

172
MCQeasy

Which command shows the history of layers in a Docker image?

A.docker history
B.docker log
C.docker layers
D.docker image info
AnswerA

`docker history` reads an image's manifest and prints each layer with its ID, size and originating instruction, directly satisfying the requirement to show layer history. Unlike `docker inspect`, which returns JSON metadata about the whole image, it enumerates the individual build steps, making it the precise command for this scenario.

Why this answer

The `docker history` command displays the complete layer history of a Docker image, showing each intermediate layer created by the Dockerfile instructions, along with the layer ID, creation time, size, and the command that created it. This is the standard way to inspect how an image was built and identify which layers consume the most space.

Exam trap

The trap here is confusing container runtime commands (`docker logs`) with image inspection commands, or assuming a `docker layers` subcommand exists when it does not — candidates must know the exact Docker CLI surface.

How to eliminate wrong answers

Option B is wrong because `docker log` (or more accurately `docker logs`) displays the stdout/stderr output of a running or stopped container, not image layer information. Option C is wrong because `docker layers` is not a valid Docker CLI command — no such subcommand exists. Option D is wrong because `docker image info` is not a valid Docker CLI command; image metadata is retrieved via `docker inspect` or `docker image inspect`.

173
MCQmedium

Which command is used to display the XML configuration of a running VM domain named 'webserver'?

A.virsh export webserver
B.virsh show-config webserver
C.virsh dumpxml webserver
D.virsh get-xml webserver
AnswerC

`virsh dumpxml webserver` queries the libvirt daemon and outputs the full XML definition of the running domain named webserver, satisfying the requirement to display its live configuration. Unlike editing commands, it is read-only, and unlike `virsh list`, it returns the complete XML rather than a summary.

Why this answer

virsh dumpxml outputs the full XML definition of a domain, and when the domain is running it reflects the live configuration. This is the standard libvirt command for inspecting a VM's XML. The other options are not valid virsh subcommands for this purpose.

Exam trap

305-300 often tests exact virsh subcommand names, so candidates pick plausible-sounding but nonexistent commands like show-config or get-xml instead of the real dumpxml.

How to eliminate wrong answers

Option A is wrong because virsh export is not a valid subcommand for retrieving domain XML; export-like functionality is not part of the virsh domain inspection command set. Option B is wrong because virsh show-config is not a real virsh subcommand; configuration display is done via dumpxml. Option D is wrong because virsh get-xml does not exist; the correct verb is dumpxml.

174
MCQhard

You are running a Docker container that needs to persist data in a directory that is backed by a storage area on the host. The host uses the overlay2 storage driver. You want the container to write data that survives container removal and is accessible directly on the host filesystem. Which approach should you use?

A.Commit the container to a new image after writing data, and run a new container from that image.
B.Create a named volume with docker volume create and mount it into the container.
C.Use a bind mount to map a host directory into the container.
D.Use a tmpfs mount to store the data in memory.
AnswerC

A bind mount maps an existing directory on the host directly into the container. Data written by the container appears immediately in that host directory, and it persists independently of the container lifecycle. This satisfies both requirements: data survives container removal and is directly accessible on the host filesystem without needing Docker-specific tools to locate it.

Why this answer

Bind mounts directly associate a host directory with a container path, so files written by the container are stored on the host and persist after the container is removed. They also allow direct access to the data from the host without Docker-specific commands. Named volumes persist but are managed by Docker, while tmpfs is memory-only and commits are for image creation, not runtime data persistence.

Exam trap

The trap here is confusing Docker-managed named volumes with bind mounts; both persist data, but only bind mounts give direct host filesystem access at a user-specified path.

175
MCQhard

You are using Docker and want to create a volume that is shared between multiple containers and persists even if the containers are deleted. What is the best approach?

A.Anonymous volume
B.Tmpfs
C.Bind mount
D.Named volume
AnswerD

Named volumes are stored outside the container's writable layer, under Docker's managed volume directory, so data survives container deletion and can be mounted by several containers simultaneously via the same volume name — satisfying both the sharing and persistence constraints in the stem.

Why this answer

A named volume is created and managed by Docker with a user-specified name, stored under /var/lib/docker/volumes, and persists independently of container lifecycle. It can be mounted into multiple containers simultaneously, making it the best choice for shared, persistent data. Named volumes are the recommended approach for production data persistence.

Exam trap

The trap is assuming bind mounts are the best for persistence, when the question emphasizes sharing between multiple containers and persistence after deletion — the defining strengths of named volumes.

How to eliminate wrong answers

Option A (anonymous volume) is wrong because it is created without a name, making it hard to reference or reuse across containers, and it is easily orphaned. Option B (tmpfs) is wrong because tmpfs mounts are stored in memory and are lost when the container stops — they do not persist. Option C (bind mount) is wrong because it mounts a host directory path directly; while it persists, it couples the container to host filesystem layout and is less portable than a named volume for shared multi-container use.

176
MCQeasy

A developer is building a container image and wants to reduce its final size by ensuring that no package manager cache files remain in the image layers. Which Dockerfile instruction should be used to remove these temporary files during the build?

A.ADD rm -rf /var/cache/apt/*
B.ENTRYPOINT rm -rf /var/cache/apt/*
C.CMD rm -rf /var/cache/apt/*
D.RUN rm -rf /var/cache/apt/*
AnswerD

Using RUN to delete cache files in the same layer where they were created ensures the files are not persisted in the final image. If the deletion occurs in a separate RUN instruction, the cache files remain in the earlier layer and still contribute to the image size. Combining installation and cleanup in a single RUN instruction is the recommended practice.

Why this answer

To reduce image size by removing temporary files, the deletion must occur in the same layer where the files were created. The RUN instruction executes commands during the build, so using RUN to remove cache files in the same layer ensures they are not committed to the final image. Other instructions like CMD, ENTRYPOINT, or ADD do not execute during build and cannot remove files.

Exam trap

The trap here is confusing build-time instructions with runtime instructions, assuming that any instruction can modify the image layers.

177
MCQmedium

You are setting up a KVM guest that requires very low latency for a real-time workload. You want to dedicate a physical CPU core to the guest and prevent the host from scheduling other tasks on that core. Which libvirt domain XML configuration achieves this?

A.<cputune><vcpupin vcpu='0' cpuset='2'/></cputune> combined with host kernel parameters isolcpus=2 and nohz_full=2.
B.<cputune><vcpupin vcpu='0' cpuset='2'/><iothreadpin iothread='1' cpuset='3'/></cputune> and <cpu mode='host-passthrough'/>
C.<vcpupin vcpu='0' cpuset='2'/> and <emulatorpin cpuset='2'/>
D.<cputune><vcpupin vcpu='0' cpuset='2'/></cputune> and <numatune><memnode cellid='0' mode='strict' nodeset='1'/></numatune>
AnswerA

Pinning the vCPU to CPU 2 with vcpupin, together with host kernel parameters isolcpus=2 and nohz_full=2, removes CPU 2 from the general scheduler and reduces timer interrupts. This provides true isolation, ensuring the guest's vCPU has a dedicated core with minimal host interference, which is essential for low-latency real-time workloads.

Why this answer

To dedicate and isolate a physical core for a guest, you must both pin the vCPU to that core using vcpupin and configure the host kernel to exclude that core from general scheduling with isolcpus and nohz_full. Pinning alone only restricts where the guest runs; it does not prevent the host from using the core for other tasks. The combination provides the required isolation.

Exam trap

The trap here is believing that vcpupin alone isolates a CPU core; in reality, the host scheduler can still place other processes on that core unless isolcpus is used.

178
MCQeasy

You are using Docker and need to view the layers that make up an image to understand its build history. Which command should you use?

A.docker history <image>
B.docker inspect <image>
C.docker layers <image>
D.docker diff <image>
AnswerA

docker history displays the intermediate layers of an image along with the commands that created them, their sizes, and creation timestamps. It provides a concise view of the image's build history, which is exactly what is needed to understand how the image was constructed. This command is specifically designed for this purpose and is the correct choice.

Why this answer

The docker history command lists the layers of an image along with the commands that created them, making it the right tool to understand build history. docker inspect provides metadata but not a layer-by-layer history, docker layers does not exist, and docker diff is for container filesystem changes. Therefore, docker history is the correct answer.

Exam trap

The trap here is assuming that docker inspect or a non-existent docker layers command can show image layer history, when only docker history provides that specific view.

179
MCQmedium

A cloud-init configuration file is failing to apply the 'write_files' module. Which log file on the target instance should you examine to diagnose the parsing error?

A./var/log/syslog
B./var/log/messages
C./var/log/cloud-init.log
D./var/log/auth.log
AnswerC

The cloud-init log records each module's execution and any YAML parsing errors encountered while processing user-data, including write_files failures. Examining it reveals the exact syntax or schema fault, which the instance console output and syslog do not capture in equivalent detail.

Why this answer

The /var/log/cloud-init.log file is the primary log for cloud-init and records all stages of the cloud-init process, including the parsing and execution of modules like write_files. When a configuration file fails to apply, cloud-init logs detailed error messages, such as syntax errors or invalid YAML, in this file. Therefore, examining /var/log/cloud-init.log is the correct way to diagnose parsing errors.

Exam trap

305-300 often tests the distinction between general system logs and application-specific logs, so candidates might incorrectly choose /var/log/syslog or /var/log/messages assuming they contain all errors, but cloud-init writes detailed parsing errors only to its dedicated log.

How to eliminate wrong answers

Option A is wrong because /var/log/syslog is a general system log that aggregates messages from various services, but it does not contain the detailed cloud-init-specific parsing errors needed for diagnosis. Option B is wrong because /var/log/messages serves a similar purpose as syslog on some distributions, but it also lacks the granular cloud-init module execution details. Option D is wrong because /var/log/auth.log is dedicated to authentication and security events, not cloud-init configuration parsing.

180
MCQmedium

What is the role of the 'Dockerfile' in the container build process?

A.To define network topology
B.To list running containers
C.To store container data
D.To provide build instructions
AnswerD

The Dockerfile supplies the declarative build instructions — base image, RUN commands, COPY directives and ENTRYPOINT — that docker build executes layer by layer. It defines the image contents, satisfying the requirement to specify how the container image is constructed.

Why this answer

A Dockerfile is a text file containing a series of instructions (FROM, RUN, COPY, CMD, etc.) that Docker uses to build a container image. It defines the base image, dependencies, environment, and startup command, effectively providing the build recipe. The 'docker build' command reads the Dockerfile and executes each instruction in order to produce a layered image.

Exam trap

The trap is assuming the Dockerfile does more than define build instructions — candidates may confuse it with runtime configuration files like docker-compose.yml or network/volume definitions.

How to eliminate wrong answers

Option A is wrong because network topology in Docker is defined by network drivers and 'docker network' commands, not by the Dockerfile. Option B is wrong because listing running containers is done with 'docker ps', not via a Dockerfile. Option C is wrong because container data is stored in volumes or bind mounts, which are configured at runtime, not in the Dockerfile (though VOLUME can declare a mount point, it does not store data itself).

181
MCQhard

A VM is hanging because of a specific hardware emulation bug in QEMU. You need to enable the 'qxl' video device to see if it resolves display issues. What is the XML tag to define the video device in the domain config?

A.<video><model type='qxl'/></video>
B.<display model='qxl'/>
C.<graphics type='qxl'/>
D.<device type='video' model='qxl'/>
AnswerA

The `<video>` element with a nested `<model type='qxl'/>` correctly defines the QEMU video device in the domain XML, satisfying the requirement to enable the qxl emulated display adapter. The `type` attribute selects the specific emulation model, so libvirt passes `-vga qxl` to QEMU and resolves the display bug.

Why this answer

In libvirt domain XML, video devices are defined with the <video> element containing a <model type='...'/> child, where the type attribute specifies the emulated adapter such as qxl, vga, cirrus, or virtio. The correct syntax <video><model type='qxl'/></video> is what libvirt's schema expects and what virsh edit will accept. This is the standard way to switch a guest's display adapter to QXL for improved SPICE performance.

Exam trap

The trap is confusing the <graphics> element (which defines the display protocol like SPICE or VNC) with the <video> element (which defines the emulated video adapter), leading candidates to pick the graphics-based distractor.

How to eliminate wrong answers

Option B is wrong because <display> is not a valid libvirt domain XML element — display configuration is handled through <graphics> and <video>, not a standalone <display> tag. Option C is wrong because <graphics type='qxl'/> misuses the graphics element, which is for specifying the display protocol (spice, vnc, sdl, etc.), not the video adapter model. Option D is wrong because <device type='video' model='qxl'/> is not the libvirt schema — video devices use the dedicated <video> element, not the generic <device> wrapper.

182
MCQeasy

You are creating a Vagrant environment for a development team. The team needs a single VM that uses the 'ubuntu/jammy64' box and forwards host port 8080 to guest port 80. Which Vagrantfile configuration block correctly defines this?

A.config.vm.box = "ubuntu/jammy64" config.vm.network "private_network", ip: "192.168.33.10"
B.config.vm.box = "ubuntu/jammy64" config.vm.provision "shell", inline: "apt-get update"
C.config.vm.box = "ubuntu/jammy64" config.vm.network "forwarded_port", guest: 80, host: 8080
D.config.vm.box = "ubuntu/jammy64" config.vm.synced_folder ".", "/var/www", type: "nfs"
AnswerC

This configuration sets the box to ubuntu/jammy64 and defines a forwarded port mapping from host port 8080 to guest port 80. The syntax uses the network forwarded_port option with guest and host parameters, which is the standard Vagrant way to forward ports. It directly satisfies the requirement for a single VM with the specified box and port forwarding.

Why this answer

Vagrant port forwarding is configured with config.vm.network "forwarded_port", specifying guest and host ports. The correct option sets the box to ubuntu/jammy64 and maps host port 8080 to guest port 80. Other options define private networks, synced folders, or provisioners, which do not provide the required port forwarding functionality.

Exam trap

The trap here is mixing up network types, such as private_network, with forwarded_port, which is specifically for host-to-guest port mapping.

183
Multi-Selectmedium

Which TWO of the following are benefits of using the QCOW2 image format?

Select 2 answers
A.Multi-host file locking
B.Hardware acceleration
C.Dynamic allocation (sparse files)
D.Native encryption for all filesystems
E.Snapshot support
AnswersC, E

Sparse files let QCOW2 allocate host disk blocks only as guest data is actually written, so a large virtual disk consumes minimal physical storage initially. This satisfies the question's benefit criterion by avoiding pre-allocation of the full virtual size, unlike raw images.

Why this answer

Option C is correct because QCOW2 (QEMU Copy-On-Write version 2) is a sparse image format: it allocates disk blocks only as guest data is actually written, so a 100 GB virtual disk consumes only as much host space as the data stored in it, and it can grow dynamically up to the configured virtual size. Option E is correct because QCOW2 natively supports internal snapshots (stored inside the image file) and external snapshots, allowing point-in-time states of a VM disk to be created and reverted without copying the whole image. Option A is wrong because multi-host file locking is a feature of clustered/shared storage filesystems such as GFS2 or OCFS2, not of the QCOW2 format itself; QCOW2 images are not designed for concurrent write access from multiple hosts.

Option B is wrong because hardware acceleration (for example KVM, Intel VT-x/AMD-V, or virtio) is provided by the hypervisor and CPU, not by the image file format. Option D is wrong because QCOW2 does not provide native encryption for all filesystems; encryption in QEMU/KVM is typically handled via LUKS or the qcow2 encryption extension (AES-CBC with a single key), which is not a general 'all filesystems' encryption feature.

Exam trap

The trap is assuming QCOW2 provides hardware acceleration or multi-host locking, when those are hypervisor or storage-layer features, not image-format features.

184
Multi-Selectmedium

Which TWO of the following are valid storage drivers used by Docker to manage image layers?

Select 2 answers
A.overlay2
B.ext4
C.vfs-driver
D.zfs-layer
E.aufs
AnswersA, E

overlay2 is a valid Docker storage driver that stacks image layers using the OverlayFS union filesystem, supporting copy-on-write between lower and upper directories. It is the default and recommended driver on modern Linux hosts, making it a legitimate answer for managing image layers.

Why this answer

overlay2 (A) is a valid Docker storage driver that uses the OverlayFS union filesystem to stack image layers and is the default driver on most modern Linux distributions. aufs (E) is also a valid Docker storage driver, historically used on Ubuntu/Debian, that implements a union mount to manage image layers. ext4 (B) is a filesystem, not a Docker storage driver, so it cannot manage image layers. vfs-driver (C) is not a real driver name; the actual driver is 'vfs', and it is a simple non-union driver, but the option as written is incorrect. zfs-layer (D) is not a valid driver name; the actual Docker driver is 'zfs', so this option is incorrect.

Exam trap

The trap here is that candidates confuse filesystems (ext4, XFS) with Docker storage drivers, or accept plausible-sounding but fabricated names like 'vfs-driver' and 'zfs-layer' instead of the exact driver identifiers 'vfs' and 'zfs'.

185
MCQmedium

You are running a Podman container as a non-root user with rootless mode. The container needs to bind to TCP port 80 inside the container's network namespace so a legacy application can listen for HTTP traffic. Which capability must be added to the container to allow binding to this privileged port without running the container as root?

A.CAP_NET_ADMIN
B.CAP_DAC_OVERRIDE
C.CAP_NET_BIND_SERVICE
D.CAP_SYS_ADMIN
AnswerC

CAP_NET_BIND_SERVICE allows a non-root process to bind to ports below 1024, including port 80. In rootless Podman, the container process runs as an unprivileged user on the host, so without this capability the bind to port 80 fails with a permission denied error. Adding this capability via --cap-add=NET_BIND_SERVICE grants exactly the needed privilege while keeping the rest of the container unprivileged.

Why this answer

Binding to ports below 1024 requires the CAP_NET_BIND_SERVICE capability when the process does not have root privileges. In rootless Podman, the container process is mapped to an unprivileged user, so the kernel denies the bind on port 80 unless this capability is explicitly added. The other capabilities listed address unrelated privilege areas and would not resolve the bind failure.

Exam trap

The trap here is assuming that any network-related capability, such as CAP_NET_ADMIN, will allow binding to a privileged port, when only CAP_NET_BIND_SERVICE grants that specific permission.

186
Multi-Selectmedium

Which TWO of the following commands are used for VM disk image management?

Select 2 answers
A.qemu-img list
B.qemu-img create
C.qemu-img status
D.qemu-img format
E.qemu-img info
AnswersB, E

`qemu-img create` provisions a new, empty virtual disk image, defining its format (qcow2, raw) and virtual size without attaching it to a running guest. This satisfies the stem's disk image management requirement by creating the image file itself, distinct from runtime operations such as snapshotting or live migration.

Why this answer

Option B, `qemu-img create`, is correct because it is the standard qemu-img subcommand used to create a new VM disk image, specifying the format (e.g., qcow2, raw) and size. Option E, `qemu-img info`, is correct because it displays metadata about an existing disk image, such as its virtual size, disk size, format, and backing file. The other options are not valid qemu-img subcommands: `qemu-img list` (A) does not exist for enumerating images, `qemu-img status` (C) is not a qemu-img operation, and `qemu-img format` (D) is not a subcommand — formatting is done via the `-f`/`-O` options on create/convert.

Exam trap

The trap is confusing qemu-img subcommands — candidates may pick 'qemu-img format' instead of 'qemu-img convert', or assume 'list' and 'status' exist when they do not.

187
MCQmedium

What is the primary function of the cloud-init 'runcmd' module?

A.Setting the system locale
B.Configuring users
C.Running arbitrary shell commands
D.Installing software packages
AnswerC

The runcmd module executes arbitrary shell commands during instance initialisation, after other cloud-init stages complete. Commands are listed in the cloud-config under 'runcmd' and run in order, letting administrators perform custom configuration beyond the built-in modules.

Why this answer

The cloud-init `runcmd` module executes arbitrary shell commands on the instance during the final stage of boot, after other configuration modules have run. It is commonly used to run scripts, start services, or perform custom setup that is not covered by declarative modules. Because it runs late in the boot sequence, it can rely on packages and files configured by earlier modules.

Exam trap

305-300 often tests the distinction between cloud-init modules by function — candidates may pick `packages` or `users` for tasks that `runcmd` can technically do, but the question asks for the module whose primary purpose is running arbitrary shell commands.

How to eliminate wrong answers

Option A is wrong because setting the system locale is handled by the `locale` module, not `runcmd`. Option B is wrong because configuring users is handled by the `users` and `groups` modules. Option D is wrong because installing software packages is handled by the `packages` module (or `apt`/`yum` specific modules), not `runcmd`, although `runcmd` could technically run a package manager command, that is not its primary function.

188
MCQhard

You are troubleshooting a Docker container that cannot reach the internet despite the host having connectivity. The container uses the default bridge network. Which iptables chain is most likely causing the block?

A.PREROUTING
B.POSTROUTING
C.FORWARD
D.OUTPUT
AnswerC

Docker's default bridge network routes container traffic through the host's FORWARD chain, since packets are forwarded between the bridge and the external interface. A restrictive FORWARD policy (DROP) blocks that path even though the host itself has connectivity, making FORWARD the chain responsible for the container's failed internet access.

Why this answer

Docker's default bridge network relies on the host's FORWARD chain to route packets between the docker0 bridge and the external interface. If the FORWARD chain's default policy is DROP (common on hardened hosts or when firewalld/ufw is misconfigured), container traffic is silently dropped even though the host itself has internet access. Docker normally inserts its own DOCKER-USER and DOCKER-FORWARD rules to permit this, but a conflicting firewall rule or a policy change can override them.

Exam trap

The trap is that candidates assume the problem is NAT (POSTROUTING) because they conflate 'no internet' with 'no masquerading', when the more common cause is the FORWARD chain policy blocking routed container traffic.

How to eliminate wrong answers

Option A is wrong because PREROUTING handles DNAT for published ports (incoming traffic to containers), not outbound container-to-internet traffic. Option B is wrong because POSTROUTING handles SNAT/masquerading of outbound packets — if masquerading were broken, the symptom would be different (packets leaving with the container's private IP), and Docker sets this up automatically. Option D is wrong because OUTPUT only applies to locally generated host traffic, not to packets being forwarded from the docker0 bridge.

189
MCQeasy

Which command provides system-wide information about the Docker installation?

A.docker inspect
B.docker status
C.docker info
D.docker version
AnswerC

docker info queries the daemon directly, returning host-wide details such as storage driver, kernel version, CPU and memory totals, and running container counts. This satisfies the stem's system-wide scope, unlike docker version, which reports only client and server version numbers.

Why this answer

The `docker info` command provides system-wide information about the Docker installation, including the number of containers and images, storage driver, logging driver, kernel version, operating system, CPU and memory resources, and Docker root directory. It is the standard command for a high-level overview of the Docker daemon's configuration and state.

Exam trap

The trap is confusing `docker info` (system-wide daemon information) with `docker version` (client/server version details) or `docker inspect` (per-object metadata) — candidates must match the scope of the command to the question's request.

How to eliminate wrong answers

Option A is wrong because `docker inspect` is used to inspect a specific container, image, network, or volume — it returns detailed JSON metadata for a single object, not system-wide information. Option B is wrong because `docker status` is not a valid Docker CLI command. Option D is wrong because `docker version` shows the version information of the Docker client and server (daemon), including API version and Go version, but not system-wide configuration details like storage driver or resource counts.

190
Multi-Selectmedium

Which THREE of the following are common cloud-init modules?

Select 3 answers
A.network-bridge
B.packages
C.runcmd
D.disk-partition
E.users-groups
AnswersB, C, E

The packages module is a standard cloud-init module that installs listed packages during first boot, satisfying the stem's requirement for a genuine cloud-init module. It runs in the config stage and is distinct from bootcmd or write_files, which handle commands and file content instead.

Why this answer

Option B (packages) is a standard cloud-init module that installs or upgrades packages on first boot by reading the packages and package_upgrade keys, so it is correct. Option C (runcmd) is a core cloud-init module that executes arbitrary shell commands listed under the runcmd key during the final boot stage, making it correct. Option E (users-groups) is the cloud-init module responsible for creating and configuring users and groups from the users and groups directives, so it is also correct.

Options A (network-bridge) and D (disk-partition) are not cloud-init modules; networking is handled by modules such as network-config or the distro's network renderer, and partitioning is handled by modules like disk_setup and growpart, so neither belongs here.

Exam trap

The trap is picking plausible-sounding but non-existent modules like 'network-bridge' or 'disk-partition' — candidates who have not read the cloud-init module list assume any infrastructure task must have a dedicated module, when in fact many tasks are handled by runcmd or by differently named modules (disk_setup, mounts).

191
Multi-Selectmedium

Which THREE directives are valid under the cloud-init 'users' configuration section?

Select 3 answers
A.name
B.ssh_authorized_keys
C.expiration_date
D.security_level
E.groups
AnswersA, B, E

name is the mandatory identifying directive within cloud-init's users section, specifying the account to create or modify. It satisfies the stem by being a core valid user-configuration key, required whenever a user entry is defined.

Why this answer

In the cloud-init 'users' configuration section, the 'name' directive (A) is valid and required, as it defines the login name of the user account to be created. The 'ssh_authorized_keys' directive (B) is also valid, allowing a list of public SSH keys to be injected into the user's ~/.ssh/authorized_keys file for passwordless authentication. The 'groups' directive (E) is valid as well, specifying a list of supplementary groups to which the user should be added.

The 'expiration_date' option (C) is not a recognized cloud-init user directive; account expiration is handled via the 'expire' directive (or 'expiredate' in some schemas), not 'expiration_date'. The 'security_level' option (D) is not part of the cloud-init users schema at all and has no meaning in this context.

Exam trap

The trap is that plausible-sounding keys like `expiration_date` or `security_level` feel like they belong in a user configuration schema, but cloud-init's users module only supports a specific documented set.

192
MCQmedium

You need to run a container that requires access to the host's network namespace directly to perform packet capture. Which Docker run flag should you use?

A.--cap-add NET_ADMIN
B.--privileged
C.--net bridge
D.--network host
AnswerD

`--network host` places the container directly in the host's network namespace, so its interfaces and packet-capture capabilities are the host's own. This satisfies the stem's requirement for direct namespace access, unlike bridge or overlay networks, which isolate the container behind NAT and a separate stack.

Why this answer

The --network host flag attaches the container directly to the host's network namespace, meaning the container shares the host's network stack (interfaces, routing table, and loopback). This is exactly what is required for packet capture tools like tcpdump or Wireshark to see host-level traffic without NAT or bridge isolation. Unlike capability grants, this flag changes the network namespace itself, which is the actual requirement stated in the question.

Exam trap

The trap here is confusing capability grants (NET_ADMIN, --privileged) with namespace sharing — candidates assume that granting more privileges automatically gives host network visibility, when only --network host changes the namespace.

How to eliminate wrong answers

Option A is wrong because --cap-add NET_ADMIN only grants the capability to perform network administration tasks (like configuring interfaces or enabling promiscuous mode) but does not place the container in the host's network namespace, so it still sees only its own isolated bridge network. Option B is wrong because --privileged grants all capabilities and disables most isolation, but it does not by itself change the network namespace — the container still uses the default bridge unless --network host is also specified. Option C is wrong because --net bridge is the default Docker network mode that places the container on an isolated bridge network with NAT, which is the opposite of what packet capture on host traffic requires.

193
MCQmedium

You have an active domain named 'myvm'. How do you gracefully shut it down?

A.virsh stop myvm
B.virsh poweroff myvm
C.virsh destroy myvm
D.virsh shutdown myvm
AnswerD

virsh shutdown issues an ACPI shutdown signal to the guest, letting the domain's operating system terminate cleanly and flush buffers. This satisfies the graceful requirement, unlike virsh destroy, which cuts power abruptly and risks filesystem corruption.

Why this answer

'virsh shutdown myvm' sends an ACPI shutdown signal to the guest, allowing the guest OS to run its shutdown sequence gracefully. This is the correct way to power off a domain cleanly. It requires the guest to have ACPI support and a running acpid/systemd to honor the request.

Exam trap

The trap is assuming 'destroy' means graceful deletion — in libvirt, destroy is the forceful power-off, while shutdown is the graceful ACPI request.

How to eliminate wrong answers

Option A is wrong because 'virsh stop' is not a valid virsh subcommand — there is no stop verb in virsh. Option B is wrong because 'virsh poweroff' is not a valid virsh subcommand either; poweroff is not exposed by virsh (it exists in other tools like virsh's destroy semantics but not as a named command). Option C is wrong because 'virsh destroy' performs an immediate, hard power-off (equivalent to pulling the plug), which is not graceful and can corrupt the guest filesystem.

194
MCQeasy

Which flag is used to run a container in the background?

A.-t
B.-b
C.-d
D.-i
AnswerC

The -d flag detaches the container, running it in the background so the terminal returns immediately instead of attaching to the process output. This matches the stem's requirement precisely; without it, docker run stays in the foreground.

Why this answer

The `-d` (or `--detach`) flag tells `docker run` to start the container and immediately return control to the shell, running the container in the background. Without it, the container runs in the foreground and attaches its STDOUT/STDERR to your terminal, blocking the prompt until the process exits. This is the standard way to launch long-running services like web servers or databases.

Exam trap

The trap is mixing up the interactive flags (`-i`, `-t`) with the detach flag (`-d`) — candidates who memorise 'i for interactive, t for terminal' sometimes wrongly assume one of those backgrounds the container.

How to eliminate wrong answers

Option A is wrong because `-t` (or `--tty`) allocates a pseudo-TTY for the container, which is typically paired with `-i` for interactive shells — it does not detach the container. Option B is wrong because `-b` is not a valid `docker run` flag for background execution; there is no such short option in the Docker CLI. Option D is wrong because `-i` (or `--interactive`) keeps STDIN open for the container, which is used for interactive sessions, not for backgrounding — it must be combined with `-d` or `-t` to be useful.

195
MCQeasy

What does 'QEMU' stand for?

A.Quantum Emulator
B.Quick Execution Machine Utility
C.Quick Emulator
D.Quality Emulator
AnswerC

Quick Emulator accurately expands the QEMU acronym, matching the virtualisation tool that performs hardware emulation and dynamic binary translation. This satisfies the stem's requirement for the correct expansion, distinguishing it from unrelated terms such as queue management or quality metrics.

Why this answer

QEMU is an open-source emulator and virtualizer that performs hardware virtualization. The name 'QEMU' is an acronym for 'Quick Emulator', reflecting its original design goal of fast emulation of a complete computer system. It is widely used in conjunction with KVM (Kernel-based Virtual Machine) to provide full virtualization on Linux, and it can also run standalone as a pure emulator for cross-platform development and testing.

Exam trap

The trap here is that candidates might confuse 'QEMU' with other emulators or assume the 'Q' stands for 'Quality' or 'Quantum', but the correct expansion is 'Quick Emulator'.

How to eliminate wrong answers

Option A is wrong because 'Quantum Emulator' is not a recognized term in computing; QEMU has no relation to quantum computing. Option B is wrong because 'Quick Execution Machine Utility' is a fabricated expansion that does not correspond to any known software; QEMU's name is not derived from these words. Option D is wrong because 'Quality Emulator' is a misleading expansion; while QEMU is a high-quality emulator, the 'Q' stands for 'Quick', not 'Quality'.

196
MCQmedium

What is the purpose of the 'ENTRYPOINT' instruction in a Dockerfile?

A.To run build-time commands
B.To copy files
C.To configure the container as an executable
D.To set environment variables
AnswerC

ENTRYPOINT defines the fixed executable launched when the container starts, letting the image run as a self-contained command. Unlike CMD, its arguments are not overridden by docker run parameters, so the container behaves as the packaged application itself.

Why this answer

ENTRYPOINT configures the container to run as an executable by defining the command that executes when the container starts. Arguments passed on 'docker run' are appended to ENTRYPOINT rather than replacing it, which is what makes the container behave like a standalone binary. This is distinct from CMD, which provides overridable defaults.

Exam trap

The trap is mixing up ENTRYPOINT with RUN or CMD — candidates see 'executable' and pick RUN (build-time) or pick CMD thinking it is the same, missing that ENTRYPOINT is the non-overridable runtime executable definition.

How to eliminate wrong answers

Option A is wrong because build-time commands are executed with RUN during image build, not ENTRYPOINT at runtime. Option B is wrong because copying files into the image is done with COPY or ADD. Option D is wrong because environment variables are set with ENV (or passed via --env at runtime), not ENTRYPOINT.

197
Multi-Selectmedium

Which TWO of the following are key features of the QEMU-KVM hypervisor?

Select 2 answers
A.Hardware-assisted virtualization
B.Comprehensive device emulation
C.Automated host patching
D.Integrated disk backup service
E.Built-in web server
AnswersA, B

Hardware-assisted virtualization uses Intel VT-x or AMD-V extensions, letting guest instructions execute directly on the CPU rather than through binary translation. This satisfies the stem's requirement for a key QEMU-KVM feature, since KVM operates as a Linux kernel module exposing these CPU virtualisation extensions to QEMU virtual machines.

Why this answer

QEMU-KVM is a combination of the KVM kernel module and the QEMU userspace emulator, and its defining feature is hardware-assisted virtualization: KVM leverages CPU virtualization extensions such as Intel VT-x (vmx) and AMD-V (svm) to run guest code directly on the host CPU, which is why option A is correct. Option B is also correct because QEMU provides comprehensive device emulation, presenting virtual hardware such as IDE/SCSI controllers, NICs (e.g., e1000, virtio-net), VGA adapters, and USB controllers to guests, and it also supports paravirtualized virtio devices for performance. The remaining options do not belong: automated host patching (C) is a configuration-management function handled by tools like Ansible, Puppet, or yum/dnf, not by the hypervisor itself; an integrated disk backup service (D) is not part of QEMU-KVM, since backups are performed with external tools such as qemu-img, libvirt snapshots, or third-party backup software; and a built-in web server (E) is not a QEMU-KVM feature, as remote management is typically provided by separate stacks like libvirt, virt-manager, or oVirt/Proxmox.

Exam trap

The trap is attributing management or convenience features like patching or backup to the hypervisor; candidates might confuse QEMU-KVM with full-fledged virtualization platforms that include such tools.

198
MCQmedium

How can you force a refresh of a libvirt storage pool named 'isos'?

A.virsh pool-refresh isos
B.virsh refresh-pool isos
C.virsh pool-update isos
D.virsh pool-reload isos
AnswerA

virsh pool-refresh isos rescans the pool's underlying storage, updating libvirt's record of available volumes without restarting the pool. It satisfies the stem's refresh requirement directly, unlike pool-start, which activates an inactive pool, or pool-info, which only reports status.

Why this answer

Option A is correct because 'virsh pool-refresh isos' is the exact libvirt command to refresh a storage pool named 'isos'. This command rescans the pool's underlying storage (e.g., a directory or LVM volume group) and updates libvirt's internal list of available volumes, making new files visible without restarting libvirtd.

Exam trap

The trap is mixing up virsh subcommand syntax — candidates often guess 'refresh-pool' or 'pool-reload' instead of the correct 'pool-refresh'.

How to eliminate wrong answers

Option B is wrong because 'virsh refresh-pool' is not a valid virsh subcommand — the correct syntax is 'pool-refresh'. Option C is wrong because 'virsh pool-update' does not exist; the correct command to modify pool parameters is 'pool-edit' or 'pool-set'. Option D is wrong because 'virsh pool-reload' is not a valid command; libvirt uses 'pool-refresh' for rescanning, not 'reload'.

199
MCQhard

You are configuring an OpenVZ container. Which command is used to set the hostname of the container from the host?

A.vzctl set CTID --hostname
B.vzcfg
C.hostnamectl
D.openvz-edit
AnswerA

vzctl set applies configuration changes to a running or stopped OpenVZ container from the host, and the --hostname parameter sets the container's hostname directly. This avoids entering the container, satisfying the requirement to configure it from the host.

Why this answer

The `vzctl set <CTID> --hostname <name>` command sets the hostname of an OpenVZ container from the host. The `--hostname` option updates the container's configuration and applies the change, optionally with `--save` to persist it to the configuration file.

Exam trap

The trap is confusing host-level tools (`hostnamectl`) with OpenVZ-specific management commands (`vzctl`) — candidates must know that OpenVZ containers are managed from the host via `vzctl`, not via in-container systemd tools.

How to eliminate wrong answers

Option B is wrong because `vzcfg` is not a valid OpenVZ command — there is no such utility. Option C is wrong because `hostnamectl` is a systemd utility that sets the hostname of the local system (or a container if run inside it), but it cannot target a remote OpenVZ container from the host. Option D is wrong because `openvz-edit` is not a valid OpenVZ command — configuration is edited via `vzctl set` or by directly editing `/etc/vz/conf/<CTID>.conf`.

200
Multi-Selecthard

Which TWO methods can be used to pass configuration data to cloud-init during instance creation?

Select 2 answers
A.kernel-args
B.user-data
C.bios-injection
D.sys-config
E.metadata
AnswersB, E

The primary configuration file.

Why this answer

Option B (user-data) is correct because cloud-init's primary mechanism for receiving instance-specific configuration at launch is the user-data blob, which can contain cloud-config YAML, shell scripts, or cloud-boothook directives that cloud-init parses on first boot. Option E (metadata) is correct because cloud-init also consumes instance metadata (for example, EC2 IMDS or OpenStack metadata service) to obtain configuration such as hostname, SSH keys, and network settings during initialization. Option A (kernel-args) is not a standard cloud-init configuration channel, since kernel command-line parameters are used for boot-time kernel behavior rather than passing structured config data to cloud-init.

Option C (bios-injection) is not a supported cloud-init datasource method, as BIOS settings are firmware-level and not used to deliver cloud-init configuration. Option D (sys-config) is not a recognized cloud-init mechanism; no such datasource or configuration-passing method exists in cloud-init's documented interfaces.

Exam trap

The trap is confusing kernel boot parameters with cloud-init inputs — candidates see 'kernel-args' and assume it's a legitimate injection path because cloud-init does read some system info at boot.

201
MCQhard

In a Docker environment, you are observing that container logs are consuming too much disk space. Which logging driver should you configure to limit the number and size of log files?

A.none
B.json-file
C.syslog
D.journald
AnswerB

The json-file driver writes each container's stdout/stderr to JSON files and honours max-size and max-file options, capping both individual file size and retained file count. This directly satisfies the stem's requirement to limit log number and size.

Why this answer

The json-file logging driver is Docker's default and supports the max-size and max-file options, which limit the size of each log file and the number of rotated files. Configuring these options prevents container logs from consuming excessive disk space. Other drivers either discard logs or forward them without built-in rotation controls.

Exam trap

305-300 often tests whether candidates know that log rotation options (max-size, max-file) are specific to the json-file (and local) driver, so the trap is choosing syslog or journald assuming they offer the same Docker-level rotation controls.

How to eliminate wrong answers

Option A is wrong because the none driver disables logging entirely, which loses logs rather than limiting their size. Option C is wrong because syslog forwards logs to a syslog server and does not provide local file rotation limits. Option D is wrong because journald sends logs to systemd-journald, where rotation is managed by journald configuration, not Docker's max-size/max-file options.

202
MCQhard

You are using Packer to build an image for a private cloud. The build uses the 'qemu' builder and a 'shell' provisioner. The provisioner script runs but fails to install a package because the package repository is unreachable. You suspect the VM has no network connectivity during provisioning. Which Packer feature should you verify to ensure the VM has network access?

A.The 'accelerator' setting in the qemu builder configuration.
B.The 'http_directory' setting in the builder configuration.
C.The 'net_device' setting in the qemu builder configuration.
D.The 'communicator' setting in the builder configuration.
AnswerC

In the qemu builder, the 'net_device' setting specifies the network device model and can also configure the network backend. If it is set to 'none' or misconfigured, the VM will have no network connectivity. By default, Packer configures a user-mode network, but if overridden, the VM may lack access. Verifying this setting ensures the VM can reach external repositories.

Why this answer

The qemu builder's 'net_device' setting defines the network interface for the VM. If it is set to 'none' or lacks a proper backend, the VM will have no network connectivity, causing package installations to fail. Packer's default qemu configuration usually includes a user-mode network, but explicit overrides can disable it.

Checking this setting ensures the VM can reach external repositories during provisioning.

Exam trap

The trap here is confusing the communicator with network connectivity; the communicator only enables Packer to run commands, not the VM's own outbound network access.

203
Multi-Selecthard

Which TWO of the following are true regarding container orchestration platforms?

Select 2 answers
A.They replace the container runtime
B.They automate container deployment
C.They only run on bare metal
D.They manage container health monitoring
E.They require a single container image
AnswersB, D

Container orchestration platforms schedule containers onto nodes and manage their lifecycle automatically, satisfying the stem's requirement for automated deployment. The scheduler evaluates resource requests, affinity rules and node health before placing workloads, then restarts or reschedules failed containers without manual intervention, which is precisely the automation the question asks about.

Why this answer

Option B is correct because container orchestration platforms such as Kubernetes, Docker Swarm, and Amazon ECS are specifically designed to automate the deployment, scheduling, and scaling of containers across a cluster of hosts. Option D is correct because these platforms continuously monitor container health through liveness and readiness probes (e.g., Kubernetes livenessProbe/readinessProbe) and automatically restart or reschedule unhealthy containers to maintain the desired state. Option A is incorrect because orchestration platforms sit above and consume a container runtime such as containerd or CRI-O rather than replacing it.

Option C is incorrect because orchestration platforms can run on bare metal, virtual machines, or cloud instances. Option E is incorrect because orchestration platforms are designed to manage many different container images simultaneously, not a single image.

Exam trap

The trap is conflating orchestration with the container runtime — candidates pick 'they replace the container runtime' because orchestration feels like a higher-level replacement, when in fact it depends on the runtime underneath.

204
Multi-Selectmedium

Which TWO of the following are valid libvirt storage pool lifecycle commands?

Select 2 answers
A.pool-halt
B.pool-start
C.pool-reboot
D.pool-destroy
E.pool-pause
AnswersB, D

pool-start activates a previously defined but inactive libvirt storage pool, making its volumes available to guests. It is a genuine lifecycle command, complementing pool-destroy, and satisfies the stem's request for valid storage pool lifecycle operations.

Why this answer

Option B, pool-start, is correct because it is a genuine virsh subcommand that activates a previously defined but inactive storage pool, making its backing storage available for allocation to guests. Option D, pool-destroy, is correct because it is the valid virsh command that stops an active storage pool, tearing down its runtime state without deleting its persistent definition. The other options are not libvirt commands: pool-halt (A) and pool-reboot (C) are not virsh storage pool subcommands at all, and pool-pause (E) does not exist, since libvirt storage pools have no pause state — only active/inactive and defined/undefined states managed via pool-start, pool-destroy, pool-define, and pool-undefine.

Exam trap

The trap here is confusing domain lifecycle commands (like destroy, start, reboot, pause) with storage pool commands; candidates might assume pool-halt or pool-pause exist because similar commands exist for domains.

205
MCQmedium

You are managing a Xen host and need to live-migrate a domain between two physical servers. The migration fails with a domain lock error. Which command is the standard way to initiate a live migration while ensuring the target host is prepared to receive the domain?

A.xl save <domain> <file> && xl restore <file>
B.xen-migrate --live <domain> <target_host>
C.xl migrate <domain> <target_host>
D.virsh migrate --live <domain> <target_host>
AnswerC

xl migrate initiates live migration of the named domain to the target host, coordinating the transfer and preparing the destination to receive it. This is the standard Xen toolstack command, resolving the domain lock error caused by an unprepared target.

Why this answer

The xl migrate command is the standard Xen tool for live-migrating a domain to another host, and it handles the necessary preparation on the target host (such as creating the domain configuration and transferring memory state) to receive the domain. It is the direct counterpart to xm migrate in the newer xl toolstack.

Exam trap

The trap is confusing Xen native tools (xl) with libvirt tools (virsh) — candidates often pick virsh migrate because it's more familiar, but the question specifies a Xen host, where xl migrate is the correct command.

How to eliminate wrong answers

Option A is wrong because xl save and xl restore perform a save/restore operation, which is not a live migration — it suspends the domain, writes it to a file, and restores it elsewhere, causing downtime. Option B is wrong because xen-migrate is not a standard command in the xl toolstack; the correct command is xl migrate. Option D is wrong because virsh migrate is a libvirt command used with KVM/QEMU, not the native Xen toolstack command for Xen hosts.

206
MCQmedium

You are building a Docker image for a Python web application. The Dockerfile currently contains: FROM python:3.9-slim COPY . /app WORKDIR /app RUN pip install -r requirements.txt CMD ["python", "app.py"] After building, you notice that every time you change app.py, the entire pip install step re-runs, making builds slow. Which change to the Dockerfile will best address this?

A.Add a .dockerignore file that excludes app.py so that changes to it do not invalidate the cache.
B.Use a multistage build with a separate stage for dependencies, and copy the installed packages from the builder stage into the final stage.
C.Combine the COPY and RUN instructions into a single RUN instruction using a shell command to copy files and install dependencies.
D.Move the COPY instruction to after the RUN pip install instruction, and copy only requirements.txt before the RUN.
AnswerD

Placing COPY requirements.txt before RUN pip install allows Docker to cache the dependency layer. When only app.py changes, the cached pip install layer is reused, drastically speeding up rebuilds. Copying the rest of the source after the RUN ensures that source changes do not invalidate the dependency installation layer, which is the core optimization for build caching.

Why this answer

Docker builds images layer by layer and caches each layer based on the instruction and the files it references. By copying only requirements.txt and running pip install before copying the rest of the source, the expensive dependency installation layer remains cached as long as requirements.txt is unchanged. Subsequent changes to application code only invalidate later layers, resulting in much faster rebuilds.

Exam trap

The trap here is assuming that any COPY instruction invalidates all subsequent layers, when in fact Docker's cache is keyed to the specific files referenced by each COPY, so ordering matters.

207
MCQeasy

Which command is used to stop all running containers?

A.docker kill --all
B.docker stop $(docker ps -q)
C.docker rm -f *
D.docker prune
AnswerB

docker ps -q lists only the IDs of running containers, and command substitution feeds that list to docker stop, halting each one. This satisfies the stem's requirement to stop all running containers in a single command.

Why this answer

docker stop $(docker ps -q) uses command substitution: docker ps -q lists only the IDs of running containers, and those IDs are passed to docker stop, which gracefully sends SIGTERM then SIGKILL after a timeout. This is the idiomatic way to stop all running containers from the shell. The other options either don't exist, target the wrong resource, or perform a different operation.

Exam trap

The trap is that docker kill --all looks like a valid bulk operation, but docker kill has no --all flag — candidates must know the correct command-substitution idiom.

How to eliminate wrong answers

Option A (docker kill --all) is wrong because docker kill does not support an --all flag; it requires explicit container names or IDs and sends SIGKILL immediately without graceful shutdown. Option C (docker rm -f *) is wrong because docker rm removes containers (forcefully if running) rather than stopping them, and the shell glob * would expand to filenames in the current directory, not container IDs. Option D (docker prune) is wrong because docker prune (e.g., docker system prune) removes unused data like stopped containers, networks, and dangling images — it does not stop running containers.

208
MCQmedium

When managing storage pools using virsh, which command would you use to list all defined storage pools, including those that are inactive?

A.virsh list-pools --inactive
B.virsh pool-info --all
C.virsh pool-show --all
D.virsh pool-list --all
AnswerD

The --all flag overrides pool-list's default behaviour of showing only active pools, causing libvirt to enumerate every defined storage pool regardless of state. Without it, inactive pools remain hidden, so this satisfies the stem's requirement to include inactive entries.

Why this answer

The correct command is `virsh pool-list --all`. In libvirt's virsh CLI, `pool-list` is the dedicated subcommand for enumerating storage pools, and the `--all` flag extends the default output (which shows only active pools) to include inactive pools as well. This mirrors the pattern used by `virsh list --all` for domains, making it the canonical way to see every defined pool regardless of state.

Exam trap

The trap here is confusing virsh's noun-first subcommand naming (`pool-list`) with verb-first alternatives (`list-pools`) and assuming `--all` works on `pool-info` the way it does on `list` — candidates who pattern-match from other CLIs pick A or B.

How to eliminate wrong answers

Option A is wrong because `list-pools` is not a valid virsh subcommand — virsh uses noun-first syntax like `pool-list`, not verb-first `list-pools`; additionally `--inactive` is not a recognized flag for pool listing. Option B is wrong because `pool-info` requires a specific pool name or UUID as an argument and reports details for a single pool; it does not enumerate pools and does not accept `--all`. Option C is wrong because `pool-show` does not exist in virsh — the closest real commands are `pool-dumpxml` and `pool-info`, neither of which lists all pools.

209
MCQmedium

Which Packer builder is most appropriate for creating an image specifically for Amazon Web Services (AWS)?

A.amazon-ebs
B.virtualbox-iso
C.qemu
D.docker
AnswerA

The amazon-ebs builder provisions an EC2 instance, runs provisioners against it, then stops it and creates an Amazon Machine Image (AMI) from the resulting EBS snapshot. This directly satisfies the requirement for an AWS-specific image, producing a native AMI rather than a generic artefact requiring later conversion.

Why this answer

The amazon-ebs builder is Packer's native AWS builder that launches a temporary EC2 instance, provisions it, creates an EBS-backed AMI, and terminates the instance. It is the standard and most appropriate choice for producing AWS AMIs directly. The other builders target different platforms or artifact formats.

Exam trap

305-300 often tests whether candidates can match Packer builders to their target platforms — the trap is picking a generic builder like qemu or virtualbox-iso when the question specifically asks for an AWS-native AMI.

How to eliminate wrong answers

Option B is wrong because virtualbox-iso builds a VirtualBox OVF/OVA image for local desktop virtualization, not an AWS AMI. Option C is wrong because the qemu builder produces QEMU/KVM disk images (e.g., qcow2/raw) for local or on-prem hypervisors, not AWS-native AMIs. Option D is wrong because the docker builder produces Docker container images, which are a completely different artifact type from an EC2 AMI.

210
MCQhard

You are using libvirt to manage a QEMU VM. You want to pass a specific host USB device with vendor ID 1234 and product ID 5678 to the guest. Which XML element is used inside the <devices> block to define this?

A.<controller type='usb' index='0'><address vendor='1234'/></controller>
B.<device type='usb'>1234:5678</device>
C.<usb-passthrough vendor='1234' product='5678'/>
D.<hostdev mode='subsystem' type='usb'><source><vendor id='0x1234'/><product id='0x5678'/></source></hostdev>
AnswerD

The hostdev element with mode='subsystem' and type='usb' passes the physical USB device through to the guest, matching vendor and product IDs in hexadecimal. This satisfies the requirement to hand the specific 1234:5678 device to the VM.

Why this answer

Libvirt's canonical way to pass a host USB device to a guest is the <hostdev> element with mode='subsystem' and type='usb', containing a <source> block with <vendor id='0x1234'/> and <product id='0x5678'/>. This tells QEMU to detach the device from the host and attach it to the guest via USB redirection, and the IDs must be in hexadecimal with the 0x prefix.

Exam trap

The trap is that candidates pick a plausible-sounding custom element like <usb-passthrough> instead of remembering that libvirt unifies all host device passthrough (PCI, USB, SCSI) under the <hostdev> element.

How to eliminate wrong answers

Option A is wrong because <controller type='usb'> defines a USB controller for the guest, not a passthrough of a specific host device — the address attribute shown is not valid for USB controllers. Option B is wrong because <device type='usb'> is not a valid libvirt device element; the correct element is <hostdev>. Option C is wrong because <usb-passthrough> is not a libvirt XML element at all — it is a fabricated tag that does not exist in the domain schema.

Page 2

Page 3 of 3

All pages