Free CompTIA Linux+ Automation, Orchestration, and Scripting Practice Test 2026 — XK0-005 Questions
This free CompTIA Linux+ Automation, Orchestration, and Scripting practice test covers Bash scripting, Git version control, Podman/Docker containers, Ansible, CI/CD pipelines, and Kubernetes basics for Linux automation. Each question includes a detailed explanation with Linux command-line context — perfect for XK0-005 exam prep.
Key Topics in CompTIA Linux+ Automation, Orchestration, and Scripting
- Bash Scripting
- Git & Version Control
- Containers (Podman/Docker)
- Ansible Basics
- CI/CD Pipelines
- Kubernetes Basics
6 Free CompTIA Linux+ Automation, Orchestration, and Scripting Practice Questions with Answers
Each question below includes 4 answer options, the correct answer, and a detailed explanation. These are real questions from the FlashGenius CompTIA Linux+ XK0-005 question bank for the Automation, Orchestration, and Scripting domain (19% of the exam).
Sample Question 1 — Automation, Orchestration, and Scripting
Which command in Ansible is used to execute a playbook on a set of hosts?
- A. ansible-playbook (Correct answer)
- B. ansible-run
- C. ansible-execute
- D. ansible-deploy
Correct answer: A
Explanation: The correct command to execute a playbook in Ansible is 'ansible-playbook'. This command runs the playbook on the specified hosts. The other options are incorrect because 'ansible-run', 'ansible-execute', and 'ansible-deploy' are not valid Ansible commands.
Sample Question 2 — Automation, Orchestration, and Scripting
In a hybrid cloud infrastructure using Kubernetes, which YAML key is used to specify the number of replicas for a deployment?
- A. replicaCount
- B. instances
- C. replicas (Correct answer)
- D. count
Correct answer: C
Explanation: In Kubernetes, the 'replicas' key is used within a deployment YAML to specify the number of pod replicas that should be running. 'replicaCount', 'instances', and 'count' are not valid keys for this purpose in Kubernetes deployment configurations.
Sample Question 3 — Automation, Orchestration, and Scripting
You need to automate the creation of user accounts on a Linux server. Which scripting language would be the most suitable for this task if you require easy integration with system commands?
- A. Java
- B. Python
- C. Bash (Correct answer)
- D. Ruby
Correct answer: C
Explanation: Bash is a suitable scripting language for automating tasks on a Linux server because it provides easy integration with system commands and is widely used for writing shell scripts. While Python and Ruby can also be used for automation, Bash is more directly suited for tasks involving system administration. Java is not typically used for such tasks due to its complexity and overhead.
Sample Question 4 — Automation, Orchestration, and Scripting
A script needs to check the exit status of a command in a Linux environment. Which variable holds this status?
- A. $? (Correct answer)
- B. $!
- C. $#
- D. $@
Correct answer: A
Explanation: The '$?' variable in Bash holds the exit status of the last executed command. '$!' holds the process ID of the last background command, '$#' gives the number of positional parameters, and '$@' is an array-like construct of all positional parameters.
Sample Question 5 — Automation, Orchestration, and Scripting
You are tasked with configuring a continuous integration pipeline using Jenkins for a containerized application. Which plugin is essential for interacting with Docker?
- A. Docker Pipeline (Correct answer)
- B. Kubernetes Plugin
- C. GitHub Integration
- D. Maven Plugin
Correct answer: A
Explanation: The 'Docker Pipeline' plugin is essential for integrating Docker with Jenkins, allowing you to build and manage Docker containers within your Jenkins pipelines. The 'Kubernetes Plugin' is used for integration with Kubernetes, 'GitHub Integration' is for GitHub repositories, and the 'Maven Plugin' is for projects that use Maven.
Sample Question 6 — Automation, Orchestration, and Scripting
Which of the following Ansible modules is used to manage packages on a Red Hat-based system?
- A. apt
- B. yum (Correct answer)
- C. dnf
- D. package
Correct answer: B
Explanation: The 'yum' module is used in Ansible to manage packages on Red Hat-based systems like RHEL and CentOS. The 'apt' module is for Debian-based systems. While 'dnf' is a package manager on newer Red Hat systems, the 'package' module is a generic module that can handle different package managers, but 'yum' is specific to Red Hat-based systems.
How to Study CompTIA Linux+ Automation, Orchestration, and Scripting
Combine these CompTIA Linux+ Automation, Orchestration, and Scripting practice questions with hands-on labs in a Linux VM (Ubuntu, Rocky, or Fedora). The XK0-005 exam emphasizes practical command-line work, so always test commands in a sandbox — that hands-on muscle memory is what separates passing and failing scores.
About the CompTIA Linux+ XK0-005 Exam
- Questions: 90 max (multiple-choice + performance-based)
- Time: 90 minutes
- Passing score: 720 / 900 (~80%)
- Cost: $369 USD
- Domains: 5 (this is 19% of the exam)
- Validity: 3 years (renewable via CE)
Other CompTIA Linux+ Domains
Start the free CompTIA Linux+ Automation, Orchestration, and Scripting practice test now | 10-question quick start | All CompTIA Linux+ domains | CompTIA Linux+ Cheat Sheet