ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











A systems administrator checked out the code from the repository, created a new branch, made changes to the code, and then updated the main branch. The systems administrator wants to ensure that the Terraform state files do not appear in the main branch. Which of following should the administrator use to meet this requirement?

A.
clone
A.
clone
Answers
B.
gitxgnore
B.
gitxgnore
Answers
C.
get
C.
get
Answers
D.
.ssh
D.
.ssh
Answers
Suggested answer: B

Explanation:

To prevent certain files from being tracked by Git, the administrator can use a.gitignorefile (B) in the repository. The.gitignorefile can specify patterns of files or directories that Git should ignore. This way, the Terraform state files will not appear in the main branch or any other branch. The other commands are not related to this requirement.Reference:

[CompTIA Linux+ Study Guide], Chapter 10: Working with Git, Section: Ignoring Files with .gitignore

[How to Use .gitignore File]

A junior administrator updated the PostgreSQL service unit file per the data-base administrator's recommendation. The service has been restarted, but changes have not been applied. Which of the following should the administrator run for the changes to take effect?

A.
Systemct1 get---default
A.
Systemct1 get---default
Answers
B.
systemct1 daemon---reload
B.
systemct1 daemon---reload
Answers
C.
systemct1 enable postgresq1
C.
systemct1 enable postgresq1
Answers
D.
systemct1 mask postgresq1
D.
systemct1 mask postgresq1
Answers
Suggested answer: B

Explanation:

To apply changes to a systemd service unit file, the administrator needs to reload the systemd daemon using the commandsystemct1 daemon-reload(B). This will make systemd aware of the new or changed unit files. The other commands will not reload the systemd daemon or apply the changes.Reference:

[CompTIA Linux+ Study Guide], Chapter 7: Managing System Services, Section: Modifying Systemd Services

[How to Reload Systemd Services]

A developer needs to launch an Nginx image container, name it Web001, and ex-pose port 8080 externally while mapping to port 80 inside the container. Which of the following commands will accomplish this task?

A.
docker exec ---it -p 8080: 80 ------name Web001 nginx
A.
docker exec ---it -p 8080: 80 ------name Web001 nginx
Answers
B.
docker load -it -p 8080:80 ------name Web001 nginx
B.
docker load -it -p 8080:80 ------name Web001 nginx
Answers
C.
docker run -it -P 8080:80 ------name Web001 nginx
C.
docker run -it -P 8080:80 ------name Web001 nginx
Answers
D.
docker pull -it -p 8080:80 ---name Web00l nginx
D.
docker pull -it -p 8080:80 ---name Web00l nginx
Answers
Suggested answer: C

Explanation:

To launch an Nginx image container, name it Web001, and expose port 8080 externally while mapping to port 80 inside the container, the administrator can use the commanddocker run -it -p 8080:80 --name Web001 nginx. This will create and start a new container from the Nginx image, assign it a name of Web001, and map port 8080 on the host to port 80 on the container. The other commands are not valid or do not meet the requirements.Reference:

[CompTIA Linux+ Study Guide], Chapter 11: Working with Containers, Section: Running Containers with Docker

[How to Run Docker Containers]

A junior developer is unable to access an application server and receives the following output:

The systems administrator investigates the issue and receives the following output:

Which of the following commands will help unlock the account?

A.
Pam_tally2 --user=dev2 ----quiet
A.
Pam_tally2 --user=dev2 ----quiet
Answers
B.
pam_ tally2 --user=dev2
B.
pam_ tally2 --user=dev2
Answers
C.
pam_tally2 ---user+dev2 ----quiet
C.
pam_tally2 ---user+dev2 ----quiet
Answers
D.
pam_tally2 --user=dev2 ----reset
D.
pam_tally2 --user=dev2 ----reset
Answers
Suggested answer: D

Explanation:

To unlock an account that has been locked due to login failures, the administrator can use the commandpam_tally2 --user=dev2 --reset(D). This will reset the failure counter for the user ''dev2'' and allow the user to log in again. The other commands will not unlock the account, but either display or increase the failure count.Reference:

[CompTIA Linux+ Study Guide], Chapter 4: Managing Users and Groups, Section: Locking Accounts with pam_tally2

[How to Lock and Unlock User Account in Linux]

A systems administrator wants to delete app . conf from a Git repository. Which of the following commands will delete the file?

A.
git tag app. conf
A.
git tag app. conf
Answers
B.
git commit app . conf
B.
git commit app . conf
Answers
C.
git checkout app . conf
C.
git checkout app . conf
Answers
D.
git rm app. conf
D.
git rm app. conf
Answers
Suggested answer: D

Explanation:

To delete a file from a Git repository, the administrator can use the commandgit rm app.conf(D). This will remove the file ''app.conf'' from the working directory and stage it for deletion from the repository. The administrator can then commit the change withgit commit -m 'Delete app.conf'to finalize the deletion. The other commands will not delete the file, but either tag, commit, or checkout the file.Reference:

[CompTIA Linux+ Study Guide], Chapter 10: Working with Git, Section: Deleting Files with Git

[How to Delete Files from Git]

A senior Linux administrator has created several scripts that will be used to install common system applications. These scripts are published to a reposito-ry to share with the systems team. A junior Linux administrator needs to re-trieve the scripts and make them available on a local workstation. Which of the following Git commands should the junior Linux administrator use to accom-plish this task?

