CompTIA XK0-006 (CompTIA Linux+) Practice Test 44

Question 430

A CI pipeline must test a package before deployment into production using the same immutable artifact. Which principle applies?

  1. GitOps reconciliation
  2. Shift-left security testing
  3. Build once, promote the validated artifact
  4. Kickstart

Explanation

Correct Answer

C:

Promoting one tested artifact avoids rebuilding a different binary between stages. Integrity checks and environment-specific configuration still matter.

Incorrect Answers

A:

GitOps treats version-controlled declarative definitions as a desired-state source and automatically reconciles observed resources; it will not provide promoting the exact artifact that passed testing under these conditions.

B:

Shift-left adds security checks in earlier development and CI stages, reducing late discovery; using it would leave promoting the exact artifact that passed testing unresolved.

D:

Kickstart automates installer choices such as partitions, packages and user creation on supported distributions; it does not deliver promoting the exact artifact that passed testing, which is decisive in this scenario.

Question 431

One command must check disk space on a temporary host group without creating a reusable playbook. Which execution mode fits?

  1. Inventory
  2. Ansible ad hoc command
  3. Idempotence
  4. Gathered facts

Explanation

Correct Answer

B:

Ad hoc execution runs a module or command against selected inventory hosts for a short task. Playbooks are better for multi-step reusable workflows.

Incorrect Answers

A:

Inventory declares managed hosts and groups and can be static or dynamically generated; the task involves running a one-time Ansible action, whereas this addresses another subsystem.

C:

Idempotent operations converge on desired state, performing no unnecessary change once it is satisfied; that is not equivalent to running a one-time Ansible action.

D:

Ansible facts contain discovered host attributes that condition tasks or templates; the administrator instead needs running a one-time Ansible action; this option serves a different purpose.

Question 432

A playbook needs CPU architecture and distribution variables detected from managed machines. Which Ansible data feature provides them?

  1. Notify a handler
  2. Inventory
  3. Gathered facts
  4. Idempotence

Explanation

Correct Answer

C:

Ansible facts contain discovered host attributes that condition tasks or templates. Fact collection can be enabled, disabled or cached.

Incorrect Answers

A:

Handlers run when notified by changed tasks, avoiding unnecessary restarts during no-op runs; that changes a different part of the system; the requested outcome is using automatically collected host properties.

B:

Inventory declares managed hosts and groups and can be static or dynamically generated; this does not achieve using automatically collected host properties on the system described.

D:

Idempotent operations converge on desired state, performing no unnecessary change once it is satisfied; using it would leave using automatically collected host properties unresolved.

Question 433

An administrator must prevent concurrent remote-state modifications by multiple pipelines. Which design control is needed?

  1. tofu plan
  2. OpenTofu
  3. State file
  4. Backend state locking

Explanation

Correct Answer

D:

A backend that supports locking coordinates state mutations to avoid conflicting writes. Access controls and versioned backups further protect state.

Incorrect Answers

A:

The plan evaluates configuration against state and provider data to describe proposed operations; it does not deliver serializing concurrent infrastructure state updates, which is decisive in this scenario.

B:

OpenTofu interprets configuration through providers and compares desired resources with stored state; the evidence calls for serializing concurrent infrastructure state updates, not merely this separate operation.

C:

State records tracked resource identities and attributes for planning and reconciliation; the task involves serializing concurrent infrastructure state updates, whereas this addresses another subsystem.

Question 434

Host-specific application settings must be generated from a template using variables. Which Ansible capability is natural?

  1. Jinja2 template module
  2. Playbook
  3. Ansible ad hoc command
  4. Notify a handler
  5. Ansible collection

Explanation

Correct Answer

A:

Ansible's template module renders Jinja2 variables into managed files. It can notify a handler only when the rendered content changes.

Incorrect Answers

B:

Playbooks describe plays, hosts and ordered tasks in YAML; it answers a neighboring question rather than rendering configuration files with host variables.

C:

Ad hoc execution runs a module or command against selected inventory hosts for a short task; that changes a different part of the system; the requested outcome is rendering configuration files with host variables.

D:

Handlers run when notified by changed tasks, avoiding unnecessary restarts during no-op runs; this does not achieve rendering configuration files with host variables on the system described.

E:

Collections package modules, roles and plugins under namespaces; it will not provide rendering configuration files with host variables under these conditions.

Question 435

A Red Hat-family bare-metal rollout needs an unattended operating-system installation driven by an answer file. Which technology fits?

  1. Shift-left security testing
  2. Kickstart
  3. cloud-init
  4. Build once, promote the validated artifact

Explanation

Correct Answer

B:

Kickstart automates installer choices such as partitions, packages and user creation on supported distributions. It operates during OS installation.

Incorrect Answers

A:

Shift-left adds security checks in earlier development and CI stages, reducing late discovery; using it would leave automating initial OS installation from an answer file unresolved.

