CompTIA XK0-006 (CompTIA Linux+) Practice Test 17

Question 160

A test VM must communicate only with its host and similarly isolated guests, not the external LAN. Which network mode matches?

  1. QEMU
  2. VirtIO drivers
  3. virsh list --all
  4. Host-only virtual network

Explanation

Correct Answer

D:

Host-only networking permits isolated host-guest traffic without directly bridging to the external network. NAT or bridging would add additional network exposure.

Incorrect Answers

A:

QEMU provides machine and device emulation and can use KVM to accelerate guest CPUs; its scope differs from isolating guest networking from external LANs, so it cannot meet the stated requirement.

B:

VirtIO drivers expose efficient virtual devices designed for guest-hypervisor interaction; that is not equivalent to isolating guest networking from external LANs.

C:

virsh queries libvirt and --all includes inactive guest definitions; the administrator instead needs isolating guest networking from external LANs; this option serves a different purpose.

Question 161

A KVM host already runs libvirt. The administrator wants a command-line frontend that defines a new virtual machine and starts an operating-system installation from an ISO without manually constructing domain XML. Which utility fits?

  1. virt-install
  2. virsh list --all
  3. qemu-img convert
  4. virt-viewer
  5. lsmod

Explanation

Correct Answer

A:

virt-install creates guest definitions through libvirt and can start an installation using an ISO or other supported installation source; it is designed for initial guest provisioning.

Incorrect Answers

B:

virsh list --all enumerates defined virtual machines, including inactive ones. It reports existing guests rather than creating a new installation from media.

C:

qemu-img convert transforms virtual disk image formats. Converting storage does not define the guest hardware, attach installation media or start an installation.

D:

virt-viewer connects to a guest graphical console. It does not define a VM domain or initiate a new guest installation through libvirt.

E:

lsmod shows kernel modules currently loaded on the host. Kernel module discovery is not a command-line guest provisioning workflow.

Question 162

A user wants to see exactly which metadata changed on an inode, including modification and change times. Which command provides a detailed report?

  1. touch -m report.txt
  2. file sample.dat
  3. stat /srv/file
  4. find /srv -type f -mtime -1

Explanation

Correct Answer

C:

stat reports inode, permissions, sizes, and multiple file timestamps. The change time indicates metadata changes, not necessarily file content changes.

Incorrect Answers

A:

touch can update specified timestamps without modifying file data; the evidence calls for inspecting file inode timestamps and attributes, not merely this separate operation.

B:

file examines signatures and other content characteristics to identify probable formats; the task involves inspecting file inode timestamps and attributes, whereas this addresses another subsystem.

D:

find walks a directory tree and evaluates predicates for file type and modification time; that is not equivalent to inspecting file inode timestamps and attributes.

Question 163

A shell is inside an unknown directory, and an operator needs its full current path. Which command displays it?

  1. stat /srv/file
  2. touch -m report.txt
  3. mkdir -p /srv/app/cache
  4. pwd -P

Explanation

Correct Answer

D:

pwd -P prints the physical working directory, resolving symbolic components where supported. It reports location rather than listing file contents.

Incorrect Answers

A:

stat reports inode, permissions, sizes, and multiple file timestamps; it answers a neighboring question rather than printing the physical current working directory.

B:

touch can update specified timestamps without modifying file data; that changes a different part of the system; the requested outcome is printing the physical current working directory.

C:

mkdir -p creates missing parent directories and does not fail merely because an existing directory is already present; this does not achieve printing the physical current working directory on the system described.

Question 164

A configuration path must refer to a file on another mounted filesystem. Which operation creates a suitable reference?

  1. Symbolic links store a target path
  2. The inode remains while another hard link exists
  3. Symbolic linkage rather than hard linkage
  4. ln -s /opt/app/config.yml /etc/app-link.yml

Explanation

Correct Answer

D:

A symbolic link stores a pathname and can cross filesystem boundaries. It may become dangling if its target path disappears.

Incorrect Answers

A:

A symbolic link resolves its stored path during use rather than retaining the original target inode; the requirement is linking files across filesystem boundaries, outside the effect of this choice.

B:

Unlinking one name reduces the link count, but data remains accessible through surviving names and open references; it does not deliver linking files across filesystem boundaries, which is decisive in this scenario.

C:

Symlinks can refer across filesystem boundaries because their contents are paths; the evidence calls for linking files across filesystem boundaries, not merely this separate operation.

Question 165

A test tool requires an effectively endless stream of zero-valued bytes. Which special device provides it?

  1. Block device
  2. lsof +D /mnt/archive
  3. /dev/null
  4. /dev/zero

Explanation

Correct Answer

D:

/dev/zero produces zero bytes on reads for requested lengths. It is not a source of cryptographically secure random data.

Incorrect Answers

A:

Block devices support addressable block-oriented I/O suited to disk and partition abstractions; that is not equivalent to generating zero-filled input bytes.

B:

