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

Question 90

An administrator must control whether files or DNS are checked first for hostname lookups. Which configuration is relevant?

  1. netplan try
  2. hosts: entry in /etc/nsswitch.conf
  3. netplan status
  4. /etc/resolv.conf

Explanation

Correct Answer

B:

Name Service Switch specifies the source order for lookups such as hosts and users. It determines source precedence rather than authoritative DNS zone contents.

Incorrect Answers

A:

netplan try temporarily applies a candidate configuration and reverts it if not confirmed; the evidence calls for ordering local and remote hostname lookup sources, not merely this separate operation.

C:

netplan status summarizes current network links and addressing as seen through its backends; its scope differs from ordering local and remote hostname lookup sources, so it cannot meet the stated requirement.

D:

resolv.conf exposes resolver configuration, often generated by NetworkManager or systemd-resolved; that is not equivalent to ordering local and remote hostname lookup sources.

Question 91

A technician must inspect a machine's current hostname without changing it. Which command returns it directly?

  1. ip -6 addr show dev eth0
  2. 127.0.0.1
  3. ip route get 203.0.113.8
  4. hostname
  5. tracepath example.org
  6. Default route 0.0.0.0/0

Explanation

Correct Answer

D:

hostname prints the host's current name as understood by the system. Changing naming records or DNS zones is a separate administrative task.

Incorrect Answers

A:

The -6 flag restricts ip output to the IPv6 address family; it answers a neighboring question rather than printing the running system hostname.

B:

The IPv4 loopback address accepts local-host connections but is not routed over the external network; that changes a different part of the system; the requested outcome is printing the running system hostname.

C:

ip route get resolves the kernel's forwarding decision for a destination, including preferred source and next hop; this does not achieve printing the running system hostname on the system described.

E:

tracepath traces a network route and can report path MTU information using UDP probes; using it would leave printing the running system hostname unresolved.

F:

The default IPv4 route is a fallback used after more specific routes are considered; the requirement is printing the running system hostname, outside the effect of this choice.

Question 92

Two Linux servers need a controlled TCP throughput measurement. Which utility is purpose-built for this with a server and client?

  1. traceroute destination.example
  2. curl -I https://example.org
  3. nslookup 192.0.2.20
  4. iperf3

Explanation

Correct Answer

D:

iperf3 sends measurement traffic between endpoints and reports throughput metrics. It measures a test path rather than application response correctness.

Incorrect Answers

A:

traceroute probes with changing hop limits to infer routers along a path; the requirement is measuring network throughput between test endpoints, outside the effect of this choice.

B:

curl -I requests response headers using an HTTP HEAD request where supported; it does not deliver measuring network throughput between test endpoints, which is decisive in this scenario.

C:

nslookup performs DNS address and name queries against resolver infrastructure; the evidence calls for measuring network throughput between test endpoints, not merely this separate operation.

Question 93

A network engineer wants to check whether an IP responds to ICMP echo requests. Which utility provides that simple test?

  1. ping -c 4 192.0.2.20
  2. nc -vz server.example 443
  3. ethtool eth0
  4. iperf3

Explanation

Correct Answer

A:

ping sends ICMP echo probes and measures round-trip timing. Some hosts block ICMP even while application traffic works.

Incorrect Answers

B:

Netcat can attempt a TCP connection and report success or failure; the administrator instead needs probing basic ICMP echo reachability; this option serves a different purpose.

C:

ethtool reads link properties exposed by the Ethernet driver, including negotiated speed and duplex; it answers a neighboring question rather than probing basic ICMP echo reachability.

D:

iperf3 sends measurement traffic between endpoints and reports throughput metrics; that changes a different part of the system; the requested outcome is probing basic ICMP echo reachability.

Question 94

A server needs the interface's IPv6 address listed without printing IPv4 entries. Which invocation is appropriate?

  1. 127.0.0.1
  2. ip -6 addr show dev eth0
  3. Default route 0.0.0.0/0
  4. hostname

Explanation

Correct Answer

B:

The -6 flag restricts ip output to the IPv6 address family. It helps distinguish global, link-local and other IPv6 addresses on an interface.

Incorrect Answers

A:

The IPv4 loopback address accepts local-host connections but is not routed over the external network; it will not provide filtering interface addressing to IPv6 under these conditions.

C:

The default IPv4 route is a fallback used after more specific routes are considered; the requirement is filtering interface addressing to IPv6, outside the effect of this choice.

D:

hostname prints the host's current name as understood by the system; it does not deliver filtering interface addressing to IPv6, which is decisive in this scenario.

Question 95

A web service appears open, and a technician wants all local listening TCP sockets with their processes. Which command works?

  1. ip address show dev eth0
  2. ss -ltnp
  3. nc -vz server.example 443
  4. mtr destination.example

Explanation

Correct Answer

B:

ss lists kernel socket state; these options show listening numeric TCP endpoints and process associations when permitted. It does not query a remote server's firewall.

