ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











A security analyst is monitoring the network to identify latency or slowdowns during a vulnerability scan.

bash

function x() {

info=$(ping -c 1 $1 | awk -F '/' 'END {print $5}')

echo '$1 | $info'

}

Which of the following functions will best achieve this?

A.

function x() { info=$(dig $(dig -x $1 | grep ptr | tail -n 1 | awk -F '.in-addr' '{print $1}').origin.asn.cymru.com TXT +short); echo '$1 | $info' }

A.

function x() { info=$(dig $(dig -x $1 | grep ptr | tail -n 1 | awk -F '.in-addr' '{print $1}').origin.asn.cymru.com TXT +short); echo '$1 | $info' }

Answers
B.

function x() { info=$(ping -c 1 $1 | awk -F '/' 'END {print $5}'); echo '$1 | $info' }

B.

function x() { info=$(ping -c 1 $1 | awk -F '/' 'END {print $5}'); echo '$1 | $info' }

Answers
C.

function x() { info=$(nc -m 40 $1 | awk 'END {print $1}'); echo '$1 | $info' }

C.

function x() { info=$(nc -m 40 $1 | awk 'END {print $1}'); echo '$1 | $info' }

Answers
D.

function x() { info=$(geoiplookup $1); echo '$1 | $info' }

D.

function x() { info=$(geoiplookup $1); echo '$1 | $info' }

Answers
Suggested answer: B

Explanation:

The ping command is used to measure network latency. The function provided uses ping -c 1 to ping the target once and extracts the average round-trip time using awk. This is a simple and effective way to monitor network latency during a scan or other network activity.

A Linux administrator needs to remove all local firewall rules on a Linux system. Which of the following commands should the administrator run?

A.

iptables -D

A.

iptables -D

Answers
B.

iptables -L

B.

iptables -L

Answers
C.

iptables -F

C.

iptables -F

Answers
D.

iptables -A

D.

iptables -A

Answers
Suggested answer: C

Explanation:

The iptables -F command flushes all the firewall rules, effectively removing them from the system. This command clears out all existing rules from all chains (INPUT, OUTPUT, and FORWARD), leaving the system with no active iptables rules.

Which of the following will prevent non-root SSH access to a Linux server?

A.

Creating the /etc/nologin file

A.

Creating the /etc/nologin file

Answers
B.

Creating the /etc/nologin.allow file containing only a single line root

B.

Creating the /etc/nologin.allow file containing only a single line root

Answers
C.

Creating the /etc/nologin/login.deny file containing a single line -all

C.

Creating the /etc/nologin/login.deny file containing a single line -all

Answers
D.

Ensuring that /etc/pam.d/sshd includes account sufficient pam_nologin.so

D.

Ensuring that /etc/pam.d/sshd includes account sufficient pam_nologin.so

Answers
Suggested answer: A

Explanation:

The presence of the /etc/nologin file prevents non-root users from logging into the system via SSH or any other login method. Only the root user can log in when this file exists. This file is commonly used to temporarily disable user logins during system maintenance.

A systems administrator is gathering information about a file type and the contents of a file. Which of the following commands should the administrator use to accomplish this task?

A.

file filename

A.

file filename

Answers
B.

touch filename

B.

touch filename

Answers
C.

grep filename

C.

grep filename

Answers
D.

lsof filename

D.

lsof filename

Answers
Suggested answer: A

Explanation:

The file command determines the file type of the given file (e.g., whether it is a text file, binary, or a special format). It helps identify the format of the file before further actions like editing or analyzing its content. For example, running file filename might return 'ASCII text' or 'ELF 64-bit executable'.

A Linux administrator is implementing a stateful firewall on the Linux server. Which of the following iptables options will be required to build the stateful rules? (Select two).

A.

--name established

A.

--name established

Answers
B.

-m recent

B.

-m recent

Answers
C.

-m conntrack

C.

-m conntrack

Answers
D.

--state

D.

--state

Answers
E.

--remove

E.

--remove

Answers
F.

-j DROP

F.

-j DROP

Answers
Suggested answer: C, D

Explanation:

To build stateful firewall rules in iptables, the -m conntrack and --state options are used. The -m conntrack module allows for connection tracking, and --state tracks connection states like ESTABLISHED, RELATED, or NEW, ensuring that the firewall maintains awareness of connection states when filtering traffic. These options are critical for implementing a stateful firewall that tracks and manages active connections.

An administrator is troubleshooting a database service outage that was reported by a monitoring system. Given the following output:

