Courseiva

LPIC-3 Exam 305: Virtualization and Containerization (305-300) (305-300) (305-300) — Questions 76–150

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

Page 1

Page 2 of 3

Page 3
76
Multi-Selectmedium

Which TWO of the following are valid container orchestration platforms?

Select 2 answers
A.Nginx
B.Kubernetes
C.Docker Desktop
D.Nomad
E.GitLab
AnswersB, D

Kubernetes satisfies the orchestration requirement by automating container deployment, scaling and management across clusters. It provides declarative configuration, self-healing, service discovery and load balancing, which are the defining capabilities the question demands. Unlike standalone runtimes such as Docker Engine, Kubernetes coordinates workloads across multiple hosts, making it a valid orchestration platform.

Why this answer

Kubernetes (B) is a valid container orchestration platform because it schedules and manages containers across a cluster of nodes, handling deployment, scaling, service discovery, and self-healing via components like the kube-apiserver, kubelet, and etcd. Nomad (D) is also a valid orchestration platform, as HashiCorp Nomad schedules and runs containerized and non-containerized workloads across a cluster using job specifications and drivers such as Docker. Nginx (A) is a web server and reverse proxy, not an orchestrator, though it can act as an ingress/load balancer in front of orchestrated workloads.

Docker Desktop (C) is a local development environment for building and running containers on a single machine, not a cluster orchestration platform. GitLab (E) is a DevOps/CI-CD platform and Git repository manager, not a container orchestrator, even though it can integrate with Kubernetes.

Exam trap

The trap here is confusing container-related tools (Docker Desktop, Nginx, GitLab) with true orchestration platforms that schedule and manage containers across multiple nodes.

77
MCQhard

You are using cloud-init to configure a VM that must run a script only on the very first boot, and the script must not run again on subsequent reboots. The script is provided as a MIME part in a multipart user-data file. Which cloud-init module should be used to ensure this behavior?

A.bootcmd
B.scripts-per-boot
C.scripts-per-instance
D.runcmd
AnswerC

scripts-per-instance is a cloud-init module that runs scripts exactly once per instance, on the first boot. It is designed for tasks that should only happen during initial provisioning. By providing the script as a MIME part with the appropriate content type, cloud-init will execute it only on the first boot, satisfying the requirement.

Why this answer

Cloud-init's scripts-per-instance module executes scripts only on the first boot of an instance. It is intended for one-time provisioning tasks. In a multipart user-data file, scripts can be included with a content type that cloud-init recognizes for per-instance execution.

Other modules like bootcmd or runcmd run on every boot, and scripts-per-boot is explicitly for every boot. Therefore, scripts-per-instance is the correct module.

Exam trap

The trap here is confusing scripts-per-boot with scripts-per-instance, as both involve scripts but differ in execution frequency.

78
Multi-Selectmedium

Which TWO commands are used to manage images in Docker?

Select 2 answers
A.docker tag
B.docker run
C.docker create
D.docker attach
E.docker build
AnswersA, E

docker tag assigns an additional repository name and tag to an existing local image, creating a new reference without rebuilding layers. This is an image-management operation, satisfying the stem's requirement for commands that manage images rather than containers or networks.

Why this answer

docker tag (A) is correct because it manages images by creating a new reference/tag pointing to an existing image (docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]), which is an image-level operation. docker build (E) is correct because it manages images by constructing a new image from a Dockerfile and build context, producing an image stored in the local image cache. The other options operate on containers rather than images: docker run (B) creates and starts a container from an image, docker create (C) creates a container without starting it, and docker attach (D) attaches the local standard input/output/error streams to a running container's process.

Exam trap

305-300 often tests the boundary between image-level and container-level commands, so candidates pick docker run or docker create because they think of them as the most common Docker commands rather than checking whether they act on images.

79
Multi-Selecthard

Which THREE of the following attributes can be defined within the <memoryBacking> XML block?

Select 3 answers
A.<hugepages/>
B.<source type='file'/>
C.<swap-limit/>
D.<balloon-rate/>
E.<locked/>
AnswersA, B, E

The `<hugepages/>` element sits inside `<memoryBacking>` and enables backing the guest's memory with pre-allocated huge pages, reducing TLB pressure. This satisfies the stem's requirement that the attribute be definable within that block, since libvirt documents hugepages as a valid memoryBacking child alongside locked and nosharepages.

Why this answer

In libvirt domain XML, the <memoryBacking> element controls how a guest's memory is backed, and it accepts the <hugepages/>, <locked/>, and <source type='file'/> sub-elements. Option A, <hugepages/>, is correct because it instructs libvirt to back the guest RAM with huge pages (e.g., via the hugepages mount) instead of regular 4 KiB pages. Option B, <source type='file'/>, is correct because it specifies a file-backed memory source (used with shared memory such as a memory-backend-file), which is valid inside <memoryBacking>.

Option E, <locked/>, is correct because it sets the VFIO/MLOCK-style locking of guest memory in RAM, preventing it from being swapped out. Options C (<swap-limit/>) and D (<balloon-rate/>) are not valid <memoryBacking> children; swap limits and ballooning rates are configured through other mechanisms (e.g., memtune or the <memballoon> device), so they do not belong here.

Exam trap

The trap is that candidates pick plausible-sounding tuning knobs like swap-limit or balloon-rate because they sound like memory controls, when memoryBacking only accepts hugepages, source, locked, and access/discard/allocation sub-elements.

80
Multi-Selecthard

Which THREE storage drivers are supported by Docker?

Select 3 answers
A.devicemapper
B.xfs
C.aufs
D.ext4
E.overlay2
AnswersA, C, E

devicemapper is a Docker storage driver using thin provisioning on block devices via the kernel's device-mapper framework, controlling layers through snapshots. It satisfies the stem by being one of the drivers Docker documents and supports for managing image and container layers.

Why this answer

Docker supports the devicemapper storage driver (A), which uses the Device Mapper kernel framework and thin provisioning to manage image and container layers on block devices. It also supports aufs (C), the original copy-on-write union filesystem driver used on older Ubuntu/Debian kernels. The overlay2 driver (E) is the modern, preferred Docker storage driver, using the OverlayFS union filesystem with multiple lower layers for better performance and inode efficiency.

Options B (xfs) and D (ext4) are not storage drivers but rather filesystem types; they can serve as the backing filesystem for drivers like overlay2 or devicemapper, but Docker does not use them as storage drivers themselves.

Exam trap

305-300 often tests the confusion between filesystems (ext4, XFS, btrfs) and Docker storage drivers (overlay2, devicemapper, aufs) — candidates must recognize that filesystems are the substrate, not the driver.

81
MCQeasy

What is the main advantage of using a container over a virtual machine?

A.Ability to run different kernels
B.Stronger security isolation
C.No network configuration
D.Lighter weight and faster startup
AnswerD

Containers share the host kernel and isolate processes via namespaces and cgroups, avoiding the full guest operating system a virtual machine must boot. This architectural difference yields smaller images and startup in seconds rather than the minutes a hypervisor-based VM typically needs.

Why this answer

Containers share the host OS kernel and only package the application and its dependencies, so they avoid the overhead of booting a full guest OS. This makes them significantly lighter in resource usage and faster to start (often milliseconds to seconds) compared to virtual machines, which must boot an entire OS per instance.

Exam trap

The trap is assuming containers provide stronger security isolation than VMs — candidates conflate 'lightweight' with 'more secure', when in fact the shared kernel makes containers less isolated, and the correct advantage is weight and startup speed.

How to eliminate wrong answers

Option A is wrong because containers share the host kernel and cannot run a different kernel — that is a capability of virtual machines with their own guest kernels. Option B is wrong because VMs provide stronger isolation via hardware virtualization and separate kernels, while containers share the kernel and have a weaker isolation boundary. Option C is wrong because containers absolutely require network configuration (bridge, overlay, macvlan, host modes) — they do not eliminate networking.

82
MCQmedium

You need to inspect the metadata of a specific Docker image without pulling it from a remote registry. Which command should you use?

A.docker pull --metadata
B.docker image history
C.docker manifest inspect
D.docker image inspect
AnswerC

docker manifest inspect queries the registry API directly, returning the image's manifest, layers, platform variants and digests without downloading layer blobs to the local daemon. That satisfies the stem's constraint of inspecting metadata without pulling the image.

Why this answer

'docker manifest inspect' queries the registry's manifest API directly and returns metadata such as platform variants, digests, and layer information without downloading the image layers. It is the correct tool for inspecting a remote image's metadata without pulling it.

Exam trap

305-300 often tests the confusion between local image inspection commands ('docker image inspect', 'docker image history') and remote registry inspection ('docker manifest inspect'), catching candidates who forget that local commands require a prior pull.

How to eliminate wrong answers

Option A is wrong because 'docker pull --metadata' is not a valid Docker CLI flag — 'docker pull' downloads the image and has no metadata-only mode. Option B is wrong because 'docker image history' shows the layer history of an image already present in the local daemon, requiring a prior pull. Option D is wrong because 'docker image inspect' inspects a local image in the daemon, not a remote registry image, so it also requires the image to be pulled first.

83
MCQmedium

You are debugging a Docker image buildup that fails at the 'RUN' instruction due to missing network access during the build. What command option should be checked if the build environment uses a proxy?

A.--proxy
B.--build-arg
C.--privileged
D.--network=host
E.--env-file
AnswerB

Docker passes proxy settings into the build through --build-arg, which injects values such as HTTP_PROXY as environment variables available to RUN instructions. Without it, the build container cannot reach external repositories, so the RUN step fails despite valid host network access.

Why this answer

Docker's build-time proxy configuration is passed via --build-arg with the predefined HTTP_PROXY, HTTPS_PROXY, and NO_PROXY arguments, which Docker automatically recognizes and injects into the build environment. The --proxy flag does not exist in docker build, so --build-arg is the correct mechanism for supplying proxy settings when RUN instructions need network access.

Exam trap

The trap is assuming Docker has a dedicated --proxy flag analogous to other tools — candidates who have not memorized Docker's build-arg conventions pick it, but Docker deliberately reuses build arguments for proxy configuration.

How to eliminate wrong answers

Option A is wrong because --proxy is not a valid docker build option — Docker uses build arguments for proxy injection, not a dedicated proxy flag. Option C is wrong because --privileged grants the container elevated kernel capabilities and is unrelated to proxy or network configuration. Option D is wrong because --network=host changes the container's network namespace to share the host's, which does not supply proxy environment variables and is not the standard fix for proxy-restricted builds.

Option E is wrong because --env-file sets runtime environment variables for docker run, not build-time variables for docker build.

84
MCQhard

You are troubleshooting a libvirt migration that fails with 'Operation not supported: Migration requires a storage pool'. You need to perform a block migration where the storage is copied to the destination host. Which command-line flag enables this functionality?

A.--copy-storage-all
B.--live-disk
C.--migrate-storage
D.--block-migrate
AnswerA

--copy-storage-all copies every guest disk to the destination as part of the migration, removing the shared-storage requirement that triggered the error. This enables true block migration when the destination has no access to the source's storage pool.

Why this answer

The --copy-storage-all flag tells libvirt to copy all disk images from the source host to the destination during migration, enabling block migration when shared storage is not available. This directly addresses the 'Migration requires a storage pool' error by supplying the missing storage transfer behavior.

Exam trap

The trap is inventing plausible-sounding flags like --block-migrate or --migrate-storage — candidates must recall the actual libvirt flags --copy-storage-all and --copy-storage-inc.

How to eliminate wrong answers

Option B is wrong because --live-disk is not a valid virsh migrate flag — it is a fabricated option that does not exist in libvirt's CLI. Option C is wrong because --migrate-storage is not a recognized flag; the actual storage-related flags are --copy-storage-all, --copy-storage-inc, and --migrate-disks. Option D is wrong because --block-migrate is not a libvirt flag — block migration is achieved via --copy-storage-all (full copy) or --copy-storage-inc (incremental copy).

85
MCQmedium

You are using BSD Jails and need to start a jail. Which utility is the standard management tool for jail administration?

A.jexec
B.jail
C.jails-admin
D.jail-manage
E.jls
AnswerB

The jail utility is FreeBSD's standard administrative command for creating, starting, stopping and listing jails. Running 'jail' with a configuration or parameters starts the jail and executes its command, directly fulfilling the requirement to start a jail.

Why this answer

