CompTIA XK0-006 Practice Test Questions and Exam Dumps Part 2: Q21–Q40

View Full CompTIA XK0-006 Exam Dumps and Practice Test Dumps.

 

Question 21

Which command is used to display the IP addresses assigned to Linux network interfaces?

  1. ip addr
  2. lsblk
  3. free
  4. passwd

Correct Answer: 1

Explanation

The ip addr command displays network interfaces and their assigned IP addresses. It is one of the main tools used on modern Linux systems for checking network configuration. An administrator can use it to verify whether an interface is up and whether it has the expected IPv4 or IPv6 address. lsblk is used for block devices, free displays memory information, and passwd manages passwords. Checking interface information is often an early step when troubleshooting network connectivity or configuration problems.

Question 22

Which command is commonly used to test whether another host is reachable over a network?

  1. ping
  2. chmod
  3. tar
  4. grep

Correct Answer: 1

Explanation

The ping command is commonly used to test basic network reachability between the local system and another host. It sends ICMP echo requests and checks whether responses are received. This can help determine whether a destination is reachable and whether there may be a basic network connectivity problem. However, a successful ping does not guarantee that a specific application or service is working. The other commands have different purposes: chmod changes permissions, tar manages archives, and grep searches text.

Question 23

Which command is commonly used to check the route that network traffic takes to a destination?

  1. traceroute
  2. passwd
  3. useradd
  4. mkdir

Correct Answer: 1

Explanation

The traceroute utility is used to identify the network hops between a Linux system and a destination. It can help administrators understand where packets may be delayed or where connectivity appears to fail. Depending on the Linux distribution, tracepath may also be available for similar troubleshooting. passwd manages passwords, useradd creates users, and mkdir creates directories. Route tracing is especially useful when a host can reach some destinations but consistently has problems reaching another network or service.

Question 24

Which file commonly contains local hostname-to-IP address mappings on Linux?

  1. /etc/hosts
  2. /etc/passwd
  3. /etc/fstab
  4. /etc/shadow

Correct Answer: 1

Explanation

The /etc/hosts file contains local hostname-to-IP address mappings. It can be used to resolve specific hostnames without depending on a DNS server. For example, an administrator can add an entry that maps an internal hostname to an IP address. /etc/passwd contains information about local user accounts, /etc/fstab contains filesystem mount information, and /etc/shadow stores protected password-related information. The hosts file can be useful during testing, troubleshooting, or when a small number of static hostname mappings are required.

Question 25

Which file is commonly used to define filesystems that should be mounted automatically at boot?

  1. /etc/fstab
  2. /etc/hosts
  3. /etc/profile
  4. /etc/shells

Correct Answer: 1

Explanation

The /etc/fstab file contains information about filesystems and how they should be mounted. Administrators can use it to configure local disks, partitions, network filesystems, and other storage resources for automatic mounting. Each entry can specify the device or UUID, mount point, filesystem type, and mount options. /etc/hosts manages local hostname mappings, /etc/profile contains shell environment settings, and /etc/shells lists valid login shells. Incorrect /etc/fstab entries can cause boot problems, so changes should be tested carefully.

Question 26

Which command can be used to view currently mounted filesystems?

  1. mount
  2. whoami
  3. uname
  4. passwd

Correct Answer: 1

Explanation

Running the mount command without arguments can display currently mounted filesystems and their mount points. This is useful when an administrator needs to verify whether a disk, partition, or network filesystem is currently mounted. It can also help identify the filesystem type and mount options being used. whoami displays the current username, uname provides system information, and passwd manages passwords. Checking mounted filesystems is an important troubleshooting step when applications cannot access expected storage locations.

Question 27

Which command is used to create a compressed archive using tar with gzip compression?

  1. tar -czf
  2. tar -xvf
  3. gzip -d
  4. cp -r

Correct Answer: 1

Explanation