Incorrect Answers

A:

ip address displays interface addresses and prefixes from the kernel; the task involves finding local listening TCP sockets, whereas this addresses another subsystem.

C:

Netcat can attempt a TCP connection and report success or failure; that is not equivalent to finding local listening TCP sockets.

D:

mtr combines traceroute-style path discovery with repeated latency and packet-loss sampling; the administrator instead needs finding local listening TCP sockets; this option serves a different purpose.

Question 96

A service's HTTP headers must be inspected without downloading a full page body. Which command is suitable?

  1. nmap -sT host.example
  2. ip route show
  3. ping -c 4 192.0.2.20
  4. mtr destination.example
  5. curl -I https://example.org

Explanation

Correct Answer

E:

curl -I requests response headers using an HTTP HEAD request where supported. It does not inspect the route table or local sockets.

Incorrect Answers

A:

Nmap probes network ports and reports reachability and service hints; that changes a different part of the system; the requested outcome is retrieving HTTP response headers.

B:

ip route prints installed kernel routes and next-hop information; this does not achieve retrieving HTTP response headers on the system described.

C:

ping sends ICMP echo probes and measures round-trip timing; it will not provide retrieving HTTP response headers under these conditions.

D:

mtr combines traceroute-style path discovery with repeated latency and packet-loss sampling; using it would leave retrieving HTTP response headers unresolved.

Question 97

A host chooses the wrong next hop for internet traffic. Which command displays the routing table?

  1. tcpdump -i eth0 port 53 -w dns.pcap
  2. curl -I https://example.org
  3. ip route show
  4. ss -ltnp

Explanation

Correct Answer

C:

ip route prints installed kernel routes and next-hop information. It helps distinguish a gateway error from a name-resolution failure.

Incorrect Answers

A:

tcpdump captures packets matching a filter and can write them to a pcap file; it does not deliver inspecting kernel routing decisions, which is decisive in this scenario.

B:

curl -I requests response headers using an HTTP HEAD request where supported; the evidence calls for inspecting kernel routing decisions, not merely this separate operation.

D:

ss lists kernel socket state; these options show listening numeric TCP endpoints and process associations when permitted; its scope differs from inspecting kernel routing decisions, so it cannot meet the stated requirement.

Question 98

The host has multiple interfaces and the administrator must see which route Linux would select for 203.0.113.8. Which command shows the chosen path?

  1. ip route get 203.0.113.8
  2. Default route 0.0.0.0/0
  3. 127.0.0.1
  4. ip -6 addr show dev eth0

Explanation

Correct Answer

A:

ip route get resolves the kernel's forwarding decision for a destination, including preferred source and next hop. It is more targeted than dumping all routes.

Incorrect Answers

B:

The default IPv4 route is a fallback used after more specific routes are considered; it answers a neighboring question rather than resolving the route for one destination.

C:

The IPv4 loopback address accepts local-host connections but is not routed over the external network; that changes a different part of the system; the requested outcome is resolving the route for one destination.

D:

The -6 flag restricts ip output to the IPv6 address family; this does not achieve resolving the route for one destination on the system described.

Question 99

A newly installed network service should bind only to loopback so remote hosts cannot connect. Which listen address should be used?

  1. ip -6 addr show dev eth0
  2. ip route get 203.0.113.8
  3. 127.0.0.1
  4. ::1

Explanation

Correct Answer

C:

The IPv4 loopback address accepts local-host connections but is not routed over the external network. It is appropriate for a service intended only for local clients.

Incorrect Answers

A:

The -6 flag restricts ip output to the IPv6 address family; using it would leave restricting a listener to local IPv4 access unresolved.

B:

ip route get resolves the kernel's forwarding decision for a destination, including preferred source and next hop; the requirement is restricting a listener to local IPv4 access, outside the effect of this choice.

D:

The IPv6 loopback address is ::1/128 and remains entirely on the local machine; the evidence calls for restricting a listener to local IPv4 access, not merely this separate operation.

Question 100

A remote Ubuntu server uses Netplan, and an invalid change could disconnect SSH. Which command offers a rollback prompt?

  1. hosts: entry in /etc/nsswitch.conf
  2. netplan try
  3. /etc/resolv.conf
  4. /etc/hosts

Explanation

Correct Answer

B:

netplan try temporarily applies a candidate configuration and reverts it if not confirmed. This is safer for remote network changes than an unconditional apply.

Incorrect Answers

A:

Name Service Switch specifies the source order for lookups such as hosts and users; its scope differs from testing a netplan change with rollback, so it cannot meet the stated requirement.

C:

resolv.conf exposes resolver configuration, often generated by NetworkManager or systemd-resolved; the administrator instead needs testing a netplan change with rollback; this option serves a different purpose.

D:

The hosts file provides local name-to-address entries consulted according to NSS ordering; it answers a neighboring question rather than testing a netplan change with rollback.

CompTIA Linux+ (XK0-006) Practice Tests