The jail utility is the standard FreeBSD command for creating, starting, and managing jails. Running jail with parameters such as path, hostname, and command starts a new jail. It is the foundational management tool, complemented by jexec for entering a running jail and jls for listing jails.

Exam trap

The trap is confusing jexec (enter a jail) and jls (list jails) with the jail command itself, or selecting fabricated utilities like jails-admin or jail-manage.

How to eliminate wrong answers

Option A (jexec) is wrong because it is used to execute a command inside an already-running jail, not to start one. Option C (jails-admin) is wrong because no such standard utility exists in FreeBSD. Option D (jail-manage) is wrong because it is not a real FreeBSD command.

Option E (jls) is wrong because it lists active jails and their parameters, but does not start them.

86
MCQmedium

Which QEMU-KVM feature allows you to save the state of a VM to a file and resume it later?

A.virsh save
B.virsh snapshot
C.virsh checkpoint
D.virsh suspend
AnswerA

virsh save writes the VM's complete memory and device state to a file and stops it, allowing later restoration via virsh restore. This matches the stem's requirement to save state to a file and resume it later.

Why this answer

The 'virsh save' command writes the complete state of a running domain (VM) — including CPU registers, memory contents, and device state — to a file, allowing it to be restored later with 'virsh restore'. This is a full VM state save, not just a disk snapshot. It is the libvirt equivalent of hibernation for a virtual machine.

Exam trap

The trap is conflating 'virsh save' with 'virsh snapshot' or 'virsh suspend' — all three touch VM state, but only 'save' writes state to a file that survives host reboot and can be restored later.

How to eliminate wrong answers

Option B is wrong because 'virsh snapshot' creates a point-in-time snapshot of a domain's disk and/or memory but is managed as a snapshot object with its own lifecycle (snapshot-create, snapshot-list, snapshot-revert) — it is not the save-to-file-and-resume mechanism the question describes. Option C is wrong because 'virsh checkpoint' is not a standard virsh command for saving VM state; checkpoints in libvirt relate to incremental backup metadata, not state save/restore. Option D is wrong because 'virsh suspend' merely pauses a running VM in memory without writing its state to a file — the VM stays resident and cannot survive a host reboot.

87
MCQeasy

A junior administrator needs to start the libvirt-managed guest 'db01' and confirm that it is running. Which pair of commands accomplishes this?

A.virsh define db01 and virsh dominfo db01
B.virsh start db01 and virsh list --all
C.virsh create db01 and virsh list
D.virsh start db01 and virsh list
AnswerD

virsh start boots a defined, persistent domain, and virsh list displays only domains that are currently running. Together they start db01 and confirm its running state in one step. This is the standard operational workflow for libvirt-managed guests and matches the administrator's goal exactly.

Why this answer

Starting a persistent libvirt domain is done with virsh start, and the running state is confirmed with virsh list, which shows only active domains. The alternatives either use commands that expect XML files, list inactive domains as well, or never actually boot the guest, so they do not fulfill both parts of the task.

Exam trap

The trap here is reaching for virsh create, which takes an XML file and makes a transient domain, instead of virsh start, which boots a defined persistent guest.

88
MCQmedium

You need to attach a new block device to a running VM. What virsh command achieves this?

A.virsh attach-device-file vm_name /path/to/img
B.virsh add-device vm_name /path/to/img
C.virsh hotplug-disk vm_name /path/to/img
D.virsh attach-disk vm_name /path/to/img vda
AnswerD

virsh attach-disk adds a block device to a running domain, hot-plugging the image at the specified target such as vda. This satisfies the requirement to attach a new disk without shutting down the VM, provided the guest supports hot-plug.

Why this answer

The virsh attach-disk command is the standard way to hot-plug a new block device to a running domain. Its syntax is 'virsh attach-disk <domain> <source> <target>' where source is the host image path and target is the guest device name (e.g., vda, vdb). This command modifies the domain's live XML and, with --persistent, also updates the saved configuration.

Exam trap

The trap is that candidates may invent plausible-sounding virsh subcommands like 'hotplug-disk' or 'add-device' instead of recalling the actual 'attach-disk' syntax with source and target arguments.

How to eliminate wrong answers

Option A is wrong because 'attach-device-file' is not a virsh subcommand; attach-device exists but takes an XML file, not a raw image path. Option B is wrong because 'add-device' is not a valid virsh command. Option C is wrong because 'hotplug-disk' is not a virsh command; hot-plugging is achieved via attach-disk or attach-device with an XML definition.

89
MCQhard

A production KVM guest uses a virtio-blk disk and experiences periodic I/O stalls during heavy write bursts. You want to switch the guest disk to virtio-scsi with multiple queues to improve parallelism without reinstalling the guest OS. Which change should you make to the domain XML?

A.Add <driver name='qemu' type='qcow2' queues='4'/> to the existing virtio-blk disk and restart the guest.
B.Set <driver name='qemu' type='raw' cache='none' io='native'/> on the disk and increase the guest's nr_requests.
C.Add a <controller type='scsi' model='virtio-scsi'/> with queues='4' and change the disk target bus to scsi.
D.Replace the disk with <disk type='network' device='disk'> using an NBD backend exported by the host.
AnswerC

Virtio-scsi multi-queue parallelism is configured on the SCSI controller via the queues attribute, and the disk must be attached to that controller by setting its target bus to scsi. This combination enables multiple virtqueues between guest and host, improving throughput under concurrent I/O without touching the guest OS installation itself, since virtio-scsi drivers are present in modern Linux guests.

Why this answer

Virtio-scsi multi-queue is enabled by adding queues to the virtio-scsi controller element and attaching the disk to that controller through its target bus. This gives the guest multiple virtqueues for parallel I/O processing, which reduces stalls during write bursts. The other options either misuse the queues attribute, change image formats without addressing parallelism, or introduce a network block backend that does not provide the requested feature.

Exam trap

The trap here is assuming the queues attribute applies to the disk driver element, when it actually belongs to the virtio-scsi controller.

90
MCQeasy

In the context of virtualization, what does 'ballooning' refer to?

A.Scaling network bandwidth for a VM
B.Increasing the number of virtual CPUs
C.Dynamically resizing guest memory
D.Compressing disk images on the fly
AnswerC

Ballooning uses a paravirtualised driver to inflate or deflate a guest's memory allocation at runtime, reclaiming unused pages for other VMs. This satisfies the requirement to dynamically resize guest memory without rebooting, unlike static allocation at domain start.

Why this answer

Ballooning is a memory reclamation technique where a special 'balloon' driver inside the guest OS inflates by allocating guest memory pages, forcing the guest to swap or release them back to the hypervisor for use by other VMs. When the hypervisor needs memory, it tells the balloon to inflate; when memory pressure subsides, the balloon deflates and returns pages to the guest. This allows dynamic resizing of guest memory without rebooting the VM.

Exam trap

The trap here is confusing memory ballooning with other dynamic resource features like CPU hot-add or disk compression — candidates who only skim 'dynamically resizing' may pick the wrong resource type.

How to eliminate wrong answers

Option A is wrong because network bandwidth scaling is handled by virtual NIC configuration and QoS/bandwidth throttling, not by memory ballooning — ballooning has nothing to do with network throughput. Option B is wrong because adding vCPUs is a CPU hot-plug or VM reconfiguration operation, unrelated to memory management. Option D is wrong because on-the-fly disk image compression is a storage feature (e.g., qcow2 compression or virt-sparsify), not a memory reclamation mechanism.

91
Multi-Selecthard

An administrator is configuring a KVM host that will run a latency-sensitive guest. The goal is to reduce scheduling jitter and improve cache locality for that guest's vCPUs. Which TWO measures are appropriate? (Choose two.)

Select 2 answers
A.Isolate host CPUs from the general scheduler using the kernel's isolcpus or cpuset controls and assign the guest to them.
B.Increase the number of vCPUs assigned to the guest so the scheduler has more threads to choose from.
C.Set the guest's disk cache mode to 'none' in the domain XML.
D.Pin the guest's vCPU threads to specific host physical CPUs using CPU affinity.
E.Enable the virtio-balloon driver and set a memory balloon target for the guest.
AnswersA, D

Removing a set of host CPUs from the general scheduler means other host tasks will not run there, so the guest's pinned vCPUs are not preempted by unrelated work. Combined with pinning, this sharply reduces jitter and keeps the guest's working set in cache. It is a core technique for latency-sensitive virtualization on Linux.

Why this answer

Reducing jitter and improving cache locality for a latency-sensitive guest is achieved by dedicating host CPUs to it and preventing the scheduler from moving or preempting its vCPU threads. Pinning vCPU threads to specific physical CPUs and isolating those CPUs from the general scheduler via isolcpus or cpusets together provide that isolation. Disk cache settings, memory ballooning, and adding vCPUs do not address CPU scheduling jitter.

Exam trap

The trap here is treating any performance-tuning option as helpful, when only CPU affinity and CPU isolation actually reduce scheduling jitter for the guest.

92
MCQmedium

You need to convert a raw disk image to QCOW2 format to enable snapshotting. Which command is correct?

A.qemu-img convert -i raw -o qcow2 source.img target.qcow2
B.virsh image-convert source.img target.qcow2
C.qemu-img change -f raw -t qcow2 source.img
D.qemu-img convert -f raw -O qcow2 source.img target.qcow2
AnswerD

qemu-img convert with -f raw and -O qcow2 reads the source as a raw image and writes QCOW2 output, satisfying the snapshotting requirement. The explicit input and output format flags prevent misdetection, unlike qemu-img create or resize.

Why this answer

The correct syntax is 'qemu-img convert -f raw -O qcow2 source.img target.qcow2'. The -f flag specifies the source format and -O (capital O) specifies the destination format. This is the canonical way to convert a raw image into QCOW2 so that snapshots, compression, and backing files become available.

Exam trap

The trap here is confusing qemu-img's -f/-O (format flags) with generic -i/-o input/output flags that candidates assume exist from other CLI tools.

How to eliminate wrong answers

Option A is wrong because qemu-img uses -f/-O, not -i/-o; -i and -o are not valid convert flags (lowercase -o is used for options in some subcommands, but not as a format specifier here). Option B is wrong because 'virsh image-convert' does not exist — virsh manages domains, networks, and pools, not image format conversion. Option C is wrong because 'qemu-img change' is not a valid subcommand; the correct subcommand is 'convert', and -t is not a format flag.

93
Multi-Selectmedium

Which TWO of the following commands can be used to manage virtual networks in libvirt?

Select 2 answers
A.virsh net-define
B.virsh net-config
C.virsh net-start-all
D.virsh net-status
E.virsh net-list
AnswersA, E

`virsh net-define` imports a persistent network definition from an XML file, registering it with libvirt without starting it. This satisfies the requirement to manage virtual networks, since defining, editing and removing networks are core management operations, and the command operates on the network object itself rather than on individual domains.

Why this answer

Option A, virsh net-define, is correct because it defines a persistent virtual network in libvirt from an XML configuration file, creating the network object that can later be started and made autostart. Option E, virsh net-list, is correct because it lists the virtual networks known to libvirt and can show their state (active/inactive) and autostart flag, making it a core management command. Option B, virsh net-config, does not exist as a libvirt subcommand; network XML is edited via virsh net-edit or net-define.

Option C, virsh net-start-all, is not a valid virsh command; individual networks are started with virsh net-start, and autostart is set with virsh net-autostart. Option D, virsh net-status, is not a real libvirt subcommand; network state is obtained through virsh net-list or virsh net-info.

Exam trap

The trap here is that candidates assume virsh follows a uniform verb pattern (net-config, net-status) mirroring other tools, when libvirt actually uses net-define, net-edit, net-info, and net-list — so plausible-sounding but nonexistent subcommands look correct.

94
Multi-Selecthard

Which THREE items are typically included in an OpenVZ configuration file?

Select 3 answers
A.BIOS settings
B.User Beancounters (resource limits)
C.OS template reference
D.Networking parameters
E.Kernel source code
AnswersB, C, D

User Beancounters are per-container resource limits enforced by the OpenVZ kernel, controlling CPU, memory and disk quotas. They appear in the container's configuration file alongside other parameters, satisfying the requirement for a typical OpenVZ configuration item.

Why this answer

