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

Question 450

Puppet needs the installed operating-system family to choose a conditional resource. Which information source commonly supplies it?

  1. Puppet class
  2. Puppet certificate authority workflow
  3. Puppet module
  4. Facter facts

Explanation

Correct Answer

D:

Facter exposes system attributes such as OS family for Puppet classification. Facts inform catalog decisions but are not configuration resources themselves.

Incorrect Answers

A:

Puppet classes organize declared resources and can be assigned through roles or classification; the evidence calls for detecting system attributes for Puppet manifests, not merely this separate operation.

B:

Puppet's PKI can authenticate agents and the primary server using certificates; the task involves detecting system attributes for Puppet manifests, whereas this addresses another subsystem.

C:

Puppet modules package classes and supporting content into deployable units; its scope differs from detecting system attributes for Puppet manifests, so it cannot meet the stated requirement.

Question 451

A team must list target hosts by logical environment and assign groups to playbooks. Which Ansible component stores those targets?

  1. Inventory
  2. Ansible ad hoc command
  3. Ansible collection
  4. Notify a handler

Explanation

Correct Answer

A:

Inventory declares managed hosts and groups and can be static or dynamically generated. It tells Ansible where to run tasks.

Incorrect Answers

B:

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 grouping target machines for Ansible runs.

C:

Collections package modules, roles and plugins under namespaces; this does not achieve grouping target machines for Ansible runs on the system described.

D:

Handlers run when notified by changed tasks, avoiding unnecessary restarts during no-op runs; it will not provide grouping target machines for Ansible runs under these conditions.

Question 452

A Puppet configuration groups related resource declarations for reuse across hosts. Which language construct represents that grouping?

  1. Puppet class
  2. Puppet agent and server
  3. Puppet certificate authority workflow
  4. Facter facts

Explanation

Correct Answer

A:

Puppet classes organize declared resources and can be assigned through roles or classification. They promote reuse in larger manifests.

Incorrect Answers

B:

Puppet agents can fetch catalogs and apply declarative resources from a central service; it does not deliver organizing Puppet resources for reuse, which is decisive in this scenario.

C:

Puppet's PKI can authenticate agents and the primary server using certificates; the evidence calls for organizing Puppet resources for reuse, not merely this separate operation.

D:

Facter exposes system attributes such as OS family for Puppet classification; the task involves organizing Puppet resources for reuse, whereas this addresses another subsystem.

Question 453

Changes to security policy should be checked early in the software lifecycle instead of only after release. Which approach describes this?

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

Explanation

Correct Answer

C:

Shift-left adds security checks in earlier development and CI stages, reducing late discovery. It complements runtime controls and production monitoring.

Incorrect Answers

A:

GitOps treats version-controlled declarative definitions as a desired-state source and automatically reconciles observed resources; that is not equivalent to moving security validation earlier in delivery.

B:

cloud-init processes metadata and user-data at instance initialization to configure supported images; the administrator instead needs moving security validation earlier in delivery; this option serves a different purpose.

D:

Promoting one tested artifact avoids rebuilding a different binary between stages; that changes a different part of the system; the requested outcome is moving security validation earlier in delivery.

E:

Kickstart automates installer choices such as partitions, packages and user creation on supported distributions; this does not achieve moving security validation earlier in delivery on the system described.

Question 454

A task should ensure a package is installed regardless of whether it already exists. Which automation property avoids repeated harmful changes?

  1. Jinja2 template module
  2. Inventory
  3. Idempotence
  4. Gathered facts

Explanation

Correct Answer

C:

Idempotent operations converge on desired state, performing no unnecessary change once it is satisfied. Modules are preferred over uncontrolled shell commands when possible.

Incorrect Answers

A:

Ansible's template module renders Jinja2 variables into managed files; it will not provide making repeated configuration runs safe under these conditions.

B:

Inventory declares managed hosts and groups and can be static or dynamically generated; using it would leave making repeated configuration runs safe unresolved.

D:

Ansible facts contain discovered host attributes that condition tasks or templates; it does not deliver making repeated configuration runs safe, which is decisive in this scenario.

Question 455

Docker Swarm should maintain five instances of a service and recover them when nodes fail. Which abstraction declares desired replicas?

  1. Swarm service with replicas
  2. Kubernetes Secret
  3. Kubernetes Pod
  4. Kubernetes Service
  5. docker compose up -d
  6. ConfigMap

Explanation

Correct Answer

A:

A swarm service schedules and reconciles tasks across available nodes. Its replica count represents desired workload instances.

Incorrect Answers

B:

Secrets hold sensitive data for Pod consumption with access controlled by cluster policy; its scope differs from reconciling replicated tasks across swarm nodes, so it cannot meet the stated requirement.

C:

A Pod is Kubernetes' basic scheduling unit and shares network identity among its containers; that is not equivalent to reconciling replicated tasks across swarm nodes.

D:

A Service selects matching Pods and exposes a stable networking identity; the administrator instead needs reconciling replicated tasks across swarm nodes; this option serves a different purpose.

E:

Compose reads service definitions and creates related containers, networks and volumes for an application; it answers a neighboring question rather than reconciling replicated tasks across swarm nodes.

