Courseiva

LPIC-3 Exam 305: Virtualization and Containerization (305-300) (305-300) (305-300) — Questions 151194

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

Page 2

Page 3 of 3

151
MCQmedium

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

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

This cleans the apt cache, reducing the layer size.

Why this answer

Combining the update and install commands with 'rm -rf /var/lib/apt/lists/*' in a single RUN command prevents layer bloat.

152
MCQeasy

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

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

Starts the domain.

Why this answer

virsh start vm_name boots the virtual machine.

153
MCQmedium

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

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

net-define is the correct command.

Why this answer

virsh net-define net.xml loads the network configuration into libvirt.

154
MCQmedium

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

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

This handles the image upload to Glance.

Why this answer

The 'openstack' post-processor is designed to handle the registration of the image into the OpenStack Glance service.

155
Multi-Selecthard

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

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

Defines driver properties.

Why this answer

<source>, <target>, and <driver> are the primary sub-elements of a <disk> entry.

156
Multi-Selectmedium

Which TWO commands are valid for inspecting container network settings?

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

Displays detailed container info including networking.

Why this answer

'docker inspect' provides detailed JSON, and 'docker network inspect' shows network-specific details.

157
MCQmedium

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

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

rkt focused on security, standards, and pod-native execution.

Why this answer

rkt was designed as a pod-native container engine with a focus on security and composability.

158
MCQhard

You are performing a live migration of a VM using libvirt. The source and destination hosts share a common storage pool (NFS). Which option should be used with 'virsh migrate' to ensure only the memory state is transferred?

A.--shared-storage
B.--migrate-memory-only
C.--unsafe
D.--copy-storage-none
AnswerD

This flag specifies that storage is already available on the destination.

Why this answer

--live --copy-storage-none allows migration without moving the disk image if the storage is shared.

159
Multi-Selecthard

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

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

Updating paths for the new disk location.

Why this answer

Copying the image, editing the XML, and redefining the domain are the correct workflow steps.

160
MCQeasy

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

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

This is the correct command.

Why this answer

'docker image history' displays the layers and the commands that created them.

161
MCQmedium

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

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

dumpxml extracts the current XML state.

Why this answer

virsh dumpxml webserver outputs the XML definition of the specified domain.

162
MCQhard

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

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

Managed by Docker and designed for persistence.

Why this answer

Named volumes are specifically designed for persistence and sharing independent of container lifecycles.

163
MCQmedium

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

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

This log tracks the internal processing of the cloud-init modules.

Why this answer

Cloud-init logs all activities to /var/log/cloud-init.log, while /var/log/cloud-init-output.log captures stdout and stderr from the modules.

164
MCQmedium

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

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

Dockerfile defines the image creation steps.

Why this answer

It contains the instructions for building an image.

165
MCQhard

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

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

Correct XML for defining a QXL video device.

Why this answer

The <video> tag with a <model type='qxl'/> sub-tag defines the video device.

166
Multi-Selectmedium

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

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

Efficient disk usage.

Why this answer

Snapshots and dynamic allocation are key benefits of QCOW2.

167
Multi-Selectmedium

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

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

Overlay2 is the default and recommended driver.

Why this answer

Overlay2 and aufs are both well-known storage drivers for Docker.

168
Multi-Selectmedium

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

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

Creates new images.

Why this answer

qemu-img info and qemu-img create are standard image management commands.

169
MCQmedium

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

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

This is the primary purpose of runcmd.

Why this answer

The 'runcmd' module is used to execute arbitrary shell commands during the boot process of an instance.

170
MCQhard

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

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

Docker injects rules into the FORWARD chain to control inter-network traffic.

Why this answer

Docker adds rules to the FORWARD chain in the filter table to manage traffic between the bridge network and external networks.

171
MCQeasy

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

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

Shows system configuration.

Why this answer

'docker info' shows details like the number of containers, images, and storage driver.

172
Multi-Selectmedium

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

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

Manages software installation.

Why this answer

'users-groups', 'runcmd', and 'packages' are all standard, well-documented modules in the cloud-init ecosystem.

173
Multi-Selectmedium

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

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

The account username.

Why this answer

'name', 'ssh_authorized_keys', and 'groups' are all standard configuration keys for the user module.

174
MCQmedium

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

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

This flag joins the container to the host network stack.

Why this answer

The --network host flag allows a container to share the host's networking namespace, providing full access to host network interfaces.

175
MCQmedium

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

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