In an OpenVZ container configuration file (typically /etc/vz/conf/<CTID>.conf), User Beancounters (option B) are included as resource limits such as kmemsize, privvmpages, and numproc, which control how much memory, processes, and other resources the container may consume. The OS template reference (option C) is also included, usually via the OSTEMPLATE parameter, which records which OS template (e.g., centos-7-x86_64) was used to create the container and is needed for operations like reinstalling or rebuilding it. Networking parameters (option D) are included as well, with entries such as IP_ADDRESS, HOSTNAME, and NETIF to define the container's IP addressing and virtual network interface.

BIOS settings (option A) are not part of an OpenVZ configuration file because OpenVZ containers are OS-level virtualizations that share the host kernel and do not have their own BIOS or firmware. Kernel source code (option E) is likewise not included, since containers use the host's kernel and the configuration file only stores container-specific runtime and resource parameters, not kernel source.

Exam trap

The trap is including host-level or kernel-level items (BIOS, kernel source) as container configuration components — candidates must remember that OpenVZ containers are isolated userspace environments sharing the host kernel.

95
MCQhard

You are troubleshooting a Docker container that fails to start with the error 'no space left on device' even though `df -h` shows ample free space on the host's root filesystem. The Docker data root is on a separate partition. Which command should you use to check the actual disk usage of Docker's data root?

A.`docker system df -v`
B.`docker events`
C.`docker stats`
D.`docker info`
AnswerA

`docker system df -v` shows detailed disk usage of images, containers, volumes, and build cache, including which items consume space. Since the Docker data root is on a separate partition, `df -h` on the host root may not reflect it. This command reveals the actual consumption within Docker's storage area, helping identify the cause of the 'no space left' error.

Why this answer

`docker system df -v` reports detailed disk usage for images, containers, volumes, and build cache. When the Docker data root resides on a separate partition, the host's `df` may show free space elsewhere. This command exposes the actual consumption within Docker's storage, allowing you to identify whether images, volumes, or cache are filling the partition.

Exam trap

The trap here is relying on host-level `df` output and overlooking that Docker's data root may be on a different filesystem with its own capacity limits.

96
MCQeasy

Which command is used to list all defined virtual networks in Libvirt?

A.brctl show
B.virsh net-list --all
C.virsh domiflist
D.virsh list-networks
AnswerB

`virsh net-list --all` queries the libvirt daemon and returns every network defined in the hypervisor, including inactive ones. The `--all` flag satisfies the stem's requirement to list *all* defined virtual networks, whereas the bare `virsh net-list` shows only currently active networks.

Why this answer

The `virsh net-list --all` command queries libvirt's virtual network driver and displays every network defined in the hypervisor, including those that are currently inactive. The `--all` flag is essential because without it, virsh only shows networks that are actively running. This is the canonical libvirt-native way to enumerate virtual networks, as opposed to inspecting the underlying Linux bridge layer.

Exam trap

The trap here is confusing libvirt's network abstraction with the underlying Linux bridge layer — candidates who know `brctl show` from general Linux networking pick it, forgetting that libvirt networks and kernel bridges are not 1:1 and that inactive networks won't appear in bridge listings.

How to eliminate wrong answers

Option A is wrong because `brctl show` lists Linux bridge interfaces at the kernel level, not libvirt virtual networks — a libvirt network may exist without a corresponding bridge (e.g., when inactive), and bridges can exist outside libvirt's management. Option C is wrong because `virsh domiflist` lists the network interfaces attached to a specific domain (guest VM), not the defined virtual networks themselves. Option D is wrong because `virsh list-networks` is not a valid virsh subcommand; the correct syntax is `virsh net-list`.

97
MCQhard

You need to enable hugepages for a VM in libvirt to improve memory performance. What XML entry do you add?

A.<system-memory hugepages='true'/>
B.<memoryBacking><hugepages/></memoryBacking>
C.<memory mode='hugepages'/>
D.<hugepages enabled='yes'/>
AnswerB

Placing `<hugepages/>` inside `<memoryBacking>` instructs libvirt to back the guest's memory with huge pages rather than standard 4 KiB pages, satisfying the stem's requirement to enable hugepages for the VM. The element must sit within `<memoryBacking>` in the domain XML; standalone placement is invalid.

Why this answer

To enable hugepages for a libvirt VM, you add a memoryBacking element containing a hugepages child element inside the domain's XML. This tells libvirt/QEMU to back the guest's memory with host hugepages rather than standard 4KB pages. The other XML snippets are not valid libvirt schema.

Exam trap

305-300 often tests the exact XML structure for libvirt features — the trap is inventing plausible-looking but invalid elements instead of the correct memoryBacking/hugepages nesting.

How to eliminate wrong answers

Option A is wrong because <system-memory hugepages='true'/> is not a valid libvirt domain XML element — there is no system-memory element in the domain schema. Option C is wrong because <memory mode='hugepages'/> is not valid; the memory element uses unit and model attributes, not a hugepages mode. Option D is wrong because <hugepages enabled='yes'/> is not a recognized element; hugepages configuration must be nested under memoryBacking.

98
MCQeasy

What is the default behavior of Vagrant when a box is not found locally on the host machine?

A.It prompts for a path
B.It downloads it from the Vagrant Cloud
C.It creates an empty machine
D.It fails immediately
AnswerB

Vagrant resolves a missing box by fetching it from the Vagrant Cloud registry, downloading and installing it locally before provisioning. This default behaviour means no manual box installation is needed, satisfying the scenario where the box is absent from the host.

Why this answer

When Vagrant is asked to bring up a machine and the specified box is not present locally, it automatically attempts to download the box from the configured box repository, which by default is Vagrant Cloud (formerly Atlas). This behavior is controlled by the box_url or the shorthand box name in the Vagrantfile, and Vagrant will fetch the box metadata and then the box file itself. No user prompt is required unless the box is not found in the repository or there is an ambiguity.

Exam trap

305-300 often tests the assumption that Vagrant requires manual intervention when a box is missing, but the default is automatic download from Vagrant Cloud.

How to eliminate wrong answers

Option A is wrong because Vagrant does not prompt for a path; it automatically resolves the box from the configured source. Option C is wrong because Vagrant does not create an empty machine; it requires a base box to clone from. Option D is wrong because Vagrant does not fail immediately; it first attempts to download the box from the default repository.

99
MCQmedium

Which tool is commonly used alongside Packer to validate the configuration file for syntax errors before attempting a build?

A.packer fmt
B.packer lint
C.packer validate
D.packer check
AnswerC

packer validate parses the template and reports syntax, schema, and configuration errors without starting a build, letting you catch mistakes cheaply. It satisfies the pre-build validation requirement, unlike packer build, which would attempt the full image creation.

Why this answer

`packer validate` is the built-in Packer subcommand that parses a template (HCL2 or JSON) and verifies its syntax, required fields, and referenced variables/builders before any build is attempted. It catches schema errors, missing required attributes, and invalid references without provisioning any infrastructure. This makes it the standard pre-build sanity check in CI pipelines alongside `packer fmt`.

Exam trap

The trap here is confusing `fmt` (formatting) with `validate` (semantic checking) and being lured by plausible-sounding but non-existent subcommands like `lint` or `check`.

How to eliminate wrong answers

Option A is wrong because `packer fmt` only rewrites the template to canonical HCL formatting (indentation, alignment) — it does not validate semantics or catch configuration errors. Option B is wrong because `packer lint` is not a native Packer subcommand; linting is typically done via third-party tools or `packer validate`. Option D is wrong because `packer check` does not exist as a Packer CLI command — it is a fabricated option designed to look plausible next to `validate`.

100
MCQhard

An administrator needs to run a container that requires access to a specific block device on the host, such as /dev/sdb, for direct I/O operations. Which Docker run option should be used to grant the container access to this device?

A.--privileged
B.--device /dev/sdb
C.-v /dev/sdb:/dev/sdb
D.--cap-add SYS_RAWIO
AnswerB

The --device flag allows passing a host device into the container, making it accessible as /dev/sdb inside the container. This grants direct access to the block device, enabling I/O operations. It is the correct way to expose specific devices without using privileged mode. Other options do not provide device access.

Why this answer

The --device option is designed to expose a specific host device to a container while properly configuring device cgroup permissions. It allows the container to perform I/O on that device. Other options like --privileged grant broad access, volume mounts do not set permissions, and capabilities alone do not bypass device cgroup restrictions.

Exam trap

The trap here is thinking that mounting a device node as a volume or adding a capability is sufficient for device access, ignoring the need for device cgroup configuration.

101
MCQeasy

You are managing a KVM host and need to create a new storage pool that uses a directory on the host filesystem to store disk images. After creating the directory /var/lib/libvirt/images/extra, you want to define and start a libvirt storage pool named 'extra-pool' that uses this directory. Which sequence of virsh commands accomplishes this?

A.virsh pool-define-as extra-pool dir --target /var/lib/libvirt/images/extra; virsh pool-start extra-pool
B.virsh pool-create-as extra-pool dir --target /var/lib/libvirt/images/extra
C.virsh vol-create-as extra-pool /var/lib/libvirt/images/extra 10G
D.virsh pool-define-as extra-pool logical --target /var/lib/libvirt/images/extra
AnswerA

This sequence defines a directory-type storage pool with the given target path and then starts it, making it active. The pool-define-as command creates a persistent definition, and pool-start activates it. This is the correct way to create and enable a directory-based pool without using an XML file.

Why this answer

The correct approach is to define a persistent directory-based pool using pool-define-as with type dir and the target path, then start it with pool-start. This creates a reusable pool definition and activates it immediately. Using pool-create-as would only create a transient pool, and the other commands either target volumes or use the wrong pool type.

Exam trap

The trap here is confusing pool-define-as with pool-create-as; the former creates a persistent definition, while the latter creates a transient pool that disappears after a restart.

102
MCQhard

In cloud-init, which syntax is required at the very beginning of the configuration file to ensure it is recognized as a cloud-config script?

A.#cloud-config
B.#!/bin/bash
C.#cloud-init
D.---
AnswerA

The #cloud-config shebang on the first line signals cloud-init to parse the file as YAML configuration rather than a shell script or other user-data format. Without it, cloud-init treats the payload as an unrecognised script and skips the declared modules.

Why this answer

Cloud-init identifies a cloud-config file by the literal header #cloud-config on the very first line. Without this exact shebang-style marker, cloud-init treats the payload as a different user-data format (e.g., shell script or MIME multipart) and will not process the YAML directives.

Exam trap

The trap is assuming any comment or YAML separator works as a header — candidates must remember the exact string #cloud-config on line one, with no leading whitespace or BOM.

How to eliminate wrong answers

Option B is wrong because #!/bin/bash marks the payload as a shell script, which cloud-init executes as a script rather than parsing as YAML cloud-config. Option C is wrong because #cloud-init is not a recognized header — cloud-init looks specifically for #cloud-config (or #! for scripts, #include, etc.). Option D is wrong because --- is a YAML document separator, not a cloud-init format marker; it can appear inside a cloud-config file but does not identify the file type.

103
MCQhard

In a Docker swarm, which mode of service publishing allows incoming traffic to be load-balanced across all healthy container replicas?

A.macvlan
B.ingress
C.overlay
D.host
AnswerB

Ingress mode publishes a service on the swarm's routing mesh, so every node accepts traffic on the published port and forwards it to healthy replicas regardless of placement. This provides the load-balancing across all healthy container replicas that the scenario requires.

Why this answer

In Docker Swarm, the ingress mode publishes a service on the routing mesh, so the port is exposed on every swarm node and incoming traffic is load-balanced across all healthy replicas of the service. This is the default publishing mode and is what enables any node to accept traffic for a service regardless of where its tasks run.

Exam trap

The trap is confusing the overlay network driver (which carries container-to-container traffic) with the ingress publishing mode (which load-balances external traffic) — candidates pick overlay thinking it handles load balancing, when it only provides the network fabric.

How to eliminate wrong answers

Option A is wrong because macvlan is a network driver that gives containers their own MAC addresses on the physical network, not a swarm service publishing mode for load balancing. Option C is wrong because overlay is the network driver that enables cross-host container communication in a swarm, not the publishing mode that load-balances ingress traffic. Option D is wrong because host mode publishes the port directly on the node running the task, bypassing the routing mesh and preventing swarm-wide load balancing.

104
MCQeasy

Which command lists all Docker images currently on the host?

A.docker ps
B.docker show
C.docker images
D.docker list
AnswerC

The docker images command queries the local image cache and returns every stored image with repository, tag, image ID, creation time and size. It requires no running container and reads directly from the host's Docker daemon, satisfying the stem's request to list images on the host.