A.
fetch
A.
fetch
Answers
B.
checkout
B.
checkout
Answers
C.
clone
C.
clone
Answers
D.
branch
D.
branch
Answers
Suggested answer: C

Explanation:

To retrieve the scripts from a repository and make them available on a local workstation, the junior Linux administrator can use the commandgit clone. This will create a copy of the repository on the local machine, including all the scripts and history. The other commands will not clone the repository, but either fetch, checkout, or branch from an existing repository.Reference:

[CompTIA Linux+ Study Guide], Chapter 10: Working with Git, Section: Cloning Repositories with Git

[How to Clone a Git Repository]

A DevOps engineer wants to allow the same Kubernetes container configurations to be deployed in development, testing, and production environments. A key requirement is that the containers should be configured so that developers do not have to statically configure custom, environment-specific locations. Which of the following should the engineer use to meet this requirement?

A.
Custom scheduler
A.
Custom scheduler
Answers
B.
Node affinity
B.
Node affinity
Answers
C.
Overlay network
C.
Overlay network
Answers
D.
Ambassador container
D.
Ambassador container
Answers
Suggested answer: D

Explanation:

To allow the same Kubernetes container configurations to be deployed in different environments without statically configuring custom locations, the engineer can use an ambassador container (D). An ambassador container is a proxy container that handles communication between containers and external services. It can dynamically configure locations based on environment variables or other methods. The other options are not related to this requirement.Reference:

[CompTIA Linux+ Study Guide], Chapter 11: Working with Containers, Section: Using Ambassador Containers

[How to Use Ambassador Containers]

A non-privileged user is attempting to use commands that require elevated account permissions, but the commands are not successful. Which of the following most likely needs to be updated?

A.
/etc/passwd
A.
/etc/passwd
Answers
B.
/etc/shadow
B.
/etc/shadow
Answers
C.
/etc/sudoers
C.
/etc/sudoers
Answers
D.
/etc/bashrc
D.
/etc/bashrc
Answers
Suggested answer: C

Explanation:

The /etc/sudoers file is used to configure the sudo command, which allows non-privileged users to execute commands that require elevated account permissions1. The file contains a list of users and groups that are allowed to use sudo, and the commands they can run with it. The file also defines the security policy for sudo, such as whether a password is required, how long the sudo session lasts, and what environment variables are preserved or reset.

The /etc/passwd file is used to store information about the user accounts on the system, such as their username, user ID, home directory, and login shell. The /etc/shadow file is used to store the encrypted passwords for the user accounts, along with other information such as password expiration and aging. These files are not directly related to the sudo command, and updating them will not grant a user elevated account permissions.

The /etc/bashrc file is used to set up the environment for the bash shell, such as aliases, functions, variables, and options. This file is executed whenever a new bash shell is started, and it affects all users on the system. However, this file does not control the sudo command or its configuration, and updating it will not allow a user to use commands that require elevated account permissions.

An application developer received a file with the following content:

##This is a sample Image ##

FROM ubuntu:18.04

MAINTAINER [email protected]

COPY . /app

RUN make /app

CMD python /app/app.py

RUN apt-get update

RUN apt-get install -y nginx

CMD ['echo','Image created']

The developer must use this information to create a test bed environment and identify the image (myimage) as the first version for testing a new application before moving it to production. Which of the following commands will accomplish this task?

A.
docker build -t myimage:1.0 .
A.
docker build -t myimage:1.0 .
Answers
B.
docker build -t myimage: .
B.
docker build -t myimage: .
Answers
C.
docker build -t myimage-1.0 .
C.
docker build -t myimage-1.0 .
Answers
D.
docker build -i myimage:1.0 .
D.
docker build -i myimage:1.0 .
Answers
Suggested answer: A

Explanation:

The docker build command is used to build an image from a Dockerfile and a context1.The Dockerfile is a text file that contains the instructions for creating the image, and the context is a set of files that can be used in the image creation process1. The file that the developer received is an example of a Dockerfile.

The -t option is used to specify a name and an optional tag for the image1.The name and tag are separated by a colon (:), and the tag is usually used to indicate the version of the image2. For example, -t myimage:1.0 means that the image will be named myimage and tagged as 1.0.

The last argument of the docker build command is the path to the context, which can be a local directory or a URL1.The dot (.) means that the current working directory is the context2. Therefore, docker build -t myimage:1.0 . means that the image will be built from the Dockerfile and the files in the current working directory, and it will be named myimage and tagged as 1.0.

An administrator thinks that a package was installed using a snap. Which of the following commands can the administrator use to verify this information?

A.
snap list
A.
snap list
Answers
B.
snap find
B.
snap find
Answers
C.
snap install
C.
snap install
Answers
D.
snap try
D.
snap try
Answers
Suggested answer: A

Explanation:

The snap list command is used to display the installed snaps on the system1.Snaps are self-contained software packages that can be installed and updated across different Linux distributions2.The snap list command shows the name, version, revision, developer and notes of each snap1.

The snap find command is used to search for snaps in the Snap Store, which is an online repository of snaps2.The snap install command is used to install snaps from the Snap Store or from a local file2.The snap try command is used to test a snap without installing it, by mounting a directory that contains the snap files2. These commands are not useful for verifying if a package was installed using a snap.

Total 371 questions
Go to page: of 38