$ systemctl status mariadb

Oct 20 16:40:45 comptia systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL

Oct 20 16:40:45 comptia systemd[1]: mariadb.service: Failed with result 'signal'.

Oct 20 16:40:50 comptia systemd[1]: Stopped MariaDB 10.3 database server.

$ dmesg

[ 1061.491433] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom, task_memcg=/system.slice/mariadb.service, task=mysqld,pid=1981,uid=27

[ 1061.491453] Out of memory: Killed process 1981 (mysqld) total-vm:330668kB, anon-rss:31316kB, file-rss:OkB, shmem-rss:OkB, UID:27 pgtables:324kB oom_score_adj:0

Which of the following is the reason for the outage?

A.

The administrator sent a kill signal to the database

A.

The administrator sent a kill signal to the database

Answers
B.

The server is missing the DMA bus

B.

The server is missing the DMA bus

Answers
C.

The database cannot write anything else to the storage

C.

The database cannot write anything else to the storage

Answers
D.

The server does not have enough physical memory

D.

The server does not have enough physical memory

Answers
Suggested answer: D

Explanation:

The oom-killer was invoked because the system ran out of memory, and as a result, it killed the mysqld process to free memory. This is a clear indication that the server did not have enough physical memory to run the MariaDB service, leading to the process being terminated.

A DevOps engineer pushed the updated configuration to an existing branch of a remote Git repository. Which of the following commands should the Linux administrator use to obtain these configuration changes?

A.

git pull

A.

git pull

Answers
B.

git log

B.

git log

Answers
C.

git fetch

C.

git fetch

Answers
D.

git checkout main

D.

git checkout main

Answers
Suggested answer: A

Explanation:

The git pull command fetches changes from the remote repository and merges them into the current branch. This is the correct command for obtaining the updated configuration that was pushed to the remote repository.

The MySQL database process that was running on a Linux server suddenly stopped, and the process was killed. Which of the following commands can help identify whether this issue was produced by the OOM killer?

A.

grep /proc/oom_score

A.

grep /proc/oom_score

Answers
B.

grep -ir 'out of memory' /var/log

B.

grep -ir 'out of memory' /var/log

Answers
C.

cat /var/run/initramfs/overlayroot.log | grep 'out of memory'

C.

cat /var/run/initramfs/overlayroot.log | grep 'out of memory'

Answers
D.

cat /sys/block/loop0/events

D.

cat /sys/block/loop0/events

Answers
Suggested answer: B

Explanation:

The grep -ir 'out of memory' /var/log command searches through log files in /var/log for any instances of 'out of memory' errors, which indicate that the oom-killer terminated processes due to insufficient memory. This is the quickest way to determine if the oom-killer caused the MySQL process to be killed.

After trying to install an RPM package unsuccessfully, a systems administrator verifies the integrity of the package's database. The administrator discovers that the database is corrupted and needs to be recreated. Which of the following commands will help accomplish this task?

A.

rpmdb -D rebuild

A.

rpmdb -D rebuild

Answers
B.

rpmdb --initdb

B.

rpmdb --initdb

Answers
C.

rpmdb --rebuilddb

C.

rpmdb --rebuilddb

Answers
D.

rpmdb --exportdb

D.

rpmdb --exportdb

Answers
Suggested answer: C

Explanation:

The RPM database can sometimes become corrupted, which prevents package installations and other RPM operations from functioning correctly. The --rebuilddb option for rpmdb is used to rebuild the database. This command regenerates the database, fixing any corruption issues and ensuring that the package metadata is restored to a usable state.

A Linux administrator logs in to a system and identifies that an important backup has been started. The backup process is consuming a considerable amount of CPU time but needs to continue. Which of the following should the administrator use to reduce the impact this process has on other services?

A.

renice -n 15 -p <backup pid>

A.

renice -n 15 -p <backup pid>

Answers
B.

nice -n 15 -p <backup pid>

B.

nice -n 15 -p <backup pid>

Answers
C.

renice -n -15 -p <backup pid>

C.

renice -n -15 -p <backup pid>

Answers
D.

nice -n -15 -p <backup pid>

D.

nice -n -15 -p <backup pid>

Answers
Suggested answer: A

Explanation:

The renice command changes the scheduling priority of a running process. By using renice -n 15, the administrator lowers the priority of the backup process, making it less CPU-intensive and reducing its impact on other system services. A positive niceness value (e.g., 15) lowers the priority, allowing other processes to receive more CPU time.

Total 371 questions
Go to page: of 38