Why this answer

'docker images' queries the local image store and lists all images present on the host, showing repository, tag, image ID, creation time, and size. It is the canonical command for inspecting locally cached images before running or removing them.

Exam trap

The trap is mixing up the container-listing command ('docker ps') with the image-listing command ('docker images') — both are common, and candidates under time pressure may pick 'ps' because it is the first Docker command they memorized.

How to eliminate wrong answers

Option A is wrong because 'docker ps' lists running containers (and with -a, all containers), not images — it queries the container runtime state, not the image store. Option B is wrong because 'docker show' is not a valid Docker subcommand; there is no such verb in the Docker CLI. Option D is wrong because 'docker list' is also not a valid subcommand — the correct verbs are 'images' for images and 'ps' for containers.

105
MCQmedium

You are building a Vagrant environment for a development team. The Vagrantfile must provision three identical web servers and one load balancer, all using the same base box but with different hostnames and static IP addresses. Which Vagrantfile construct should you use to define these machines and their individual settings?

A.config.vm.provider
B.config.vm.network
C.config.vm.define
D.config.vm.provision
AnswerC

config.vm.define creates a named machine configuration block within the Vagrantfile, allowing per-machine settings such as hostname and private network IP. Each block inherits the global configuration but can override it. This is the standard way to define multiple machines in a single Vagrantfile, exactly matching the requirement for three web servers and one load balancer with distinct identities.

Why this answer

The config.vm.define method is used to declare multiple machines within a single Vagrantfile. Each definition block can set machine-specific attributes like hostname, network, and provider settings. This allows a single Vagrantfile to manage a multi-machine environment, which is exactly what is needed for three web servers and one load balancer.

Exam trap

The trap here is confusing machine definition with provisioning or networking directives, which only affect a single machine and cannot create multiple named VMs.

106
MCQhard

When cleaning up Docker resources, which command will remove all stopped containers, unused networks, and dangling images in one step?

A.docker container prune
B.docker volume prune
C.docker image prune -a
D.docker cleanup
E.docker system prune
AnswerE

docker system prune removes stopped containers, unused networks and dangling images in a single invocation, matching the requirement to clean these resources in one step. Adding -a extends it to all unused images, but the base command already covers the three specified categories.

Why this answer

docker system prune removes all stopped containers, unused networks, dangling images, and (with -a) unused images in a single command. It is the one-step cleanup command that consolidates what would otherwise require separate container prune, network prune, and image prune invocations.

Exam trap

The trap is that candidates may pick a narrower prune command (container, image, or volume) when the question explicitly asks for a single command that handles containers, networks, and images together — only docker system prune does all three.

How to eliminate wrong answers

Option A is wrong because docker container prune removes only stopped containers, leaving networks and images untouched. Option B is wrong because docker volume prune removes only unused volumes, not containers or images. Option C is wrong because docker image prune -a removes unused images only, not containers or networks.

Option D is wrong because 'docker cleanup' is not a valid Docker subcommand.

107
MCQmedium

When using Vagrant with multiple machines in a single Vagrantfile, how do you define individual configurations?

A.config.vm.box_set
B.config.vm.define :name
C.config.vm.instance
D.config.vm.multi
AnswerB

Using `config.vm.define :name` creates a named machine block within the single Vagrantfile, letting each machine carry its own settings such as box, network and provider configuration. This satisfies the stem's requirement to define individual configurations for multiple machines, since each block is scoped separately rather than sharing one global definition.

Why this answer

In a multi-machine Vagrantfile, each VM is declared with 'config.vm.define :name do |machine| ... end', which creates a named machine block where per-VM settings (box, network, provider, provisioners) are scoped. This is the canonical Vagrant DSL for multi-machine environments and allows 'vagrant up web' or 'vagrant ssh db' to target individual machines.

Exam trap

The trap is that candidates guess at plausible-sounding DSL methods ('box_set', 'multi') instead of recalling the actual Vagrant API, which uses 'define' for multi-machine scoping.

How to eliminate wrong answers

Option A is wrong because 'config.vm.box_set' is not a Vagrant DSL method — the correct method for specifying a box is 'config.vm.box'. Option C is wrong because 'config.vm.instance' does not exist in the Vagrant configuration API. Option D is wrong because 'config.vm.multi' is not a Vagrant directive; multi-machine support is achieved through repeated 'config.vm.define' blocks, not a 'multi' flag.

108
MCQeasy

What does the term 'KVM' stand for?

A.Kernel-based Virtual Machine
B.K-Hypervisor Virtual Machine
C.Kernel Virtual Module
D.Kilo-Virtual Machine
AnswerA

Kernel-based Virtual Machine is the Linux kernel module that turns the kernel itself into a type-1 hypervisor, exposing hardware virtualisation extensions (Intel VT-x or AMD-V) through /dev/kvm. This directly satisfies the stem's request for the expansion of the acronym KVM, distinguishing it from keyboard-video-mouse switching hardware.

Why this answer

KVM stands for Kernel-based Virtual Machine. It is a Linux kernel module that turns the Linux kernel into a Type-1 hypervisor by exposing hardware virtualization extensions (Intel VT-x, AMD-V) through /dev/kvm. QEMU typically runs on top of KVM to provide full machine emulation and device models.

Exam trap

The trap is a simple acronym recall test where fabricated expansions like 'Kernel Virtual Module' sound plausible to candidates who have not memorized the official name.

How to eliminate wrong answers

Option B (K-Hypervisor Virtual Machine) is wrong because there is no such term — KVM is not named after a 'K-Hypervisor'. Option C (Kernel Virtual Module) is wrong because KVM is a virtualization subsystem, not a loadable module concept by that name (though it is delivered as kvm.ko, the expansion is Kernel-based Virtual Machine). Option D (Kilo-Virtual Machine) is wrong because 'Kilo' is not part of the acronym; it is a fabricated distractor.

109
MCQmedium

Which utility is best for creating a new libvirt storage pool?

A.virsh pool-create
B.virt-pool-builder
C.virsh pool-define-as
D.virsh add-pool
AnswerC

pool-define-as creates a persistent pool definition in libvirt's configuration without starting it, letting you specify type, name and source devices. This is the correct utility for establishing a new pool before building or starting it.

Why this answer

virsh pool-define-as creates a persistent storage pool definition in libvirt's configuration without starting it, which is the correct first step for creating a new pool. After defining, you run virsh pool-build (if needed) and virsh pool-start to activate it.

Exam trap

The trap is confusing pool-create with pool-define-as — pool-create works immediately but is transient, while pool-define-as is the persistent definition step, which is what 'creating a new pool' properly requires.

How to eliminate wrong answers

Option A is wrong because virsh pool-create creates a transient (non-persistent) pool that disappears after libvirt restarts — it is not the best choice for a permanent new pool. Option B is wrong because virt-pool-builder is not a real utility; the virt-* tools include virt-install, virt-clone, virt-manager, and virt-viewer, but no pool builder. Option D is wrong because virsh add-pool is not a valid virsh subcommand — the correct verbs are pool-define, pool-define-as, pool-create, and pool-create-as.

110
MCQeasy

Which Docker command is used to display the resource usage (CPU, memory) of running containers?

A.docker stats
B.docker top
C.docker usage
D.docker info
AnswerA

docker stats streams live CPU, memory, network and block I/O metrics for each running container, refreshed continuously. This directly satisfies the requirement to display resource usage of running containers, unlike docker ps, which only lists containers without consumption figures.

Why this answer

`docker stats` is the dedicated Docker CLI subcommand that streams live resource-usage metrics for running containers, including CPU percentage, memory usage/limit, memory percentage, network I/O, block I/O, and PIDs. It reads these values from the cgroup statistics exposed by the container runtime, so it reflects actual kernel-level accounting rather than estimates. By default it shows all running containers and refreshes continuously until you press Ctrl+C.

Exam trap

The trap here is confusing `docker top` (process listing) with `docker stats` (resource metrics), since both sound like they show 'what's running' — candidates must remember that only `stats` reports CPU and memory.

How to eliminate wrong answers

