ExamGecko
Home / CompTIA / XK0-005 / List of questions
Ask Question

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

Add to Whishlist

List of questions

Question 11

Report Export Collapse

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?

ls | cpio -iv > cloud.epio
ls | cpio -iv > cloud.epio
ls | cpio -iv < cloud.epio
ls | cpio -iv < cloud.epio
ls | cpio -ov > cloud.cpio
ls | cpio -ov > cloud.cpio
ls cpio -ov < cloud.cpio
ls cpio -ov < cloud.cpio
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.

asked 02/10/2024
Avion Bryant
49 questions

Question 12

Report Export Collapse

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?

source ~/.bashrc
source ~/.bashrc
read ~/.bashrc
read ~/.bashrc
touch ~/.bashrc
touch ~/.bashrc
echo ~/.bashrc
echo ~/.bashrc
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.

asked 02/10/2024
Arkadiusz Skopinski
48 questions

Question 13

Report Export Collapse

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?

id_dsa.pem
id_dsa.pem
id_rsa
id_rsa
id_ecdsa
id_ecdsa
id_rsa.pub
id_rsa.pub
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.

asked 02/10/2024
Duc Hai
46 questions

Question 14

Report Export Collapse

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?

rpm -qa | grep kernel; uname -a
rpm -qa | grep kernel; uname -a
yum -y update; shutdown -r now
yum -y update; shutdown -r now
cat /etc/centos-release; rpm -Uvh --nodeps
cat /etc/centos-release; rpm -Uvh --nodeps
telinit 1; restorecon -Rv /boot
telinit 1; restorecon -Rv /boot
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.

asked 02/10/2024
Christian Galea
45 questions

Question 15

Report Export Collapse

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?

/etc/host.conf
/etc/host.conf
/etc/hostname
/etc/hostname
/etc/services
/etc/services
/etc/ssh/sshd_config
/etc/ssh/sshd_config
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.

asked 02/10/2024
Borja Arranz Palenzuela
47 questions

Question 16

Report Export Collapse

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?

git reflog
git reflog
git pull
git pull
git status
git status
git push
git push
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.

asked 02/10/2024
himanshu deshpande
43 questions

Question 17

Report Export Collapse

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?

iptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128
iptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128
iptables -t nat -A PREROUTING -p top --dport 81 -j DNAT --to-destination 192.0.2.25:3129
iptables -t nat -A PREROUTING -p top --dport 81 -j DNAT --to-destination 192.0.2.25:3129
iptables -t nat -I PREROUTING -p top --sport 80 -j DNAT --to-destination 192.0.2.25:3129
iptables -t nat -I PREROUTING -p top --sport 80 -j DNAT --to-destination 192.0.2.25:3129
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.0.2.25:3128
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.0.2.25:3128
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.

asked 02/10/2024
EDMARCIO S BRITO
30 questions

Question 18

Report Export Collapse

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?

route -i etho -p add 10.0.213.5 10.0.5.1
route -i etho -p add 10.0.213.5 10.0.5.1
route modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
route modify eth0 +ipv4.routes "10.0.213.5/32 10.0.5.1"
echo "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
echo "10.0.213.5 10.0.5.1 eth0" > /proc/net/route
ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0
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.

asked 02/10/2024
Marcel Engelbrecht
48 questions

Question 19

Report Export Collapse

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

CompTIA XK0-005 image Question 19 99660 10022024175436000000

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

if [ -f "$filename" ]; then
if [ -f "$filename" ]; then
if [ -d "$filename" ]; then
if [ -d "$filename" ]; then
if [ -f "$filename" ] then
if [ -f "$filename" ] then
if [ -f "$filename" ]; while
if [ -f "$filename" ]; while
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.

asked 02/10/2024
Dimitri Bennett
40 questions

Question 20

Report Export Collapse

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

CompTIA XK0-005 image Question 20 99661 10022024175436000000

Which of the following technologies is the administrator using?

Ansible
Ansible
Puppet
Puppet
Chef
Chef
Terraform
Terraform
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.

asked 02/10/2024
Ivan Dujmic
55 questions
Total 407 questions
Go to page: of 41
Search

Related questions