lsof reports open files held by processes and can search under a directory; the administrator instead needs generating zero-filled input bytes; this option serves a different purpose.

C:

/dev/null accepts and discards writes and returns EOF when read; it answers a neighboring question rather than generating zero-filled input bytes.

Question 166

Two configuration files must be compared using line-oriented unified output. Which invocation is suitable?

  1. diff -u old.conf new.conf
  2. mkdir -p /srv/app/cache
  3. cp -a source/ destination/
  4. stat /srv/file

Explanation

Correct Answer

A:

diff -u generates context-rich unified patches that show changed lines. It is useful for review and can be applied by suitable patch tools.

Incorrect Answers

B:

mkdir -p creates missing parent directories and does not fail merely because an existing directory is already present; using it would leave comparing text files with unified differences unresolved.

C:

cp -a performs an archive-style recursive copy while preserving many attributes; the requirement is comparing text files with unified differences, outside the effect of this choice.

D:

stat reports inode, permissions, sizes, and multiple file timestamps; it does not deliver comparing text files with unified differences, which is decisive in this scenario.

Question 167

An administrator wants to copy a directory and its contents while preserving timestamps and modes where supported. Which operation fits?

  1. cp -a source/ destination/
  2. find /srv -type f -mtime -1
  3. pwd -P
  4. diff -u old.conf new.conf
  5. rmdir /srv/empty

Explanation

Correct Answer

A:

cp -a performs an archive-style recursive copy while preserving many attributes. It is different from a simple single-file copy that drops metadata.

Incorrect Answers

B:

find walks a directory tree and evaluates predicates for file type and modification time; its scope differs from making a metadata-preserving directory copy, so it cannot meet the stated requirement.

C:

pwd -P prints the physical working directory, resolving symbolic components where supported; that is not equivalent to making a metadata-preserving directory copy.

D:

diff -u generates context-rich unified patches that show changed lines; the administrator instead needs making a metadata-preserving directory copy; this option serves a different purpose.

E:

rmdir removes empty directories and fails when entries remain; it answers a neighboring question rather than making a metadata-preserving directory copy.

Question 168

A symbolic link shows as broken after its target is moved. What characteristic explains this behavior?

  1. The inode remains while another hard link exists
  2. ln -s /opt/app/config.yml /etc/app-link.yml
  3. Symbolic linkage rather than hard linkage
  4. Symbolic links store a target path

Explanation

Correct Answer

D:

A symbolic link resolves its stored path during use rather than retaining the original target inode. Relocating the destination can therefore invalidate the reference.

Incorrect Answers

A:

Unlinking one name reduces the link count, but data remains accessible through surviving names and open references; that changes a different part of the system; the requested outcome is explaining a dangling pathname-based link.

B:

A symbolic link stores a pathname and can cross filesystem boundaries; this does not achieve explaining a dangling pathname-based link on the system described.

C:

Symlinks can refer across filesystem boundaries because their contents are paths; it will not provide explaining a dangling pathname-based link under these conditions.

Question 169

A shell command should intentionally discard all output written to its target path. Which special device suits this?

  1. locate filename
  2. /dev/null
  3. lsof +D /mnt/archive
  4. Block device
  5. Character device
  6. /dev/zero

Explanation

Correct Answer

B:

/dev/null accepts and discards writes and returns EOF when read. It is useful for explicitly suppressing output streams.

Incorrect Answers

A:

locate searches a filename database quickly rather than traversing the filesystem live; it does not deliver discarding unwanted command output, which is decisive in this scenario.

C:

lsof reports open files held by processes and can search under a directory; the task involves discarding unwanted command output, whereas this addresses another subsystem.

D:

Block devices support addressable block-oriented I/O suited to disk and partition abstractions; its scope differs from discarding unwanted command output, so it cannot meet the stated requirement.

E:

A character device exposes byte-stream operations to a driver, as with serial terminals; that is not equivalent to discarding unwanted command output.

F:

/dev/zero produces zero bytes on reads for requested lengths; the administrator instead needs discarding unwanted command output; this option serves a different purpose.

Question 170

A deployment tool should create several nested directories even if parents are absent. Which command is suitable?

  1. find /srv -type f -mtime -1
  2. ls -ld /srv/data
  3. mkdir -p /srv/app/cache
  4. mv old.csv new.csv

Explanation

Correct Answer

C:

mkdir -p creates missing parent directories and does not fail merely because an existing directory is already present. It does not recursively change ownership.

Incorrect Answers

A:

find walks a directory tree and evaluates predicates for file type and modification time; the administrator instead needs creating a nested directory tree safely; this option serves a different purpose.

B:

ls -ld displays long-format metadata about the directory entry; it answers a neighboring question rather than creating a nested directory tree safely.

D:

mv renames or relocates files and can use a filesystem rename when source and target are on the same filesystem; this does not achieve creating a nested directory tree safely on the system described.

CompTIA Linux+ (XK0-006) Practice Tests