C:

cloud-init processes metadata and user-data at instance initialization to configure supported images; it does not deliver automating initial OS installation from an answer file, which is decisive in this scenario.

D:

Promoting one tested artifact avoids rebuilding a different binary between stages; the evidence calls for automating initial OS installation from an answer file, not merely this separate operation.

Question 436

A Kubernetes app requires three interchangeable replicas managed for rolling updates. Which controller resource should be used?

  1. Kubernetes Service
  2. Kubernetes Deployment
  3. Swarm service with replicas
  4. Kubernetes Secret

Explanation

Correct Answer

B:

Deployments manage replica sets and rolling application updates for stateless workloads. Individual Pods alone do not preserve desired replica counts.

Incorrect Answers

A:

A Service selects matching Pods and exposes a stable networking identity; its scope differs from maintaining replicated pods through rolling updates, so it cannot meet the stated requirement.

C:

A swarm service schedules and reconciles tasks across available nodes; the administrator instead needs maintaining replicated pods through rolling updates; this option serves a different purpose.

D:

Secrets hold sensitive data for Pod consumption with access controlled by cluster policy; it answers a neighboring question rather than maintaining replicated pods through rolling updates.

Question 437

A team must manage servers through declarative files and provider APIs while tracking created objects. Which open-source IaC tool fits?

  1. State file
  2. OpenTofu
  3. Provider plugin
  4. Backend state locking

Explanation

Correct Answer

B:

OpenTofu interprets configuration through providers and compares desired resources with stored state. Changes should be reviewed before application.

Incorrect Answers

A:

State records tracked resource identities and attributes for planning and reconciliation; this does not achieve reconciling infrastructure with declarative state on the system described.

C:

A provider connects the IaC language to an external API and defines resource schemas; using it would leave reconciling infrastructure with declarative state unresolved.

D:

A backend that supports locking coordinates state mutations to avoid conflicting writes; the requirement is reconciling infrastructure with declarative state, outside the effect of this choice.

Question 438

Three related containers should be started from a local declarative multi-service YAML file. Which workflow fits?

  1. Kubernetes Service
  2. Kubernetes Deployment
  3. docker compose up -d
  4. Kubernetes Secret

Explanation

Correct Answer

C:

Compose reads service definitions and creates related containers, networks and volumes for an application. It is not a multi-host cluster scheduler by itself.

Incorrect Answers

A:

A Service selects matching Pods and exposes a stable networking identity; the evidence calls for launching a local multi-container application from YAML, not merely this separate operation.

B:

Deployments manage replica sets and rolling application updates for stateless workloads; the task involves launching a local multi-container application from YAML, whereas this addresses another subsystem.

D:

Secrets hold sensitive data for Pod consumption with access controlled by cluster policy; that is not equivalent to launching a local multi-container application from YAML.

Question 439

A daemon should restart only when its managed config file changes. Which playbook mechanism suits it?

  1. Ansible
  2. Notify a handler
  3. Ansible collection
  4. Playbook

Explanation

Correct Answer

B:

Handlers run when notified by changed tasks, avoiding unnecessary restarts during no-op runs. Multiple notifications can be coalesced in one play.

Incorrect Answers

A:

Ansible commonly connects to managed Linux hosts using SSH and executes modules without a resident agent; it answers a neighboring question rather than triggering service restart only on changes.

C:

Collections package modules, roles and plugins under namespaces; this does not achieve triggering service restart only on changes on the system described.

D:

Playbooks describe plays, hosts and ordered tasks in YAML; it will not provide triggering service restart only on changes under these conditions.

Question 440

Infrastructure deployment should reconcile against reviewed configuration stored in a Git repository. Which operating model fits?

  1. GitOps reconciliation
  2. cloud-init
  3. Kickstart
  4. Build once, promote the validated artifact
  5. Shift-left security testing

Explanation

Correct Answer

A:

GitOps treats version-controlled declarative definitions as a desired-state source and automatically reconciles observed resources. Change approval can occur through pull requests.

Incorrect Answers

B:

cloud-init processes metadata and user-data at instance initialization to configure supported images; it does not deliver reconciling infrastructure to Git-stored desired state, which is decisive in this scenario.

C:

Kickstart automates installer choices such as partitions, packages and user creation on supported distributions; the evidence calls for reconciling infrastructure to Git-stored desired state, not merely this separate operation.

D:

Promoting one tested artifact avoids rebuilding a different binary between stages; the task involves reconciling infrastructure to Git-stored desired state, whereas this addresses another subsystem.

E:

Shift-left adds security checks in earlier development and CI stages, reducing late discovery; its scope differs from reconciling infrastructure to Git-stored desired state, so it cannot meet the stated requirement.

CompTIA Linux+ (XK0-006) Practice Tests