Correct command for graceful shutdown.

Why this answer

virsh shutdown myvm sends an ACPI signal to the guest for a graceful shutdown.

176
MCQeasy

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

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

Detached (background) mode.

Why this answer

The -d or --detach flag runs the container in the background.

177
MCQeasy

What does 'QEMU' stand for?

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

Official meaning.

Why this answer

Quick Emulator.

178
Multi-Selecthard

When migrating a domain with virsh, which TWO of the following options can be used to ensure the migration is successful if the destination host has a different CPU architecture or feature set?

Select 2 answers
A.--persistent
B.--cpu-mode host-model
C.--undefine-source
D.--live
E.--cpu-mode custom
AnswersB, E

This ensures the VM runs with CPU features compatible with the host.

Why this answer

The '--cpu-mode' and '--migrate-disks' related flags help handle compatibility during migration.

179
MCQmedium

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

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

This sets the default command for the container.

Why this answer

ENTRYPOINT allows you to configure a container that will run as an executable.

180
Multi-Selectmedium

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

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

KVM's primary role.

Why this answer

Hardware-assisted virtualization and device emulation are the core roles of KVM and QEMU.

181
MCQmedium

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

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

Correct command for refreshing a pool.

Why this answer

virsh pool-refresh isos triggers a re-scan of the storage pool.

182
MCQhard

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

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

The vzctl command is the primary tool for OpenVZ management.

Why this answer

'vzctl set [CTID] --hostname [NAME] --save' is the correct command to update the container's hostname.

183
Multi-Selecthard

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

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

The primary configuration file.

Why this answer

Cloud-init accepts configuration via 'user-data' (the primary config) and 'metadata' (key-value pairs, though less common for full configs).

184
MCQhard

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

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

This driver allows log rotation using max-size and max-file.

Why this answer

The 'json-file' logging driver supports 'max-size' and 'max-file' options to rotate and cap logs.

185
Multi-Selecthard

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

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

Orchestration is primarily for scaling and deployment management.

Why this answer

Orchestration platforms manage scaling and automated recovery of containers.

186
Multi-Selectmedium

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

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

Starts a pool.

Why this answer

virsh pool-start and virsh pool-destroy are standard lifecycle commands.

187
MCQmedium

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

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

This is the correct syntax for initiating a live migration in Xen.

Why this answer

The 'xl migrate' command is the standard interface for Xen live migration, requiring the target host to be accessible and the source domain to be running.

188
MCQhard

In a Packer HCL2 file, how do you reference a variable named 'image_name' that was declared in the 'variables' block?

A.{{ .image_name }}
B.${image_name}
C.$image_name
D.var.image_name
AnswerD

This is the correct syntax for referencing input variables.

Why this answer

In HCL2, variables are accessed using the 'var.' prefix followed by the variable name.

189
MCQeasy

Which command is used to stop all running containers?

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

This stops all containers currently identified by ps -q.

Why this answer

'docker stop $(docker ps -q)' pipes the IDs of running containers to the stop command.

190
MCQmedium

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

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

The --all flag includes inactive pools.

Why this answer

virsh pool-list --all displays all pools regardless of their current status.

191
MCQmedium

You are using Packer to build a custom image for KVM. Which HCL2 block is specifically required to define the virtualization parameters like memory and CPU for the builder?

A.provisioners
B.post-processors
C.boot_command
D.qemuargs
AnswerD

The qemuargs block allows direct manipulation of the QEMU command line arguments used for the builder instance.

Why this answer

The 'qemu' builder in Packer utilizes specific configuration blocks to define virtual hardware settings when interfacing with KVM/QEMU.

192
MCQmedium

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

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

This is for AWS AMIs.

Why this answer

The 'amazon-ebs' builder is the standard choice for creating Amazon Machine Images (AMIs).

193
MCQhard

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

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

Correct XML structure for USB passthrough.

Why this answer

The <hostdev> element with mode='subsystem' and type='usb' is used for USB passthrough.

194
MCQmedium

You are using systemd-nspawn and want to run a container that shares the host's network namespace. Which flag is required?

A.--private-network=false
B.--network-veth
C.--network-host
D.--share-net
AnswerC

This flag instructs systemd-nspawn to use the host's network namespace.

Why this answer

The --private-network flag disables the network, while omitting it or specifically using --network-veth allows various configurations; however, to share the host's namespace, one must use --network-host.

Page 2

Page 3 of 3

All pages