Option B is wrong because `docker top` only displays the running processes inside a container (equivalent to a `ps` listing for that container's PID namespace) and reports no CPU or memory metrics. Option C is wrong because `docker usage` is not a valid Docker subcommand — Docker has no such command, so it returns an 'unknown command' error. Option D is wrong because `docker info` prints daemon-wide configuration and host information (kernel version, storage driver, number of containers/images, cgroup driver), not per-container resource consumption.

111
MCQmedium

Which cloud-init module is responsible for setting the hostname of the instance during the initial boot process?

A.system_name
B.hostname
C.network_config
D.set_hostname
AnswerB

The cloud-init hostname module reads the instance's configured hostname from metadata and applies it during initial boot, setting both the transient and persistent hostname. This directly satisfies the stem's requirement for the module responsible for hostname configuration at first boot.

Why this answer

The cloud-init 'hostname' module is responsible for setting the instance's hostname and, optionally, the fully qualified domain name (FQDN) during initial boot. It reads the 'hostname' and 'fqdn' keys from the cloud-config or metadata service and applies them via the appropriate system tool. This module runs early in the cloud-init boot stages to ensure the instance is correctly identified before other services start.

Exam trap

The trap here is that candidates may assume a module named 'set_hostname' exists because it sounds descriptive, but cloud-init's actual module is simply 'hostname' — memorizing the real module names is essential.

How to eliminate wrong answers

Option A is wrong because 'system_name' is not a cloud-init module — it is a fabricated name that does not exist in the cloud-init module list. Option C is wrong because 'network_config' (or 'networking') configures network interfaces, routes, and DNS, not the hostname. Option D is wrong because 'set_hostname' is not a real cloud-init module; the actual module is simply named 'hostname'.

112
MCQmedium

You need to create a new storage pool for KVM guests using the virsh command-line tool. The pool should use a directory on the host filesystem at /var/lib/libvirt/images/extra. Which command correctly defines and starts this pool?

A.virsh pool-define-as extra dir --target /var/lib/libvirt/images/extra && virsh pool-start extra
B.virsh pool-create-as extra dir --target /var/lib/libvirt/images/extra
C.virsh pool-define extra --type dir --path /var/lib/libvirt/images/extra && virsh pool-start extra
D.virsh pool-add extra dir /var/lib/libvirt/images/extra && virsh pool-start extra
AnswerA

The pool-define-as command creates a persistent pool definition. The first argument is the pool name, followed by the pool type (dir), and then the target path. After defining, the pool must be started with pool-start. This correctly sets up a directory-based storage pool. The pool will be automatically started on host boot if pool-autostart is set, but pool-start is needed for immediate use.

Why this answer

To create a persistent directory-based storage pool, you use virsh pool-define-as with the pool name, type 'dir', and the target path. Then you start it with virsh pool-start. This ensures the pool is defined in libvirt's configuration and is immediately available for use.

The pool-create-as command creates a transient pool that is lost on reboot, which is not suitable for a permanent addition.

Exam trap

The trap here is confusing pool-define-as (persistent) with pool-create-as (transient). Both can create a pool, but only pool-define-as makes it persistent.

113
MCQmedium

You maintain a Vagrant environment where a single Vagrantfile defines three web servers and one database server. You need each web server to use a different forwarded SSH port on the host because port 2222 is already taken by another project. Which approach correctly assigns unique host ports per machine?

A.Use config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--natpf1", "ssh,tcp,,2201,,22"] end once in the global scope.
B.Add a separate config.vm.network "forwarded_port", guest: 22, host: 2201, id: "ssh" line inside each machine's config block.
C.Set config.ssh.port = 2201 once at the top level of the Vagrantfile, outside any machine block.
D.Add config.vm.hostname = "web1" to each machine and rely on Vagrant to derive unique SSH ports automatically.
AnswerB

In Vagrant, each machine defined in a multi-machine Vagrantfile has its own config block where you can override the default SSH forwarded port. Specifying guest: 22 with a unique host port and a stable id (such as "ssh") replaces the default 2222 mapping for that machine, preventing collisions when several VMs run simultaneously on the same host.

Why this answer

Multi-machine Vagrantfiles give each machine its own configuration block, and SSH port forwarding must be defined there to avoid collisions. Using the forwarded_port directive with guest: 22, a unique host port, and a stable id ensures each web server is reachable on a distinct host port while the database server keeps its own mapping. Global settings or hostname changes do not produce unique host ports.

Exam trap

The trap here is assuming that setting an SSH port or a provider customization once at the top level of the Vagrantfile will apply uniquely to each machine, when in fact it applies uniformly and causes port conflicts.

114
Multi-Selectmedium

You are troubleshooting a KVM guest that fails to boot after you changed its XML configuration. You want to verify and correct the guest's definition without starting it. Which TWO of the following actions are appropriate? (Choose two.)

Select 2 answers
A.Use virsh undefine guestname then virsh define guest.xml to replace the configuration.
B.Use virsh define /path/to/guest.xml to update the persistent domain definition from an edited XML file.
C.Use virsh edit guestname to modify the domain XML in place, which validates the XML before saving.
D.Use virsh dumpxml guestname > guest.xml, edit the file, then run virsh create guest.xml to apply changes persistently.
E.Use virsh start guestname --validate to check the XML and start the guest if valid.
AnswersB, C

virsh define loads a new persistent configuration for the domain from the specified XML file. This is the correct way to apply changes to a guest's definition without starting it. It replaces the existing persistent definition, so you can correct errors and then start the guest when ready.

Why this answer

To correct a guest's persistent XML without starting it, you can either edit the XML directly with virsh edit, which validates before saving, or prepare an edited XML file and apply it with virsh define. Both update the persistent definition. Using virsh create would only start a transient guest, and undefining is destructive and unnecessary.

Exam trap

The trap here is assuming that virsh create updates the persistent configuration; it actually starts a transient domain, leaving the original definition unchanged.

115
MCQhard

A Packer template targets the qemu builder to produce a KVM-compatible image. The build completes without error, but when the resulting qcow2 file is booted with `qemu-system-x86_64 -drive file=image.qcow2,if=virtio`, the guest kernel panics with "VFS: Unable to mount root fs" because it cannot see any block device. The template defines only `iso_url`, `iso_checksum`, `ssh_username`, and `ssh_password`. Which change to the template is MOST likely to resolve this?

A.Add a `boot_command` that boots the installer with `inst.modprobe=virtio_blk` (or install a kernel/initramfs that includes the virtio_blk module) so the guest can see the virtio disk.
B.Add `disk_interface = "virtio"` to the builder's configuration so the disk controller matches the boot command line.
C.Add `qemuargs = [["-device", "virtio-blk-pci"]]` to force an explicit virtio controller during the build.
D.Set `format` to `raw` so the disk is written as a plain image instead of qcow2.
AnswerA

The kernel panic occurs because the guest initramfs has no virtio_blk driver, so the root filesystem on the virtio disk is invisible. Injecting the module via the installer boot command, or ensuring the installed initramfs includes it, lets the kernel enumerate the disk and mount root. This is the standard fix when a KVM image built by Packer fails to boot under `-drive if=virtio`.

Why this answer

The failure is a guest-side driver problem, not a builder configuration problem. Packer's qemu builder already presents the disk as virtio-blk, and the host-side QEMU command line uses `if=virtio`, so the guest must have the virtio_blk module available in its initramfs to mount the root filesystem. Adding the module through the installer boot command, or rebuilding the initramfs to include it, restores visibility of the disk and resolves the panic.

Exam trap

The trap here is assuming the qcow2 format or a missing QEMU device argument is hiding the disk, when the actual cause is a missing virtio_blk module inside the guest initramfs.

116
Multi-Selecthard

Which THREE configuration items can be managed by LXC cgroups?

Select 3 answers
A.CPU shares
B.User permissions
C.Device access
D.Memory limits
E.DNS settings
AnswersA, C, D

CPU shares are a cgroup CPU-scheduling control, letting LXC allocate relative processor time between containers. This satisfies the stem's requirement for a manageable cgroup item, since shares directly tune CPU distribution rather than merely reporting usage or configuring storage and networking.

Why this answer

LXC uses Linux control groups (cgroups) to isolate and limit container resource consumption, and CPU shares (A) are managed via the cpu cgroup subsystem (e.g., cpu.shares) to control relative CPU scheduling weight. Device access (C) is enforced through the devices cgroup subsystem, which uses an allow/deny list (devices.allow/devices.deny) to control which block and character devices a container may access. Memory limits (D) are handled by the memory cgroup subsystem (e.g., memory.limit_in_bytes) to cap RAM usage and trigger OOM behavior.

User permissions (B) are not a cgroup function; they are governed by Linux user/group IDs, UID/GID mapping in the LXC config, and file permissions. DNS settings (E) are configured through files such as /etc/resolv.conf or LXC network configuration, not through cgroups.

Exam trap

305-300 often tests whether candidates conflate cgroup-managed resources (CPU, memory, devices, blkio, pids) with adjacent container settings like user namespaces and DNS, which are configured through entirely different LXC mechanisms.

117
MCQhard

You are building a Docker image and want to ensure that a build-time variable is available only during the build, not persisted in the final image's environment. Which instruction should you use?

A.ENV
B.LABEL
C.EXPOSE
D.ARG
AnswerD

`ARG` defines a build-time variable that can be passed with `--build-arg` and is available only during the build stage. It is not persisted in the image's environment or history in a way that exposes the value to running containers. This matches the requirement of a variable that is used during build but not retained in the final image.

Why this answer

`ARG` is designed for values that are needed only while building the image. It can be supplied with `--build-arg` and is not stored in the final image's environment. `ENV` would persist the value, while `LABEL` and `EXPOSE` serve unrelated metadata and port documentation purposes. Only the build-argument instruction meets the requirement of a transient build-time variable.

Exam trap

The trap here is confusing build-time arguments with runtime environment variables, assuming that any variable set in a Dockerfile is automatically removed after the build.

118
MCQmedium

What is the default location for libvirt domain configuration XML files?

A./etc/libvirt/qemu/
B./var/lib/libvirt/domains/
C./etc/libvirt/networks/
D./usr/share/libvirt/
AnswerA

Libvirt stores persistent domain definitions as individual XML files under /etc/libvirt/qemu/, named after each guest. This satisfies the question's requirement for the default configuration location, since transient domains exist only in memory and the runtime state directory /var/run/libvirt/qemu/ holds no persistent XML.

Why this answer

The default location for libvirt domain configuration XML files is /etc/libvirt/qemu/. This directory holds the persistent XML definitions for QEMU/KVM domains, which are used by libvirt to manage and start virtual machines. When a domain is defined with virsh define, its XML is stored here.

Exam trap

305-300 often tests the distinction between configuration files (/etc) and runtime data (/var), so candidates may incorrectly choose /var/lib/libvirt/domains/ assuming all VM-related data resides under /var.

How to eliminate wrong answers

Option B is wrong because /var/lib/libvirt/domains/ is not a standard libvirt directory; libvirt stores runtime state and disk images under /var/lib/libvirt, but domain XMLs are not kept there. Option C is wrong because /etc/libvirt/networks/ is for network configuration XML files, not domain definitions. Option D is wrong because /usr/share/libvirt/ contains read-only data like documentation and schema files, not mutable domain configuration.

119
Multi-Selecthard

Which TWO components are defined in a Packer 'build' block?

Select 2 answers
A.builders
B.plugins
C.sources
D.variables
E.provisioners
AnswersC, E

Defines the builder(s) to use.

Why this answer

In a Packer HCL2 template, the build block is where you declare the sources (option C) that Packer will use to create the image, referencing source blocks defined elsewhere in the template, and the provisioners (option E) that run during the build to customize the machine before the image is captured. Both sources and provisioners are valid arguments inside a build block, e.g. build { sources = ["source.amazon-ebs.example"] provisioners = [ ... ] }. Option A (builders) is not correct because in HCL2 templates the builder is defined inside a source block, not directly as a build block argument.

Option B (plugins) is not a build block argument; plugins are installed via packer init and referenced through their source types. Option D (variables) is not defined inside the build block; variables are declared in variable blocks and referenced with var.<name>.

Exam trap

305-300 often tests the distinction between legacy JSON template components and HCL2 block structures, causing candidates to confuse 'builders' with 'sources' or overlook that 'provisioners' are nested within build blocks.

120
Multi-Selecthard

You are optimizing a Dockerfile to reduce image size. Which THREE of the following practices are recommended?

Select 3 answers
A.Use the FROM latest tag for all base images
B.Always install recommended packages for security
C.Remove /var/lib/apt/lists/* after installing packages
D.Use multi-stage builds to discard build-time dependencies
E.Use a single RUN command to chain multiple commands with &&
AnswersC, D, E

APT leaves package index caches under /var/lib/apt/lists/* after installation; deleting them in the same layer prevents that metadata persisting into the final image. This directly satisfies the image-size reduction constraint, since those cached lists are otherwise retained in the layer.

Why this answer

Option C is correct because after running apt-get install, the package lists stored in /var/lib/apt/lists/* are no longer needed at runtime, and deleting them in the same RUN layer prevents them from being baked into the image and bloating its size. Option D is correct because multi-stage builds let you compile or build in an intermediate stage and copy only the resulting artifacts into a minimal final stage, so compilers, SDKs, and other build-time dependencies never end up in the shipped image. Option E is correct because chaining commands with && in a single RUN creates one layer; if you split them across multiple RUN instructions, intermediate files created and later deleted still persist in earlier layers and inflate the image.

Option A is not recommended because the latest tag is mutable and non-deterministic, leading to unpredictable builds and larger or incompatible base images rather than a size optimization. Option B is not recommended because installing recommended packages pulls in extra dependencies you may not need, increasing image size and attack surface; --no-install-recommends is the preferred approach.

Exam trap

305-300 often tests the misconception that deleting files in a later Dockerfile instruction reduces image size — candidates forget that each RUN creates a separate layer, so cleanup must happen in the same layer as the install.

121
MCQeasy

A developer wants to run a short-lived container that executes a command and then removes itself automatically after exit. Which `docker run` flag should be used?

A.`--rm`
B.`--detach`
C.`--interactive`
D.`--tty`
AnswerA

The `--rm` flag tells Docker to automatically remove the container's filesystem when it exits. This is ideal for short-lived tasks where the container does not need to persist. It prevents accumulation of stopped containers and matches the requirement of self-removal after the command completes.

Why this answer

`--rm` is specifically designed to remove the container automatically when it exits. It is commonly used for one-off commands and CI jobs. The other flags control background execution, STDIN, or TTY allocation, none of which affect post-exit cleanup.

Only `--rm` ensures the container does not linger after its task finishes.

Exam trap

The trap here is mixing up flags that control terminal attachment with flags that control container lifecycle, assuming that any run flag might cause cleanup.

122
MCQeasy

Which file system structure is typically used for QEMU virtual disk images when using LVM?

A./mnt/storage/disk.qcow2
B./dev/vg_name/lv_name
C./dev/sda1
D./var/lib/libvirt/images/disk.img
AnswerB

LVM presents logical volumes as block devices under /dev/vg_name/lv_name, which QEMU can attach directly as a virtual disk backing file. This satisfies the stem's LVM constraint, since the path resolves through the volume group to the logical volume rather than exposing a raw partition or plain image file.

Why this answer

When QEMU/KVM virtual disks are backed by LVM, the logical volume is exposed as a block device at /dev/<volume_group>/<logical_volume>, and that path is what QEMU uses as the disk source. LVM presents storage as block devices, not as file paths inside a filesystem.

Exam trap

305-300 often tests the distinction between file-based disk images (qcow2/img paths) and block-device-backed storage, so candidates pick a filesystem path like /var/lib/libvirt/images/disk.img instead of the LVM device path.

How to eliminate wrong answers

Option A is wrong because /mnt/storage/disk.qcow2 is a file path for a qcow2 image stored on a mounted filesystem, not an LVM logical volume. Option C is wrong because /dev/sda1 is a physical partition device, not an LVM logical volume, and using it directly bypasses LVM management. Option D is wrong because /var/lib/libvirt/images/disk.img is the default libvirt storage pool path for a raw image file, not an LVM-backed block device.

123
MCQhard

You are troubleshooting a performance issue and want to pin a VM process to specific physical CPU cores. Which XML element is used?

A.<pinning vcpu='0' cores='0'/>
B.<cpu-pinning vcpu='0' cpu='0'/>
C.<cputune><vcpupin vcpu='0' cpuset='0-1'/></cputune>
D.<affinity vcpu='0' host-cpu='0'/>
AnswerC

The cputune element with vcpupin binds a virtual CPU to a host cpuset, satisfying the pinning requirement. Placing it under cputune rather than cpu or numa distinguishes per-vCPU affinity from topology definitions or memory placement.

Why this answer

The <cputune> element in libvirt domain XML is the dedicated container for CPU tuning parameters, and <vcpupin> is the child element that binds a guest vCPU to a specific host CPU set. The vcpu attribute identifies the guest virtual CPU, while cpuset specifies the host physical CPUs (as a range or list) it may run on. This is the canonical, documented way to pin VM processes to physical cores in KVM/QEMU environments managed by libvirt.

Exam trap

The trap here is that candidates recall the concept of CPU pinning but invent plausible-sounding XML tags like <pinning> or <cpu-pinning> instead of remembering the actual libvirt schema element <cputune>/<vcpupin>.

How to eliminate wrong answers

Option A is wrong because <pinning> is not a valid libvirt XML element — no such tag exists in the domain schema. Option B is wrong because <cpu-pinning> is a fabricated element; the correct parent is <cputune> and the child is <vcpupin>, not <cpu-pinning>. Option D is wrong because <affinity> with host-cpu attributes is not part of the libvirt domain XML schema; CPU affinity is expressed via <vcpupin> inside <cputune>, not through an <affinity> tag.

124
MCQmedium

Which command is used to list all active running domains?

A.virsh domlist
B.virsh status
C.virsh list --all
D.virsh list
AnswerD

virsh list queries the libvirt daemon and enumerates running domains on the local hypervisor, matching the stem's requirement to list active running domains. Other virsh subcommands target storage pools, networks or interfaces, or require the --all flag to include inactive, shut-off domains.

Why this answer

The virsh list command lists all currently running domains (VMs) by default, showing their ID, name, and state. This is the standard libvirt CLI command for enumerating active guests. Adding --all extends the output to include inactive and shut-off domains, but the base command answers the question as asked.

Exam trap

The trap is the distinction between virsh list (running only) and virsh list --all (running plus inactive) — candidates who reflexively add --all for completeness pick the wrong option when the question specifies active running domains.

How to eliminate wrong answers

Option A is wrong because virsh domlist is not a valid virsh subcommand — the correct command is list, and domlist does not exist in the virsh command set. Option B is wrong because virsh status is not a valid subcommand; status is not how virsh enumerates domains. Option C is wrong because virsh list --all includes inactive domains as well, so it does not list only active running domains as the question specifies.

125
MCQhard

You are migrating a running KVM guest from hostA to hostB with virsh migrate --live. The migration fails immediately with 'error: internal error: Attempt to migrate guest to the same host'. Both hosts share the same NFS storage and have identical CPU models. Which condition most likely explains this failure?

A.hostB resolves to the same IP address as hostA, or the migration URI points back to hostA.
B.The guest uses a virtio-net device without a configured migration address.
C.The guest's disk image is stored on local storage instead of the shared NFS mount.
D.The libvirt daemon on hostB is listening only on a Unix socket and not on TCP.
AnswerA

libvirt refuses to migrate a domain to what it considers the same host. If the destination URI resolves to the source host's address, for example due to a stale /etc/hosts entry or a mistaken qemu+tcp:// URI, the check fails with exactly this message. Verifying name resolution and the destination argument is the correct first step.

Why this answer

libvirt compares the destination against the source host identity and aborts when they match, which is exactly what the 'same host' error indicates. The common causes are incorrect DNS or /etc/hosts entries, using a URI that resolves locally, or accidentally passing the local hostname as the destination. Confirming that hostB resolves to a distinct, reachable address and that the migration URI targets it resolves the issue.

Exam trap

The trap here is focusing on storage or device configuration, when the error text specifically signals a host identity comparison failure in libvirt's migration validation.

126
MCQmedium

In the context of container orchestration, what is the role of a 'sidecar' container?

A.To provide auxiliary services like logging or monitoring for the main container
B.To act as a load balancer for the cluster
C.To store persistent data for the primary container
D.To run in a separate network namespace
E.To replace the main container when it crashes
AnswerA

A sidecar runs alongside the main container in the same pod, sharing its network namespace and lifecycle, to handle auxiliary concerns such as log shipping, metrics collection or proxying. This offloads cross-cutting functions without altering the primary application image.

Why this answer

A sidecar container runs alongside the main application container in the same pod, providing auxiliary functionality such as log shipping, metrics collection, proxying, or configuration sync. It shares the pod's network namespace and lifecycle, augmenting rather than replacing the primary container. This is the canonical definition in Kubernetes and general container orchestration.

Exam trap

The trap is overgeneralizing the sidecar role to include load balancing or persistence — candidates pick answers that describe other Kubernetes primitives (Services, Volumes) rather than the sidecar's auxiliary-service purpose.

How to eliminate wrong answers

Option B is wrong because load balancing in a cluster is handled by Services, Ingress controllers, or dedicated proxies — not by a sidecar's defining role, though a sidecar proxy (like Envoy in a service mesh) can participate in load balancing as an auxiliary function. Option C is wrong because persistent data is provided by volumes or PersistentVolumes, not by sidecar containers. Option D is wrong because sidecars share the pod's network namespace by design, not run in a separate one.

Option E is wrong because sidecars do not replace the main container on crash — that is the role of restart policies or ReplicaSets.

127
MCQhard

When using Packer with the QEMU builder, what does the 'format' option in the 'qemu' builder define?

A.The output image format
B.The filesystem type
C.The hypervisor type
D.The guest OS type
AnswerA

The format option specifies the output image format produced by the QEMU builder, satisfying the stem's requirement. It controls the on-disk artefact type, such as qcow2 or raw, and is distinct from accelerator, which selects the CPU virtualisation backend rather than the image encoding.

Why this answer

In the Packer QEMU builder, the 'format' option defines the output image format — for example 'qcow2', 'raw', 'vmdk', or 'vdi'. It tells QEMU how to write the resulting disk image so it is compatible with the target hypervisor or platform. This is distinct from filesystem or guest OS settings, which are configured elsewhere.

Exam trap

305-300 often tests whether candidates confuse the QEMU builder's 'format' (output disk image format) with filesystem or guest OS settings — the word 'format' is ambiguous, so reading the option carefully is essential.

How to eliminate wrong answers

Option B is wrong because the filesystem type (ext4, xfs, etc.) is determined by the guest OS installation and partitioning, not by the QEMU builder's 'format' option. Option C is wrong because the hypervisor type is fixed by the builder itself (QEMU/KVM); 'format' does not select a hypervisor. Option D is wrong because the guest OS type is specified via the 'accelerator', 'machine_type', or ISO/boot settings, not the 'format' option.

128
Multi-Selectmedium

Which THREE of the following are valid Libvirt storage pool types?

Select 3 answers
A.ram
B.iscsi
C.lvm
D.usb
E.dir
AnswersB, C, E

Libvirt provides an iscsi storage pool type that connects to an iSCSI target and exposes its LUNs as volumes. It is a recognised pool driver, distinct from dir, fs, netfs, logical, disk, scsi, mpath, rbd, gluster and zfs.

Why this answer

Option B (iscsi) is correct because Libvirt supports an iSCSI storage pool type that connects to an iSCSI target and exposes its LUNs as volumes. Option C (lvm) is correct because Libvirt can use an existing LVM volume group as a storage pool, creating logical volumes as pool volumes. Option E (dir) is correct because the directory pool type is the most basic Libvirt pool, managing files in a local directory.

Options A (ram) and D (usb) are not valid Libvirt storage pool types; Libvirt's defined pool types include dir, disk, fs, netfs, logical (LVM), iscsi, scsi, mpath, rbd, sheepdog, gluster, and zfs, but not ram or usb.

Exam trap

305-300 often tests whether candidates confuse host device passthrough types (usb, pci) with storage pool backends, so 'usb' looks plausible but is not a pool type.

129
MCQhard

You are debugging a Docker network issue where containers on different hosts cannot communicate. Which network driver is specifically designed to support multi-host overlay networking?

A.bridge
B.macvlan
C.ipvlan
D.host
E.overlay
AnswerE

The overlay driver encapsulates container traffic in VXLAN, extending a single logical network across multiple Docker hosts. This satisfies the stem's multi-host constraint, which bridge and host drivers cannot meet since they are confined to one host.

Why this answer

Option E is correct because the 'overlay' driver is specifically designed for multi-host networking in Docker Swarm, using VXLAN tunnels to encapsulate container traffic across hosts. It creates a distributed network that spans multiple Docker daemons, enabling containers on different hosts to communicate as if on the same Layer 2 network.

Exam trap

The trap is confusing overlay with macvlan or ipvlan — candidates may think any advanced driver supports multi-host, but only overlay is purpose-built for cross-host container communication.

How to eliminate wrong answers

Option A is wrong because the 'bridge' driver is limited to a single host — it creates a private internal network on one Docker daemon and cannot span multiple hosts without additional routing. Option B is wrong because 'macvlan' assigns MAC addresses to containers, making them appear as physical devices on the network, but it is typically scoped to a single host or requires complex underlay configuration. Option C is wrong because 'ipvlan' is similar to macvlan but uses IP-based multiplexing; it is not designed for multi-host overlay networking.

Option D is wrong because the 'host' driver removes network isolation entirely, placing the container on the host's network stack — it does not provide multi-host connectivity.

130
MCQmedium

You want to optimize disk I/O performance for a KVM guest. Which bus type should you configure in the libvirt domain XML for the virtual disk?

A.scsi
B.usb
C.ide
D.virtio
AnswerD

Virtio provides a paravirtualised block driver, letting the guest issue I/O through shared memory rings rather than emulating a full storage controller. This bypasses the trap-and-emulate overhead of IDE or SATA emulation, delivering the lowest latency and highest throughput — exactly the disk I/O optimisation the scenario demands.

Why this answer

Virtio is a paravirtualized I/O driver framework designed specifically for KVM guests, providing near-native disk I/O performance by reducing the overhead of full hardware emulation. Configuring the disk bus as virtio in the libvirt domain XML (using <target dev='vda' bus='virtio'/>) allows the guest to use the virtio-blk or virtio-scsi driver, which significantly outperforms emulated IDE or SCSI controllers. This is the recommended bus type for production KVM workloads.

Exam trap

305-300 often tests the misconception that SCSI is always faster than virtio, when in fact virtio is a paravirtualized driver that outperforms emulated SCSI in KVM environments.

How to eliminate wrong answers

Option A is wrong because SCSI, while better than IDE, still involves emulation overhead unless combined with virtio-scsi; plain SCSI is not the optimal choice for performance. Option B is wrong because USB is a slow, external bus intended for peripherals, not primary virtual disks, and would severely bottleneck I/O. Option C is wrong because IDE is a legacy emulated controller with high CPU overhead and limited throughput, making it the worst choice for performance.

131
MCQeasy

You are preparing a KVM guest for a maintenance window and need to shut it down gracefully so the guest OS can flush buffers and stop services. Which virsh command should you use?

A.virsh shutdown guest1
B.virsh destroy guest1
C.virsh undefine guest1
D.virsh suspend guest1
AnswerA

The shutdown subcommand sends an ACPI shutdown signal or, if the QEMU guest agent is configured, a guest-agent shutdown request. This lets the guest OS perform an orderly halt, flushing buffers and stopping services. It matches the requirement for a graceful maintenance shutdown.

Why this answer

A graceful shutdown requires notifying the guest OS so it can stop services and flush buffers. The shutdown subcommand does this via ACPI or the guest agent. destroy is a forced power-off, suspend is a pause, and undefine removes configuration, so none of those provide an orderly halt.

Exam trap

The trap here is assuming that destroy performs a clean shutdown because the word sounds like it removes the domain safely, when in fact it is a hard power-off.

132
MCQeasy

Which command-line tool is primarily used to inspect the metadata and configuration of a running Docker container?

A.docker ps
B.docker stats
C.docker info
D.docker inspect
E.docker describe
AnswerD

docker inspect returns the container's full JSON metadata: configuration, network settings, mounts, environment variables and state. It reads the daemon's stored object rather than live process output, matching the stem's requirement to examine metadata and configuration of a running container.

Why this answer

docker inspect returns detailed JSON metadata about a container, including its configuration, network settings, mounts, and state. It is the primary tool for examining the low-level details of a running or stopped container.

Exam trap

The trap is confusing docker inspect with docker ps or docker info — candidates may think 'inspect' is for listing, but it's for deep metadata retrieval, and 'describe' is a Kubernetes term, not Docker.

How to eliminate wrong answers

Option A (docker ps) is wrong because it only lists running containers with basic information like ID, image, and status — it does not show configuration metadata. Option B (docker stats) is wrong because it displays live resource usage statistics (CPU, memory, network I/O) rather than configuration details. Option C (docker info) is wrong because it shows system-wide Docker daemon information, not details about a specific container.

Option E (docker describe) is wrong because there is no such Docker command — 'describe' is a kubectl command in Kubernetes, not Docker.

133
MCQhard

In a Xen environment, which command would you use to change the number of VCPUs allocated to a running domain 'dom1' to 4?

A.virsh setvcpus dom1 4
B.xl mem-set dom1 4
C.xl vcpu-set dom1 4
D.xm set-vcpu dom1 4
AnswerC

xl vcpu-set adjusts the virtual CPU count of a running domain through the Xen hypervisor toolstack, applying the new value to dom1 immediately. It changes the live allocation to four VCPUs without rebooting the guest.

Why this answer

In a Xen environment managed via the xl toolstack (the modern replacement for xm), the xl vcpu-set command is used to change the number of virtual CPUs assigned to a running domain. The syntax 'xl vcpu-set dom1 4' sets domain dom1 to 4 VCPUs. This is the Xen-native equivalent of virsh setvcpus in libvirt-managed environments.

Exam trap

The trap here is confusing libvirt's virsh command set with Xen's native xl/xm toolstack — candidates who default to virsh forget that the question specifies a Xen environment, not a libvirt-managed one.

How to eliminate wrong answers

Option A is wrong because virsh setvcpus is a libvirt command, not a native Xen xl/xm command — it works only when the host is managed through libvirt, not directly through the Xen toolstack. Option B is wrong because xl mem-set adjusts memory allocation, not VCPU count. Option D is wrong because xm set-vcpu is not a valid xm subcommand (the correct legacy form is 'xm vcpu-set'), and xm itself is deprecated in favor of xl.

134
Multi-Selectmedium

Which THREE of the following are components of the Docker architecture?

Select 3 answers
A.Docker Daemon
B.Docker Kernel
C.Docker Client
D.Docker GUI
E.Docker Registry
AnswersA, C, E

The Docker daemon (dockerd) is the persistent background process that builds images, runs containers and manages Docker objects via the Docker API. It is a core architectural component, so it belongs in the correct three-part selection.

Why this answer

Docker Daemon (A) is correct because dockerd is the persistent background service that listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. Docker Client (C) is correct because the docker CLI is the primary user interface that sends commands to the daemon via the Docker REST API over a socket or network. Docker Registry (E) is correct because it is the storage and distribution system for Docker images, with Docker Hub as the default public registry from which images are pulled and to which they are pushed.

Docker Kernel (B) is not a Docker component; Docker relies on the host OS kernel's features (namespaces, cgroups) but does not ship its own kernel. Docker GUI (D) is not a core architectural component; graphical tools like Docker Desktop or Portainer are optional third-party or wrapper interfaces, not part of the Docker architecture itself.

Exam trap

The trap is that distractors like 'Docker Kernel' or 'Docker GUI' sound plausible because Docker does use the kernel and GUIs exist — but neither is a defined architectural component of Docker itself.

135
Multi-Selectmedium

You need to enable and configure a UEFI firmware boot for a new KVM guest on a libvirt host. Which TWO of the following steps are required? (Choose two.)

Select 2 answers
A.Disable the QEMU guest agent channel because it conflicts with UEFI variable services.
B.Convert the guest disk image from qcow2 to raw format because UEFI firmware cannot boot from qcow2.
C.Set the domain's <os> element to use <loader type='pflash'> with the OVMF code and variable store paths, or select the UEFI firmware via the firmware autoselection feature.
D.Add a <boot dev='uefi'/> element to the domain's <os> section to select UEFI boot order.
E.Install the OVMF firmware package on the host so the OVMF_CODE and OVMF_VARS files are available.
AnswersC, E

The domain XML must reference the UEFI firmware through a pflash loader or the newer firmware autoselection attributes. This tells QEMU to boot via UEFI and where to find the code and variable store. Without this configuration change, the guest would still boot with legacy BIOS.

Why this answer

Enabling UEFI boot requires the OVMF firmware files to be present on the host and the domain XML to reference them via a pflash loader or firmware autoselection. Neither the disk image format nor the guest agent is relevant to UEFI support, and there is no 'uefi' boot device value in libvirt XML.

Exam trap

The trap here is inventing a boot dev value for UEFI or assuming disk format matters, when the real requirement is firmware files plus a loader definition.

136
MCQhard

You are using QEMU to emulate an ARM architecture on an x86 host. Which binary would you typically use to execute this?

A.qemu-x86_64-arm
B.qemu-system-arm
C.qemu-arm
D.qemu-system-x86_64
AnswerB

qemu-system-arm is the full-system emulator binary that models an ARM machine, so it can boot an ARM kernel and OS on an x86 host. The stem specifies full ARM architecture emulation, which qemu-arm-user (user-mode only) cannot provide.

Why this answer

qemu-system-arm is the QEMU binary that emulates a full ARM system, including CPU, memory, and peripherals, allowing you to run an ARM operating system on an x86 host. The 'system' prefix indicates full-system emulation, as opposed to user-mode emulation. This is the correct binary for booting an ARM kernel or OS image.

Exam trap

The trap is confusing user-mode (qemu-arm) with system-mode (qemu-system-arm) emulation — candidates who remember 'qemu-arm' may pick it without realizing it cannot boot an OS.

How to eliminate wrong answers

Option A is wrong because 'qemu-x86_64-arm' is not a valid QEMU binary name; QEMU user-mode binaries follow the pattern qemu-<target-arch> (e.g., qemu-arm), not qemu-<host>-<target>. Option C is wrong because qemu-arm is the user-mode emulation binary, which runs individual ARM Linux binaries on a host but does not emulate a full system or boot an OS. Option D is wrong because qemu-system-x86_64 emulates an x86_64 system, which is the host architecture, not the ARM target the question asks for.

137
MCQmedium

Which command allows you to enter an existing running container and execute a new command inside it?

A.docker exec
B.docker commit
C.docker attach
D.docker run
AnswerA

docker exec runs a new command inside a container that is already running, which is exactly the requirement. It differs from docker run, which starts a fresh container, and from docker attach, which merely connects to the existing main process.

Why this answer

The `docker exec` command runs a new process inside an already-running container, which is exactly what is needed to enter a container and execute a command such as a shell. For example, `docker exec -it <container> /bin/bash` opens an interactive shell inside the running container without stopping or restarting it. This is the standard, non-disruptive way to access a running container.

Exam trap

The trap is confusing `docker exec` with `docker attach` — candidates may think attach lets them run commands, but attach only connects to PID 1's stdio and can disrupt the container, whereas exec spawns a new process.

How to eliminate wrong answers

Option B is wrong because `docker commit` creates a new image from a container's current state — it does not execute commands or provide interactive access. Option C is wrong because `docker attach` connects to the container's main process (PID 1) stdio, which can be disruptive and does not start a new command; detaching can also accidentally stop the container. Option D is wrong because `docker run` creates and starts a brand-new container from an image, rather than entering an existing running one.

138
Multi-Selecthard

Which THREE of the following are legitimate security concerns when managing a virtualization host?

Select 3 answers
A.Unencrypted VNC connections
B.Unauthorized access to the libvirt socket
C.Network interface speed
D.Guest-to-host breakout exploits
E.Hard drive fragmentation
AnswersA, B, D

VNC traffic is unencrypted by default, so credentials and screen data traverse the network in cleartext and can be captured by anyone with access to the path. This satisfies the scenario's requirement to identify a legitimate security concern affecting virtualisation host management.

Why this answer

Option A is correct because VNC is often used to remotely access a virtualization host's console or guest consoles, and VNC traffic is unencrypted by default, allowing credentials and session data to be intercepted on the network. Option B is correct because the libvirt socket (typically /var/run/libvirt/libvirt-sock) provides privileged management access to virtual machines; if permissions are misconfigured, unauthorized users could start, stop, or reconfigure guests. Option D is correct because guest-to-host breakout exploits target hypervisor or emulation vulnerabilities to escape the VM boundary and gain code execution on the host, which is a fundamental virtualization security risk.

Option C is not a security concern but a performance/availability consideration, and option E is a storage performance issue rather than a security threat.

Exam trap

The trap is that candidates may select performance-related items like network speed or disk fragmentation as security concerns, confusing operational efficiency with actual security vulnerabilities.

139
MCQhard

Which option for 'qemu-img create' allows you to create a preallocated image?

A.-o preallocation=full
B.--prealloc=true
C.-p full
D.-f preallocated
AnswerA

Using `-o preallocation=full` instructs qemu-img to allocate every data block on the host filesystem immediately, rather than lazily on first write. This satisfies the stem's requirement for a preallocated image, avoiding fragmentation and runtime allocation overhead during guest writes.

Why this answer

The correct syntax is qemu-img create -f qcow2 -o preallocation=full disk.qcow2, where preallocation is a format-specific option passed via -o. Setting preallocation=full allocates all the space on the host immediately, avoiding fragmentation and improving write performance at the cost of disk usage. Other valid values are off, metadata, and falloc.

Exam trap

The trap is assuming qemu-img uses long-form flags like --prealloc or a dedicated -p switch, when in fact all format-specific tuning goes through the -o key=value syntax.

How to eliminate wrong answers

Option B is wrong because --prealloc is not a valid qemu-img flag; qemu-img uses -o for format options, not long GNU-style flags. Option C is wrong because -p is not a preallocation switch — it is not a recognized qemu-img create option at all. Option D is wrong because -f specifies the image format (e.g., qcow2, raw), not a preallocation mode, so '-f preallocated' would be interpreted as an unknown format.

140
Multi-Selecthard

Which TWO pieces of information does Packer require to build an image for an existing cloud environment?

Select 2 answers
A.API credentials
B.Local disk path
C.BIOS password
D.Region
E.Host OS version
AnswersA, D

Packer authenticates to the target cloud provider's API using credentials such as access keys or service principal secrets before it can create, snapshot and register images. Without these credentials the builder cannot provision temporary instances, so they are mandatory for any existing cloud environment.

Why this answer

Packer needs API credentials (Option A) so its cloud builder can authenticate to the target cloud provider's API and create, register, and manage the resulting image on your behalf. Packer also needs the region (Option D) to know which geographic endpoint and datacenter location the image should be built in and stored, since cloud resources are region-scoped. A local disk path (Option B) is not required because Packer builds cloud images from a source image or template in the cloud, not from a local file path.

A BIOS password (Option C) is irrelevant since Packer does not modify firmware settings during image builds. The host OS version (Option E) is not required because Packer runs on the build host but the target image's OS comes from the configured source image, not the host's OS version.

Exam trap

305-300 often tests whether candidates confuse Packer's cloud builder requirements (API credentials and region) with local builder requirements (disk path, host OS) or unrelated hardware settings like BIOS passwords.

141
MCQhard

You are building a Docker image and need to ensure that the container process runs as a non-root user with UID 1000 and that this user exists in the image. Which pair of Dockerfile instructions achieves this correctly?

A.`USER appuser` followed by `RUN useradd -u 1000 appuser`
B.`USER 1000` followed by `RUN useradd -u 1000 appuser`
C.`RUN useradd -u 1000 -m appuser` followed by `USER appuser`
D.`RUN useradd -u 1000 appuser` followed by `USER 1000`
AnswerC

`useradd -u 1000 -m appuser` creates the user with the specified UID and a home directory during the build, while running as root. The subsequent `USER appuser` instruction sets the runtime user for the rest of the build and the container. This order ensures the user exists before it is referenced, which is the correct and reliable pattern.

Why this answer

The user must exist before it can be selected. Creating it with `useradd` while the build still runs as root, then switching with `USER appuser`, ensures the account is present in /etc/passwd and that the container process runs with the intended non-root identity. Reversing the order or using a numeric UID without creating the account leads to failures or reduced clarity.

Exam trap

The trap here is assuming that `USER` creates the account or that the order of `USER` and `useradd` does not matter.

142
MCQmedium

You administer a KVM host running libvirt. A developer needs a guest to be able to communicate with the host directly over a private network without any NAT or bridging to the physical LAN. You decide to use libvirt's default virtual network. Which virsh command will display the XML definition of this default network so you can inspect its forwarding mode and DHCP range?

A.virsh net-dhcp-leases default
B.virsh net-list --info default
C.virsh net-dumpxml default
D.virsh iface-dumpxml default
AnswerC

The net-dumpxml subcommand outputs the full XML definition of a libvirt virtual network. For the default network it reveals the forward mode='nat' element, the 192.168.122.0/24 address range, and the DHCP configuration. This is exactly the inspection needed to confirm how guests on the default network reach the host and external networks.

Why this answer

The net-dumpxml subcommand is the canonical way to retrieve the XML configuration of a libvirt virtual network. Inspecting the default network's XML reveals its NAT forwarding mode and DHCP range, which is precisely what the scenario requires. Other net-* subcommands either list runtime state or leases rather than the full definition.

Exam trap

The trap here is assuming that any virsh net-* subcommand will reveal the network's configuration, when only net-dumpxml outputs the full XML definition.

143
MCQhard

You are configuring cloud-init to inject an SSH key into a new VM. Which directive in the configuration metadata ensures the key is added to the correct user's authorized_keys file?

A.users.ssh_key
B.ssh_keys
C.ssh_authorized_keys
D.authorized_keys_file
AnswerC

The ssh_authorized_keys directive under the users list injects the specified public keys into that user's authorized_keys file during first boot. It satisfies the requirement to target the correct account rather than a default or root user.

Why this answer

In cloud-init user-data, the ssh_authorized_keys directive is a per-user key that specifies which SSH public keys should be written to that user's ~/.ssh/authorized_keys file. It is nested under the users list entry for the target user, ensuring the key lands in the correct account's authorized_keys rather than being applied globally.

Exam trap

The trap is confusing cloud-init's per-user ssh_authorized_keys with sshd_config's AuthorizedKeysFile or with a hypothetical top-level ssh_keys directive — candidates pick the name that sounds most like a config file parameter rather than the actual cloud-init schema key.

How to eliminate wrong answers

Option A is wrong because users.ssh_key is not a valid cloud-init directive — the correct per-user key is ssh_authorized_keys. Option B is wrong because ssh_keys is not a recognized cloud-init user-data key; there is no top-level ssh_keys directive in the users module schema. Option D is wrong because authorized_keys_file is not a cloud-init directive — it resembles an sshd_config parameter (AuthorizedKeysFile) but is not used by cloud-init to inject keys.

144
Multi-Selectmedium

Which TWO types of namespaces are commonly used to achieve container isolation in Linux?

Select 2 answers
A.GPU
B.Network
C.CPU
D.PID
E.Kernel
AnswersB, D

Network namespaces give each container its own isolated set of interfaces, routing tables, firewall rules and ports, so processes cannot see or interfere with the host's or other containers' networking. This satisfies the isolation requirement by virtualising the network stack per container.

Why this answer

Network namespaces (B) are correct because they give each container its own isolated network stack — separate interfaces, IP addresses, routing tables, and firewall rules — which is a core mechanism used by tools like Docker and Kubernetes for container isolation. PID namespaces (D) are also correct because they isolate the process ID number space, so processes inside a container only see their own PID tree (starting at PID 1) and cannot see or signal host processes. The other options do not belong: GPU (A) and CPU (C) are hardware resources managed via cgroups and device access, not namespace types, and Kernel (E) is not a Linux namespace — the kernel itself is shared, with namespaces isolating specific global resources like mount, UTS, IPC, user, network, and PID.

Exam trap

The trap is conflating namespaces with cgroups — candidates often pick CPU because they associate it with container resource control, but CPU limits are cgroup functionality, not namespace isolation.

145
Multi-Selecthard

Which THREE of the following are necessary to enable QEMU guest agent integration?

Select 3 answers
A.Installing qemu-guest-agent inside the guest
B.Adding a channel device for the agent to the XML
C.Adding a network bridge
D.Restarting the VM to apply the channel configuration
E.Enabling VNC password
AnswersA, B, D

Installing qemu-guest-agent inside the guest provides the in-VM daemon that communicates over the virtio-serial channel, enabling the host to issue commands such as graceful shutdown and filesystem freeze. Without this agent running, the host has no channel endpoint, so guest-agent integration cannot function regardless of host-side configuration.

Why this answer

Option A is correct because the QEMU guest agent requires the qemu-guest-agent package (or equivalent, e.g., qemu-ga) to be installed and running inside the guest OS so it can communicate over the virtio-serial channel. Option B is correct because the VM's libvirt XML must define a channel device of type 'unix' with the target name 'org.qemu.guest_agent.0' (typically using a virtio-serial port) to provide the host-guest communication path. Option D is correct because the channel device is only instantiated at VM start, so the guest must be restarted (or the domain rebooted) for the new channel to become available and the agent to connect.

Option C is not required because the guest agent uses a virtio-serial channel, not a network bridge, so no bridge configuration is needed. Option E is not required because VNC password authentication is unrelated to guest agent integration and only affects graphical console access.

Exam trap

The 305-300 exam often tests the specific components of guest agent integration, and the trap is selecting a plausible but unrelated networking option (bridge or VNC) instead of the required channel device and guest-side installation.

146
MCQeasy

What is a 'snapshot' in virtualization?

A.A virtual hardware configuration
B.A log file of guest activity
C.A backup of the entire host system
D.A saved state of a virtual machine at a point in time
AnswerD

A snapshot captures the complete state of a virtual machine — disk, memory, and configuration — at a specific moment, enabling rollback to that exact point. This differs from clones, which create independent copies rather than point-in-time restore states.

Why this answer

A snapshot in virtualization is a saved state of a virtual machine at a specific point in time, capturing disk contents (and optionally memory/CPU state) so the VM can be reverted to that state. It is not a hardware config, log, or full host backup. Snapshots enable rollback after changes or failures.

Exam trap

305-300 often tests the definition of a snapshot — the trap is confusing it with a full backup or a VM configuration file, when it is specifically a point-in-time state capture.

How to eliminate wrong answers

Option A is wrong because a virtual hardware configuration is the VM's XML definition (CPU, memory, devices), not a snapshot. Option B is wrong because a log file records guest activity/events; it does not capture VM state for restoration. Option C is wrong because a snapshot captures a single VM's state, not the entire host system — host-level backups are a different concept.

147
MCQhard

You are building a multi-stage Dockerfile and want to copy a binary from the 'builder' stage to the final stage. Which syntax is correct?

A.ADD --from=builder /bin/app /bin/app
B.COPY --from=builder /bin/app /bin/app
C.COPY builder:/bin/app /bin/app
D.COPY --stage=builder /bin/app /bin/app
AnswerB

COPY --from=builder references the earlier build stage by name, pulling only the compiled binary into the final image without dragging along the builder's toolchain or layers. This satisfies the stem's multi-stage requirement, keeping the runtime image minimal while the build dependencies stay confined to the discarded stage.

Why this answer

Docker's multi-stage build feature allows COPY --from=<stage> to pull artifacts from a previously built stage (or an external image) into the current stage. The syntax COPY --from=builder /bin/app /bin/app copies the binary /bin/app from the stage named 'builder' into the final image at /bin/app, keeping the final image small by excluding the builder's toolchain and dependencies.

Exam trap

The trap is the near-miss flag names — candidates who half-remember the syntax pick ADD --from or COPY --stage, but only COPY supports --from and the flag is spelled --from, not --stage.

How to eliminate wrong answers

Option A is wrong because ADD does not support the --from flag — only COPY does; ADD is for local files, tarballs, and URLs, and using --from with ADD is invalid syntax. Option C is wrong because 'builder:/bin/app' is not valid Dockerfile syntax; the stage reference must be expressed with the --from flag, not as a path prefix. Option D is wrong because the flag is --from, not --stage; --stage is not a recognized Dockerfile instruction flag and would cause a build error.

148
MCQmedium

You are migrating a legacy application to an LXC container and need to ensure the container has access to the host's /dev/sda block device. Which configuration key must be added to the container's configuration file?

A.lxc.mount.device = /dev/sda
B.lxc.cap.sys_admin = 1
C.lxc.cgroup.devices.allow = b 8:0 rwm
D.lxc.dev.access = /dev/sda
AnswerC

The cgroup devices controller filters access by major:minor numbers, so 'b 8:0 rwm' permits block device 8:0 (/dev/sda) with read, write and mknod rights. Without this allow rule, the container's device cgroup denies access, satisfying the requirement to expose the host block device.

Why this answer

LXC controls device access through the cgroup devices controller, and the config key lxc.cgroup.devices.allow uses the syntax 'TYPE MAJOR:MINOR PERMISSIONS'. For /dev/sda, the type is 'b' (block), major 8, minor 0, and permissions 'rwm' (read, write, mknod). This whitelists the block device so the container can access it, and it must be paired with a bind mount (lxc.mount.entry) to actually expose the device node inside the container.

Exam trap

305-300 often tests whether candidates pick a plausible-sounding but nonexistent config key (lxc.mount.device, lxc.dev.access) or over-grant privileges with CAP_SYS_ADMIN instead of using the correct cgroup devices.allow syntax.

How to eliminate wrong answers

Option A is wrong because lxc.mount.device is not a valid LXC configuration key — LXC uses lxc.mount.entry for bind mounts, and device access is controlled by cgroup rules, not a mount directive. Option B is wrong because lxc.cap.sys_admin = 1 grants the container the CAP_SYS_ADMIN capability, which is a broad privilege escalation and does not by itself allow access to a specific block device — device whitelisting is the correct mechanism. Option D is wrong because lxc.dev.access is not a real LXC config key; it is a fabricated name that sounds plausible but has no effect.

149
MCQeasy

Which component is responsible for the actual hardware-assisted virtualization in KVM?

A.Virt-manager GUI
B.KVM kernel module
C.Libvirtd daemon
D.QEMU user-mode binary
AnswerB

The KVM kernel module operates in kernel space and uses hardware virtualisation extensions (Intel VT-x or AMD-V) to execute guest code directly on the CPU. It satisfies the stem's requirement for hardware-assisted virtualisation, unlike QEMU, which handles device emulation in user space.

Why this answer

The KVM kernel module (kvm.ko and hardware-specific modules like kvm_intel or kvm_amd) is responsible for hardware-assisted virtualization. It leverages CPU virtualization extensions (Intel VT-x or AMD-V) to execute guest code directly on the host CPU while trapping privileged instructions. This provides near-native performance for virtual machines.

Exam trap

The trap is attributing virtualization to management tools (virt-manager, libvirtd) or QEMU, when the actual hardware-assisted virtualization is performed by the KVM kernel module.

How to eliminate wrong answers

Option A is wrong because virt-manager is a graphical management tool for libvirt, not a virtualization component. Option C is wrong because libvirtd is a daemon that manages hypervisors and provides an API, but it does not perform virtualization itself. Option D is wrong because QEMU user-mode binary performs emulation and I/O, but hardware-assisted virtualization is handled by KVM; QEMU without KVM is pure software emulation.

150
Multi-Selecthard

Which THREE of the following are valid elements inside the <interface type='bridge'> block?

Select 3 answers
A.<source bridge='br0'/>
B.<ip address='...'/>
C.<gateway address='...'/>
D.<model type='virtio'/>
E.<mac address='...'/>
AnswersA, D, E

The `<source bridge='br0'/>` element names the host bridge that the guest's virtual NIC attaches to, satisfying the requirement for a valid child element within `<interface type='bridge'>`. Libvirt uses this attribute to bind the domain interface to an existing Linux bridge, so traffic egresses via br0 rather than a virtual network.

Why this answer

Option A is correct because <source bridge='br0'/> is the required child element that tells libvirt which host bridge the guest interface should be attached to, and it is valid inside <interface type='bridge'>. Option D is correct because <model type='virtio'/> is a valid child element that selects the emulated NIC model presented to the guest, with virtio being the paravirtualized option. Option E is correct because <mac address='...'/> is a valid child element used to assign a specific MAC address to the guest interface.

Options B and C are not valid here: <ip address='...'/> and <gateway address='...'/> are not children of <interface type='bridge'>; IP/gateway configuration belongs in the guest OS or in higher-level network definitions, not in the interface's bridge block.

Exam trap

305-300 often tests the distinction between interface-level and network-level configuration elements, tricking candidates into adding IP or gateway settings inside the interface block.

Page 1

Page 2 of 3

Page 3

All pages