ExamGecko
Home Home / CompTIA / XK0-005

CompTIA XK0-005 Practice Test - Questions Answers, Page 2

Question list
Search
Search

List of questions

Search

Related questions











A Linux administrator needs to create a new cloud.cpio archive containing all the files from the current directory. Which of the following commands can help to accomplish this task?

A.
ls | cpio -iv > cloud.epio
A.
ls | cpio -iv > cloud.epio
Answers
B.
ls | cpio -iv < cloud.epio
B.
ls | cpio -iv < cloud.epio
Answers
C.
ls | cpio -ov > cloud.cpio
C.
ls | cpio -ov > cloud.cpio
Answers
D.
ls cpio -ov < cloud.cpio
D.
ls cpio -ov < cloud.cpio
Answers
Suggested answer: C

Explanation:

The command ls | cpio -ov > cloud.cpio can help to create a new cloud.cpio archive containing all the files from the current directory. The ls command lists the files in the current directory and outputs them to the standard output. The | operator pipes the output to the next command.

The cpio command is a tool for creating and extracting compressed archives. The -o option creates a new archive and the -v option shows the verbose output. The > operator redirects the output to the cloud.cpio file. This command will create a new cloud.cpio archive with all the files from the current directory. The other options are incorrect because they either use the wrong options (-i instead of -o), the wrong arguments (cloud.epio instead of cloud.cpio), or the wrong syntax (< instead of > or missing |). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 351.

A systems administrator made some changes in the ~/.bashrc file and added an alias command.

When the administrator tried to use the alias command, it did not work. Which of the following should be executed FIRST?

A.
source ~/.bashrc
A.
source ~/.bashrc
Answers
B.
read ~/.bashrc
B.
read ~/.bashrc
Answers
C.
touch ~/.bashrc
C.
touch ~/.bashrc
Answers
D.
echo ~/.bashrc
D.
echo ~/.bashrc
Answers
Suggested answer: A

Explanation:

The command source ~/.bashrc should be executed first to use the alias command.

The source command reads and executes commands from a file in the current shell environment.

The ~/.bashrc file is a configuration file that contains commands and aliases that are executed when a new bash shell is started. The administrator made some changes in the ~/.bashrc file and added an alias command, but the changes are not effective until the file is sourced or a new shell is started.

The command source ~/.bashrc will reload the file and make the alias command available. The other options are incorrect because they either do not execute the commands in the file (read, touch, or echo) or do not affect the current shell environment (read or echo). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 9: Working with the Linux Shell, page 295.

A junior systems administrator has just generated public and private authentication keys for passwordless login. Which of the following files will be moved to the remote servers?

A.
id_dsa.pem
A.
id_dsa.pem
Answers
B.
id_rsa
B.
id_rsa
Answers
C.
id_ecdsa
C.
id_ecdsa
Answers
D.
id_rsa.pub
D.
id_rsa.pub
Answers
Suggested answer: D

Explanation:

The file id_rsa.pub will be moved to the remote servers for passwordless login. The id_rsa.pub file is the public authentication key that is generated by the ssh-keygen command. The public key can be copied to the remote servers by using the ssh-copy-id command or manually. The remote servers will use the public key to authenticate the user who has the corresponding private key (id_rsa). This will allow the user to log in without entering a password. The other options are incorrect because they are either private keys (id_rsa, id_dsa.pem, or id_ecdsa) or non-existent files (id_dsa.pem or id_ecdsa). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, page 410.

An administrator accidentally deleted the /boot/vmlinuz file and must resolve the issue before the server is rebooted. Which of the following commands should the administrator use to identify the correct version of this file?

A.
rpm -qa | grep kernel; uname -a
A.
rpm -qa | grep kernel; uname -a
Answers
B.
yum -y update; shutdown -r now
B.
yum -y update; shutdown -r now
Answers
C.
cat /etc/centos-release; rpm -Uvh --nodeps
C.
cat /etc/centos-release; rpm -Uvh --nodeps
Answers
D.
telinit 1; restorecon -Rv /boot
D.
telinit 1; restorecon -Rv /boot
Answers
Suggested answer: A

Explanation:

The command rpm -qa | grep kernel lists all the installed kernel packages, and the command uname -a displays the current kernel version. These commands can help the administrator identify the correct version of the /boot/vmlinuz file, which is the kernel image file. The other options are not relevant or helpful for this task. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 8: Managing the Linux Boot Process, page 267.

A cloud engineer needs to change the secure remote login port from 22 to 49000. Which of the following files should the engineer modify to change the port number to the desired value?

A.
/etc/host.conf
A.
/etc/host.conf
Answers
B.
/etc/hostname
B.
/etc/hostname
Answers
C.
/etc/services
C.
/etc/services
Answers
D.
/etc/ssh/sshd_config
D.
/etc/ssh/sshd_config
Answers
Suggested answer: D

Explanation:

The file /etc/ssh/sshd_config contains the configuration settings for the SSH daemon, which handles the secure remote login. To change the port number, the engineer should edit this file and modify the line that says Port 22 to Port 49000. The other files are not related to the SSH service. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, page 411.

A new file was added to a main Git repository. An administrator wants to synchronize a local copy with the contents of the main repository. Which of the following commands should the administrator use for this task?

A.
git reflog
A.
git reflog
Answers
B.
git pull
B.
git pull
Answers
C.
git status
C.
git status
Answers
D.
git push
D.
git push
Answers
Suggested answer: B

Explanation:

The command iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.0.2.25:3128 adds a rule to the nat table that redirects all incoming TCP packets with destination port 80 (HTTP) to the proxy server 192.0.2.25 on port 3128. This is the correct way to achieve the task. The other options are incorrect because they either delete a rule (-D), use the wrong protocol (top instead of tcp), or use the wrong port (81 instead of 80). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 381.

A Linux administrator needs to redirect all HTTP traffic temporarily to the new proxy server 192.0.2.25 on port 3128. Which of the following commands will accomplish this task?

A.
iptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128
A.
iptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128
Answers
B.
iptables -t nat -A PREROUTING -p top --dport 81 -j DNAT --to-destination 192.0.2.25:3129
B.
iptables -t nat -A PREROUTING -p top --dport 81 -j DNAT --to-destination 192.0.2.25:3129
Answers
C.
iptables -t nat -I PREROUTING -p top --sport 80 -j DNAT --to-destination 192.0.2.25:3129
C.
iptables -t nat -I PREROUTING -p top --sport 80 -j DNAT --to-destination 192.0.2.25:3129
Answers
D.
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.0.2.25:3128
D.
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.0.2.25:3128
Answers
Suggested answer: D

Explanation:

The command iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.0.2.25:3128 adds a rule to the nat table that redirects all incoming TCP packets with destination port 80 (HTTP) to the proxy server 192.0.2.25 on port 3128. This is the correct way to achieve the task. The other options are incorrect because they either delete a rule (-D), use the wrong protocol (top instead of tcp), or use the wrong port (81 instead of 80). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 381.

Developers have requested implementation of a persistent, static route on the application server.

Packets sent over the interface eth0 to 10.0.213.5/32 should be routed via 10.0.5.1. Which of the following commands should the administrator run to achieve this goal?

A.
route -i etho -p add 10.0.213.5 10.0.5.1
A.
route -i etho -p add 10.0.213.5 10.0.5.1
Answers
B.
route modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
B.
route modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
Answers
C.
echo "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
C.
echo "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
Answers
D.
ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
D.
ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
Answers
Suggested answer: D

Explanation:

The command ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0 adds a static route to the routing table that sends packets destined for 10.0.213.5/32 (a single host) through the gateway 10.0.5.1 on the interface eth0. This is the correct way to achieve the goal. The other options are incorrect because they either use the wrong syntax (route -i etho -p add), the wrong command (route modify), or the wrong file (/proc/net/route). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 379.

A user is asking the systems administrator for assistance with writing a script to verify whether a file exists. Given the following:

Which of the following commands should replace the <CONDITIONAL> string?

A.
if [ -f "$filename" ]; then
A.
if [ -f "$filename" ]; then
Answers
B.
if [ -d "$filename" ]; then
B.
if [ -d "$filename" ]; then
Answers
C.
if [ -f "$filename" ] then
C.
if [ -f "$filename" ] then
Answers
D.
if [ -f "$filename" ]; while
D.
if [ -f "$filename" ]; while
Answers
Suggested answer: A

Explanation:

The command if [ -f "$filename" ]; then checks if the variable $filename refers to a regular file that exists. The -f option is used to test for files. If the condition is true, the commands after then are executed. This is the correct way to replace the <CONDITIONAL> string. The other options are incorrect because they either use the wrong option (-d tests for directories), the wrong syntax (missing a semicolon after the condition), or the wrong keyword (while is used for loops, not conditions). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 16: Writing and Executing Bash Shell Scripts, page 493.

A systems administrator is deploying three identical, cloud-based servers. The administrator is using the following code to complete the task:

Which of the following technologies is the administrator using?

A.
Ansible
A.
Ansible
Answers
B.
Puppet
B.
Puppet
Answers
C.
Chef
C.
Chef
Answers
D.
Terraform
D.
Terraform
Answers
Suggested answer: D

Explanation:

The code snippet is written in Terraform language, which is a tool for building, changing, and versioning infrastructure as code. Terraform uses a declarative syntax to describe the desired state of the infrastructure and applies the changes accordingly. The code defines a resource of type aws_instance, which creates an AWS EC2 instance, and sets the attributes such as the AMI ID, instance type, security group IDs, and key name. The code also uses a count parameter to create three identical instances and assigns them different names using the count.index variable. This is the correct technology that the administrator is using. The other options are incorrect because they use different languages and syntaxes for infrastructure as code. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Cloud and Virtualization Technologies, page 559.

Total 371 questions
Go to page: of 38