Courseiva
Knowledge + Practice
CertificationsVendorsCareer RoadmapsLabs & ToolsStudy GuidesGlossaryPractice Questions
C
Courseiva

Free IT certification practice questions with explained answers for CCNA, CompTIA, AWS, Azure, Google Cloud, and more.

Certification Practice Questions

CCNA practice questionsSecurity+ SY0-701 practice questionsAWS SAA-C03 practice questionsAZ-104 practice questionsAZ-900 practice questionsCLF-C02 practice questionsA+ Core 1 practice questionsGoogle Cloud ACE practice questionsCySA+ CS0-003 practice questionsNetwork+ N10-009 practice questions
View all certifications →

Product

CertificationsCertification PathsExam TopicsPractice TestsExam Dumps vs Practice TestsStudy HubComparisons

Company

AboutContactEditorial PolicyQuestion Writing PolicyTrust Center

Legal

Privacy PolicyTerms of Service

Courseiva is a free IT certification practice platform offering original exam-style practice questions, detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics for Cisco, CompTIA, Microsoft, AWS, and other technology certifications.

© 2026 Courseiva. Courseiva is operated by JTNetSolutions Ltd. All rights reserved.

Courseiva is an independent certification practice platform and is not affiliated with, endorsed by, or sponsored by Cisco, Microsoft, AWS, CompTIA, Google, ISC2, ISACA, or any other certification vendor. Vendor names and certification marks are used only to identify the exams learners are preparing for.

HomeCertificationsXK0-005TopicsScripting, Containers and Automation
Free · No Signup RequiredCompTIA · XK0-005

XK0-005 Scripting, Containers and Automation Practice Questions

20+ practice questions focused on Scripting, Containers and Automation — one of the most tested topics on the CompTIA Linux+ XK0-005 exam. Each question includes a detailed explanation so you learn why the right answer is correct.

Start Scripting, Containers and Automation Practice

Exam Domains

SecurityTroubleshootingScripting, Containers and AutomationSystem ManagementAll domains →

Study Tools

Practice TestMock ExamFlashcardsAll Topics

Sample Scripting, Containers and Automation Questions

Practice all 20+ →
1.

A DevOps engineer needs to ensure that a containerized web application always restarts automatically if the container exits unexpectedly. Which Docker run option should be used?

A.--restart=on-failure
B.--restart=unless-stopped
C.--restart=no
D.--restart=always

Explanation: The `--restart=always` policy ensures that the container restarts regardless of the exit code or reason for termination, including unexpected crashes. This is the correct choice for a containerized web application that must maintain high availability by automatically recovering from any unexpected exit.

2.

A system administrator wants to create a new user and set a password in a single command as part of a provisioning script. Which command accomplishes this?

A.passwd user1 password
B.echo 'user1:password' | chpasswd
C.useradd -m -p password user1
D.usermod -p password user1

Explanation: Option B is correct because the `chpasswd` command reads username:password pairs from standard input, allowing a single command to create or update a user's password. When combined with `echo`, it sets the password for a new or existing user in one line, which is ideal for provisioning scripts. The `-p` option in `useradd` expects an already-hashed password, not a plaintext one, and `passwd` does not accept the password as an argument for security reasons.

3.

A Linux server that hosts a critical database application has been experiencing occasional kernel panics. The administrator wants to ensure the system automatically reboots after a panic and logs the crash dump. Which sysctl parameter should be set?

A.kernel.panic_on_warn = 10
B.kernel.panic_on_oops = 10
C.kernel.panic_print = 10
D.kernel.panic = 10

Explanation: Option D is correct because setting `kernel.panic = 10` instructs the Linux kernel to wait 10 seconds after a kernel panic before automatically rebooting. This ensures the system recovers without manual intervention, and combined with a configured crash dump mechanism (e.g., kdump), the crash dump is captured before the reboot.

4.

A developer wants to run a container with a specific command that overrides the default entrypoint. Which Docker command should be used?

A.docker run myimage /bin/bash
B.docker exec myimage /bin/bash
C.docker run --entrypoint /bin/bash myimage
D.docker start myimage /bin/bash

Explanation: Option C is correct because the `--entrypoint` flag in `docker run` allows you to override the default entrypoint defined in the Docker image. By specifying `--entrypoint /bin/bash`, the container will start with `/bin/bash` as its entrypoint, ignoring any `ENTRYPOINT` or `CMD` instructions in the Dockerfile. This is the standard Docker syntax for replacing the entrypoint at runtime.

5.

A senior administrator is troubleshooting a shell script that fails to execute properly. The script starts with #!/bin/bash and has execute permissions. Which of the following could cause the script to fail to run when invoked as ./script.sh?

A.The shebang line is not on the first line.
B.The script contains carriage return characters (\r).
C.The script uses #!/bin/sh instead of bash.
D.The script starts with a byte order mark (BOM).

Explanation: Option B is correct because carriage return characters (\r) are a common issue when scripts are edited on Windows and then transferred to Linux. The shebang line #!/bin/bash expects a Unix-style line ending (LF), but \r characters cause the shell to interpret the command interpreter as '/bin/bash\r', which is not a valid executable path. This results in a 'No such file or directory' error when the script is invoked as ./script.sh, even though permissions are correct.

+15 more Scripting, Containers and Automation questions available

Practice all Scripting, Containers and Automation questions

How to master Scripting, Containers and Automation for XK0-005

1. Baseline your knowledge

Start with 10 questions to gauge your current understanding of Scripting, Containers and Automation. This tells you whether you need a concept refresher or just practice.

2. Review every explanation

For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.

3. Focus on exam traps

Scripting, Containers and Automation questions on the XK0-005 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.

4. Reach 80% consistently

Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.

Frequently asked questions

How many XK0-005 Scripting, Containers and Automation questions are on the real exam?

The exact number varies per candidate. Scripting, Containers and Automation is tested as part of the CompTIA Linux+ XK0-005 blueprint. Practicing with targeted Scripting, Containers and Automation questions ensures you can handle any format or difficulty that appears.

Are these XK0-005 Scripting, Containers and Automation practice questions free?

Yes. Courseiva provides free XK0-005 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.

Is Scripting, Containers and Automation one of the harder XK0-005 topics?

Difficulty is subjective, but Scripting, Containers and Automation is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.

Ready to practice?

Launch a full Scripting, Containers and Automation practice session with instant scoring and detailed explanations.

Start Scripting, Containers and Automation Practice →

Topic Info

Topic

Scripting, Containers and Automation

Exam

XK0-005

Questions available

20+