The tar -czf command can create a tar archive while applying gzip compression. For example, tar -czf backup.tar.gz /data can create a compressed archive containing the specified data. The -c option creates an archive, -z enables gzip compression, and -f specifies the archive filename. The tar -xvf command is commonly used for extraction. gzip -d decompresses gzip data, while cp -r copies directories. Administrators frequently use archives for backups, transfers, and application deployments.

Question 28

Which command is commonly used to extract files from a .tar.gz archive?

  1. tar -xzf
  2. tar -czf
  3. mkdir -x
  4. gzip -c

Correct Answer: 1

Explanation

The tar -xzf command is commonly used to extract files from a gzip-compressed tar archive. The -x option tells tar to extract files, -z handles gzip compression, and -f specifies the archive file. For example, tar -xzf backup.tar.gz extracts the archive contents into the current directory. tar -czf creates a compressed archive rather than extracting one. Understanding archive commands is useful for Linux administrators because software, backups, configuration bundles, and application files are often distributed in compressed archive formats.

Question 29

Which command can display the last lines of a log file and continue showing new lines as they are added?

  1. tail -f
  2. head -f
  3. cat -r
  4. less -w

Correct Answer: 1

Explanation

The tail -f command displays the end of a file and continues watching it for new content. This is particularly useful for monitoring log files while an application or service is running. For example, an administrator can use tail -f /var/log/application.log while reproducing an application problem. New log entries can then appear immediately in the terminal. head is normally used to show the beginning of a file, while the other listed command combinations are not standard methods for following a growing log file.

Question 30

Which command is commonly used to search for files based on their name or other attributes?

  1. find
  2. echo
  3. history
  4. passwd

Correct Answer: 1

Explanation

The find command searches directories and can locate files based on conditions such as filename, type, size, ownership, and modification time. For example, find /var/log -name “*.log” can search for files ending in .log. This makes find very useful when administrators need to locate configuration files, large files, old files, or specific data during troubleshooting. echo displays text, history shows previously entered commands, and passwd manages passwords. Using appropriate find conditions can make file searches much more efficient.

Question 31

Which Linux command shows the commands previously entered by a user in the shell?

  1. history
  2. records
  3. commands
  4. logshow

Correct Answer: 1

Explanation

The history command displays commands that were previously entered in the shell. This can help administrators remember recently used commands or review actions performed during troubleshooting. The exact amount of history available depends on the shell configuration and history settings. Administrators should remember that shell history is not a complete security audit because commands may be omitted, cleared, or executed through other methods. Still, it can provide useful context when investigating recent configuration work or trying to reproduce an earlier administrative task.

Question 32

Which command can display the currently logged-in users on a Linux system?

  1. who
  2. where
  3. userset
  4. loginlist

Correct Answer: 1

Explanation

The who command displays information about users currently logged into the Linux system. It can show usernames, terminal sessions, login times, and sometimes the source of the session. This information can be useful when investigating unexpected activity or checking who is currently connected to a server. Other commands such as w can provide additional information about user activity and system load. The commands listed as where, userset, and loginlist are not standard Linux commands for displaying current login sessions.

Question 33

Which file contains basic information about local Linux user accounts?

  1. /etc/passwd
  2. /etc/hosts
  3. /etc/fstab
  4. /etc/resolv.conf

Correct Answer: 1

Explanation

The /etc/passwd file contains basic information about local Linux user accounts. Entries typically include the username, user ID, group ID, home directory, and login shell. Modern Linux systems generally store password hashes separately in /etc/shadow for better security. /etc/hosts contains local hostname mappings, /etc/fstab defines filesystem mount information, and /etc/resolv.conf contains DNS resolver configuration. Administrators may inspect /etc/passwd when troubleshooting account configuration, user IDs, login shells, or home-directory settings.

Question 34

Which command is used to add an existing user to a supplementary group?

  1. usermod -aG
  2. userdel -G
  3. groupdel -a
  4. passwd -G