F:

ConfigMaps store non-sensitive key/value configuration consumable by Pods; that changes a different part of the system; the requested outcome is reconciling replicated tasks across swarm nodes.

Question 456

A Puppet operator wants reusable distribution units of manifests, files and templates. Which artifact is appropriate?

  1. Facter facts
  2. Puppet class
  3. Puppet agent and server
  4. Puppet module

Explanation

Correct Answer

D:

Puppet modules package classes and supporting content into deployable units. They have independent version and dependency concerns.

Incorrect Answers

A:

Facter exposes system attributes such as OS family for Puppet classification; that changes a different part of the system; the requested outcome is packaging Puppet manifest components.

B:

Puppet classes organize declared resources and can be assigned through roles or classification; this does not achieve packaging Puppet manifest components on the system described.

C:

Puppet agents can fetch catalogs and apply declarative resources from a central service; it will not provide packaging Puppet manifest components under these conditions.

Question 457

An operator wants to inspect a proposed infrastructure diff without applying changes. Which command is suitable?

  1. Provider plugin
  2. tofu plan
  3. OpenTofu
  4. Backend state locking

Explanation

Correct Answer

B:

The plan evaluates configuration against state and provider data to describe proposed operations. Its output should be reviewed before approval.

Incorrect Answers

A:

A provider connects the IaC language to an external API and defines resource schemas; it does not deliver reviewing an infrastructure change before execution, which is decisive in this scenario.

C:

OpenTofu interprets configuration through providers and compares desired resources with stored state; the task involves reviewing an infrastructure change before execution, whereas this addresses another subsystem.

D:

A backend that supports locking coordinates state mutations to avoid conflicting writes; its scope differs from reviewing an infrastructure change before execution, so it cannot meet the stated requirement.

Question 458

An Ansible rollout must specify target groups, define ordered configuration steps, and use automatically discovered host attributes. Which THREE components serve those separate needs? Choose THREE.

  1. Notify a handler
  2. Idempotence
  3. Gathered facts
  4. Playbook
  5. Jinja2 template module
  6. Inventory

Explanation

Correct Answers

C:

Gathered Ansible facts expose operating system, architecture and other observed properties for conditional tasks and templates. An inventory identifies where to run and a playbook specifies which tasks run and in what order.

D:

Playbooks describe plays, hosts and ordered tasks in YAML. Idempotent modules help repeated runs converge on desired state.

F:

Ansible inventory stores target hosts and groups, whether static or dynamically assembled. Its role is to select the managed estate; gathered facts and the playbook supply the machine attributes and ordered operations.

Incorrect Answers

A:

Handlers run when notified by changed tasks, avoiding unnecessary restarts during no-op runs; the administrator instead needs combining target inventory, ordered plays and machine-discovered data; this option serves a different purpose.

B:

Idempotent operations converge on desired state, performing no unnecessary change once it is satisfied; it answers a neighboring question rather than combining target inventory, ordered plays and machine-discovered data.

E:

Ansible's template module renders Jinja2 variables into managed files; it will not provide combining target inventory, ordered plays and machine-discovered data under these conditions.

Question 459

A cleanup function must run when a script exits normally or via an error path. Which Bash feature registers it?

  1. command >combined.log 2>&1
  2. IFS
  3. exec /usr/bin/worker
  4. trap cleanup EXIT

Explanation

Correct Answer

D:

A trap for EXIT invokes the named handler when the shell exits under supported conditions. It is useful for deleting temporary files.

Incorrect Answers

A:

Redirecting stdout first and then duplicating it for stderr directs both streams to one file; using it would leave registering a shell-exit cleanup hook unresolved.

B:

The Internal Field Separator affects shell word splitting and read parsing; the requirement is registering a shell-exit cleanup hook, outside the effect of this choice.

C:

exec replaces the shell process with the target command, retaining the PID; it does not deliver registering a shell-exit cleanup hook, which is decisive in this scenario.

Question 460

A script should stop automatically on many unhandled command failures, subject to Bash's exception contexts. Which option is often used?

  1. #!/usr/bin/env bash
  2. set -o pipefail
  3. [[ $one == "$two" ]]
  4. set -e
  5. printf '%s\n' "$value"

Explanation

Correct Answer

D:

errexit causes the shell to exit on certain nonzero statuses outside exception contexts. It is not a substitute for explicit failure handling.

Incorrect Answers

A:

The shebang line chooses a script interpreter at direct execution, but it does not control Bash command failure handling. env searches PATH for bash, which can help across distributions; its scope differs from aborting a script on unhandled failures, so it cannot meet the stated requirement.

B:

pipefail changes a pipeline's exit status to reflect a failing command instead of only its last stage; that is not equivalent to aborting a script on unhandled failures.

C:

The == operator performs string-pattern comparison in Bash double brackets; quoting the right side forces literal matching; the administrator instead needs aborting a script on unhandled failures; this option serves a different purpose.

E:

printf uses an explicit format string and avoids several echo option and escape ambiguities; that changes a different part of the system; the requested outcome is aborting a script on unhandled failures.

CompTIA Linux+ (XK0-006) Practice Tests