No products in the cart.
CompTIA Linux+ Exam Questions
Page 8 of 25
141.
Which character encoding type can transform long Unicode values into 1-byte or 2-byte simplified codes?
-
UTF
-
YAML
-
PXE
-
ASCII
Correct answer: UTF
Unicode is an international character set standard that uses a 3-byte code. The Unicode Transformation Format (UTF) can transform long Unicode values into either 1-byte (UTC-80) or 2-byte (UTC-16) simplified codes. UTF-8 is considered the standard in English-speaking countries.
ASCII uses 7 bits to store characters found in the English language. YAML is a markup language. PXE is a boot standard that defines how systems can load from a central network server.
142.
Which command will print pi to five decimal places?
-
printf "%.5f\n" 3.14159265359
-
printf "%.5s\n" 3.14159265359
-
printf "%.5d\n" 3.14159265359
-
printf "%.5c\n" 3.14159265359
Correct answer: printf "%.5f\n" 3.14159265359
The printf command is used to format text. The %f format will display a floating point number.
The %s format displays a character string. The %d format displays a decimal integer. The %c format displays the first character.
143.
An administrator has a Linux system with two network interfaces. They want to configure it so that one interface will take over in case the other fails. Which bonding type should they use?
-
Active/passive
-
Aggregation
-
Load balancing
-
Multipath
Correct answer: Active/passive
Active/passive bonding has one active interface, while the other remains idle for backup. Once the bonding module has been added to the kernel, the ip utility can be used to configure the bonds.
Aggregation is a type of bonding where both interfaces appear as one to increase throughput. Load balancing shares the traffic between participating interfaces. Multipath is between a server and a client.
144.
What is referred to FIRST when resolving a hostname to an IP address by default?
-
/etc/hosts
-
DNS
-
/etc/resolv.conf
-
/etc/nsswitch.conf
Correct answer: /etc/hosts
The /etc/hosts file is checked first when resolving a hostname. Each host record is on one line of this file.
DNS is used if a host is not found in this file. The /etc/resolv.conf file holds information about DNS servers to use. The /etc/nsswitch file has the search order of network databases.
145.
Which option for the rsync command will backup recursively as well as keep properties like file permissions, ownership, and modification times?
-
a
-
z
-
P
-
e
Correct answer: a
The a option is for archiving. It is the same as using -rlptgoD for options.
The z option is for compressing. The P option shows partial progress. The e option specifies the shell.
146.
An administrator needs to securely transfer small files to a remote system. They do not need to worry about whether the files get interrupted and need to restart from where they left off. Which command would be BEST in this situation?
-
scp
-
rsync
-
sftp
-
ftp
Correct answer: scp
The scp command securely copies files. It has low overhead and cannot recover from failed transfers.
The sync and sftp commands are useful for large files that can stop and start transfers. The ftp command is not encrypted.
147.
An administrator is troubleshooting an issue in which a newly installed application is not found when they try to run it. They want to check which directories are searched when they type a command. Which command will show this information?
-
echo $PATH
-
echo $SHELL
-
echo $HOME
-
echo $TERM
Correct answer: echo $PATH
The $PATH variable shows which directories are searched for a program. This can be edited in the /etc/profile.d/ directory.
The $SHELL variable shows the name of the shell. The $HOME variable shows the user's home directory. The $TERM variable shows the terminal type for output.
148.
Which service synchronizes clocks across a network?
-
NTP
-
DHCP
-
DNS
-
NIS
Correct answer: NTP
The Network Time Protocol (NTP) allows clients to synchronize their clocks with a central server. The ntpd program accomplishes this by synchronizing a server with remote NTP servers on the internet.
The DHCP service allows for dynamic IP address allocation. The DNS service resolves domain names to IP addresses. The NIS service is a directory service that can be a repository for such things as user accounts and hostnames.
149.
An administrator wants to delete all files and folders in their current directory without being asked for confirmation of each deletion. Which command would accomplish this?
-
rm -rf *
-
rm -r *
-
rm -ri *
-
rm -d *
Correct answer: rm -rf *
The rm command removes files and directories. The -r option is recursive and the -f option forces deletion without confirmation.
The -i option makes the process interactive to confirm deletions. The -d option deletes empty directories.
150.
A system has slowed down and an administrator thinks it is because of excessive disk activity. Which command can they use to see statistics about how long the processor is waiting on disks?
-
iostat
-
du
-
df
-
fsck
Correct answer: iostat
The iostat command shows information about disk i/o. It can show either a static summary or usage over time.
The du command shows file space usage, including directories and subdirectories. The df command reports file system disk space usage. The fsck command checks a filesystem for errors.
151.
Which of the following can a packet-filtering firewall use to determine if packets should be accepted or rejected?
-
Port
-
Application
-
Content
-
Patterns
Correct answer: Port
A packet-filtering firewall can use source address, destination address, network protocol, inbound port, and outbound port.
More advanced firewalls, like stateful firewalls, can use detailed information and filter by application, content, behavior patterns, and more.
152.
In a SysV init system, which directory holds the executable initialization scripts for services?
-
/etc/init.d
-
/etc/systemd/system
-
/etc/rc.d
-
/usr/lib/systemd/system
Correct answer: /etc/init.d
For the SysV init system, /etc/init/d directory has scripts that are used when putting the system into different runlevels. The scripts can be passed commands such as start and stop to control the services.
The /etc/systemd/system folder holds configuration files for systemd initialization. The /etc/rc.d directory has subdirectories based on runlevels with symbolic links to scripts in /etc/init.d. The /usr/lib/systemd/system has configuration files for service units.
153.
Which line in a shell script declares a function?
-
my_function()
-
my_function[]
-
my_function$
-
my_function<>
Correct answer: my_function()
A function in a script has parentheses after the name. The parentheses can accept arguments.
The other answer choices will give errors.
154.
Which logic construct executes as long as a given statement is true?
-
while
-
for
-
until
-
case
Correct answer: while
The while loop will keep going as long as its given condition is true.
A for loop iterates through every element in a series. An until loop is the opposite of a while loop and iterates while the condition is false. A case statement evaluates a variable for specific values.
155.
What is the MAIN purpose of a hypervisor?
-
To host VMs
-
To monitor network traffic
-
To store data
-
To protect sensitive data
Correct answer: To host VMs
Hypervisors, also known as Virtual Machine Monitors (VMM), are used to host Virtual Machines (VMs). VMs are controlled by the hypervisor. The hypervisor provides a virtual environment of CPU time, memory space, and storage space for each VM, but it doesn't store the actual data itself. The primary job of the hypervisor is to host the virtual machines.
156.
Which command will end process 8276 gracefully by ending child processes before ending the parent process?
-
kill -15 8276
-
kill -9 8276
-
kill -2 8276
-
kill -1 8276
Correct answer: kill -15 8276
The kill command is used to end processes by their ID number, which can be found with the ps command. Signal 15, referred to as SIGTERM, is the default and will try to end child processes before the parent process.
Signal 9, referred to as SIGKILL, will force kill the parent process but not child processes. Signal 2, referred to as SIGINT, will send a CTRL-C key sequence to the process to cancel it. Signal 1, referred to as SIGHUP, will try to restart the process.
157.
An administrator needs to know which library files are required by an application. Which command will give them this information?
-
ldd
-
make
-
dpkg
-
dnf
Correct answer: ldd
The ldd command lists the required libraries of the program stated after the command. Using shared libraries makes it easier to write and distribute applications.
The make command is for compiling source code. The dpkg command is for managing packages on Debian-based systems. The dnf command is an updated version of the yum package management utility.
158.
Which key sequence will pause a process?
-
CTRL-Z
-
CTRL-C
-
CTRL-D
-
CTRL-S
Correct answer: CTRL-Z
The CTRL-Z key sequence will pause a process and put it in the background. It can be restarted from the point it was paused with the fg command.
You can use CTRL-C to interrupt a process. You can use CTRL-D to show that there is an end of input. The CTRL-S key sequence will lock up a terminal window.
159.
Which directory has the default unit files?
-
/usr/lib/systemd/system
-
/etc/systemd/system
-
/run/systemd/system
-
/var/run/systemd/system
Correct answer: /usr/lib/systemd/system
The default unit files are stored in /usr/lib/systemd/system. Unit files define how systemd manages the unit. Although the default files are stored in /usr/lib/systemd/system, the configurations are modified in /etc/systemd/system.
Any unit files in /etc/systemd/system override settings in any other directory. Runtime units are in /run/systemd/system. There are no units in /var/run/systemd/system.
160.
An administrator has a Linux system with multiple network interface cards. They want the network traffic to be equally distributed across each interface. Which type of bonding should they use with the interfaces?
-
Load balancing
-
Active/passive
-
Aggregation
-
Broadcast
Correct answer: Load balancing
Load balancing will share the traffic equally among participating interfaces. This is considered Mode 0 when defining bonds with the ip command.
Active/passive is for having one interface active while the other is idle in case it is needed as a backup. Aggregation increases throughput by having both interfaces use one connection. Broadcast is a mode that transmits all packets on each interface.