Correct Answer: 1

Explanation

The usermod -aG command can add an existing user to a supplementary group. For example, usermod -aG developers alice adds alice to the developers group while preserving her existing supplementary group memberships. The -a option is important because it appends the group rather than replacing existing supplementary groups. Incorrectly omitting -a can remove previous group memberships. Group membership is useful for managing shared access to files, directories, devices, and applications without giving users unnecessary administrator privileges.

Question 35

Which command is commonly used to change a user’s password?

  1. passwd
  2. password
  3. usermodpass
  4. chpass

Correct Answer: 1

Explanation

The passwd command is used to change a Linux user’s password. A regular user can normally change their own password, while an administrator with appropriate privileges can change passwords for other users. Password management is an important part of account security because strong authentication helps protect systems from unauthorized access. The other commands listed are not standard Linux commands for normal password changes. Administrators should also consider password policies, account expiration, and other authentication controls when managing user accounts in production environments.

Question 36

Which Linux security mechanism controls access based on file owner, group, and permission bits?

  1. Traditional Unix permissions
  2. DNS
  3. DHCP
  4. NTP

Correct Answer: 1

Explanation

Traditional Unix permissions control access using three main categories: the file owner, the associated group, and other users. Each category can have read, write, and execute permissions. This basic access-control model is used throughout Linux and provides a simple way to protect files and directories. DNS resolves names, DHCP provides network configuration, and NTP synchronizes system time. Administrators should understand Unix permissions because incorrect permissions can expose sensitive information or prevent applications and users from accessing resources they legitimately need.

Question 37

Which service is commonly used to synchronize the system clock with network time sources?

  1. NTP
  2. FTP
  3. SMTP
  4. SMB

Correct Answer: 1

Explanation

NTP, or Network Time Protocol, is used to synchronize system clocks with reliable time sources over a network. Accurate time is important for Linux systems because logs, authentication systems, certificates, scheduled tasks, and security investigations often depend on correct timestamps. FTP is used for file transfer, SMTP is used for email delivery, and SMB is commonly used for file and printer sharing. Administrators should maintain accurate system time because incorrect timestamps can make troubleshooting and event correlation much more difficult.

Question 38

Which command can show real-time information about processes and system resource usage?

  1. top
  2. mkdir
  3. chmod
  4. hostname

Correct Answer: 1

Explanation

The top command provides a continuously updating view of running processes and system resource usage. It commonly displays CPU usage, memory usage, process IDs, and other useful information. Administrators can use it to identify processes consuming excessive CPU or memory and to investigate performance problems. mkdir creates directories, chmod changes permissions, and hostname displays or changes the system hostname. During performance troubleshooting, top can provide quick information about what is currently using system resources.

Question 39

Which command can be used to display the system’s hostname?

  1. hostname
  2. hostshow
  3. name
  4. systemname

Correct Answer: 1

Explanation

The hostname command displays the current hostname of a Linux system. The hostname identifies the system on a network and is often used by administrators when managing multiple servers. For example, knowing the hostname helps ensure that configuration changes or troubleshooting actions are being performed on the correct machine. Other commands listed are not standard Linux commands for this purpose. Administrators should verify the hostname when working remotely, especially when several servers have similar configurations or when connecting through SSH.

Question 40

What is the main purpose of using a package manager on a Linux system?

  1. To manage software installation, updates, and removal
  2. To replace the Linux kernel automatically
  3. To create user passwords
  4. To configure monitor brightness

Correct Answer: 1

Explanation

A Linux package manager is used to install, update, remove, and manage software packages. It also helps handle dependencies so that required supporting packages are installed when needed. Different Linux distributions use different package-management tools, such as APT on Debian-based systems and DNF on many Red Hat-based systems. Package managers also help administrators keep software updated with security fixes. Using the package manager is generally safer and easier than manually installing software because the system can track installed packages and their versions.