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

Question 210

A single PID's CPU consumption over time needs to be sampled rather than averaged across all processes. Which command fits?

  1. pidstat -p 6120 1
  2. pstree -p
  3. /proc/6120/
  4. ps aux

Explanation

Correct Answer

A:

pidstat measures per-process statistics at intervals and can target a specific PID. It is useful for correlating a named process with a resource spike.

Incorrect Answers

B:

pstree presents processes as a hierarchy and -p includes PIDs; the task involves sampling one process's CPU statistics, whereas this addresses another subsystem.

C:

The procfs PID directory contains process-specific pseudo-files such as status and cmdline; its scope differs from sampling one process's CPU statistics, so it cannot meet the stated requirement.

D:

ps aux displays a system-wide process snapshot including user, CPU and memory information; that is not equivalent to sampling one process's CPU statistics.

Question 211

An operator wants to request a graceful process shutdown first and has an explicit last-resort option if it cannot terminate. Which TWO signals correspond to these distinct steps? Choose TWO.

  1. nice -n 10 command
  2. SIGKILL (signal 9)
  3. fg %2
  4. SIGTERM (signal 15)
  5. bg %1

Explanation

Correct Answers

B:

SIGKILL is the last-resort forced termination signal; the kernel does not allow the target to catch or ignore it. It should follow an attempted SIGTERM when graceful cleanup cannot be completed, especially for writers.

D:

SIGTERM requests termination and can be handled so a process may clean up. SIGKILL forcibly ends a process without that opportunity.

Incorrect Answers

A:

nice launches a new process with its requested scheduling niceness, typically making it less favored under contention when positive; it answers a neighboring question rather than using a graceful request before an uncatchable final termination.

C:

fg places a shell job in the foreground and waits for it; this does not achieve using a graceful request before an uncatchable final termination on the system described.

E:

bg resumes a suspended shell job in the background using its job identifier; using it would leave using a graceful request before an uncatchable final termination unresolved.

Question 212

A long command should remain running after the SSH terminal is disconnected, with output redirected appropriately. Which utility helps?

  1. nohup command >run.log 2>&1 &
  2. bg %1
  3. renice +10 -p 6120
  4. SIGTERM (signal 15)

Explanation

Correct Answer

A:

nohup arranges for the launched command to ignore SIGHUP, while backgrounding and redirection prevent terminal dependence. It does not provide process supervision.

Incorrect Answers

B:

bg resumes a suspended shell job in the background using its job identifier; it does not deliver avoiding SIGHUP on terminal disconnect, which is decisive in this scenario.

C:

renice modifies the scheduling priority of an existing process; the evidence calls for avoiding SIGHUP on terminal disconnect, not merely this separate operation.

D:

SIGTERM requests termination and can be handled so a process may clean up; the task involves avoiding SIGHUP on terminal disconnect, whereas this addresses another subsystem.

Question 213

A hung service has PID 6120 and the technician wants its kernel-exposed command line and status. Which path is relevant?

  1. /proc/6120/
  2. Defunct child awaiting parent reaping
  3. htop
  4. strace -e openat command
  5. top

Explanation

Correct Answer

A:

The procfs PID directory contains process-specific pseudo-files such as status and cmdline. The directory disappears after the process exits.

Incorrect Answers

B:

A zombie has exited but retains a minimal process-table entry until its parent collects exit status; the administrator instead needs examining procfs data for one PID; this option serves a different purpose.

C:

htop provides an interactive process interface with navigation and tree views; it answers a neighboring question rather than examining procfs data for one PID.

D:

strace intercepts system-call activity and can filter calls such as openat; that changes a different part of the system; the requested outcome is examining procfs data for one PID.

E:

top updates an interactive table of processes and system load; this does not achieve examining procfs data for one PID on the system described.

Question 214

An operator wants a continuously updating display of active processes sorted by resource usage. Which utility fits?

  1. mpstat -P ALL 1
  2. Defunct child awaiting parent reaping
  3. pidstat -p 6120 1
  4. top

Explanation

Correct Answer

D:

top updates an interactive table of processes and system load. It shows changing metrics without requiring repeated ps calls.

Incorrect Answers

A:

mpstat reports processor statistics including per-CPU usage at chosen intervals; it will not provide monitoring processes interactively under these conditions.

B:

A zombie has exited but retains a minimal process-table entry until its parent collects exit status; using it would leave monitoring processes interactively unresolved.

C:

pidstat measures per-process statistics at intervals and can target a specific PID; the requirement is monitoring processes interactively, outside the effect of this choice.

Question 215

A process unexpectedly opens a configuration file; which utility traces its system calls during execution?

  1. ps aux
  2. Defunct child awaiting parent reaping
  3. strace -e openat command
  4. pstree -p

Explanation

Correct Answer

C:

strace intercepts system-call activity and can filter calls such as openat. It can reveal missing paths or permission errors.

Incorrect Answers

A:

ps aux displays a system-wide process snapshot including user, CPU and memory information; the task involves tracing file-open system calls, whereas this addresses another subsystem.

B:

A zombie has exited but retains a minimal process-table entry until its parent collects exit status; its scope differs from tracing file-open system calls, so it cannot meet the stated requirement.

D:

pstree presents processes as a hierarchy and -p includes PIDs; the administrator instead needs tracing file-open system calls; this option serves a different purpose.

Question 216

A shell job is consuming terminal input but should temporarily stop so another operation can run. Which shortcut sends the suspend signal?

  1. 15 2 * * *
  2. Ctrl+Z
  3. ulimit -n
  4. crontab -l

Explanation

Correct Answer

B:

Ctrl+Z normally delivers SIGTSTP to the foreground process group. The shell can later resume that job with bg or fg.

Incorrect Answers

A:

Cron places the minute field first and the hour field second, so 15 2 means 02:15; that changes a different part of the system; the requested outcome is suspending an interactive foreground job.

C:

ulimit manages limits for the current shell and its descendants, subject to hard limits and policy; it will not provide suspending an interactive foreground job under these conditions.

D:

crontab -l displays the current user's installed cron table; using it would leave suspending an interactive foreground job unresolved.

Question 217

An administrator needs an interactive process monitor with tree and color features on a host where it is installed. Which tool fits?

  1. Defunct child awaiting parent reaping
  2. htop
  3. top
  4. pstree -p

Explanation

Correct Answer

B:

htop provides an interactive process interface with navigation and tree views. It is an optional package on many distributions.

Incorrect Answers

A:

A zombie has exited but retains a minimal process-table entry until its parent collects exit status; it does not deliver browsing processes in an interactive tree, which is decisive in this scenario.

C:

top updates an interactive table of processes and system load; the task involves browsing processes in an interactive tree, whereas this addresses another subsystem.

D:

pstree presents processes as a hierarchy and -p includes PIDs; its scope differs from browsing processes in an interactive tree, so it cannot meet the stated requirement.

Question 218

An administrator needs to edit the current user's recurring cron jobs in the standard crontab interface. Which command does that?

  1. ulimit -n
  2. crontab -e
  3. 15 2 * * *
  4. Ctrl+C

Explanation

Correct Answer

B:

crontab -e edits a per-user cron table that cron reads for scheduled execution. Environment variables and absolute paths matter for reliability.

Incorrect Answers

A:

ulimit manages limits for the current shell and its descendants, subject to hard limits and policy; the administrator instead needs modifying the invoking user's cron schedule; this option serves a different purpose.

C:

Cron places the minute field first and the hour field second, so 15 2 means 02:15; that changes a different part of the system; the requested outcome is modifying the invoking user's cron schedule.

D:

Ctrl+C causes the terminal to deliver an interrupt signal to the foreground process group; this does not achieve modifying the invoking user's cron schedule on the system described.

Question 219

A script should run at 02:15 every day on an always-on server. Which cron expression is correct?

  1. 15 2 * * *
  2. crontab -e
  3. ulimit -n
  4. at 17:00 tomorrow
  5. crontab -l

Explanation

Correct Answer

A:

Cron places the minute field first and the hour field second, so 15 2 means 02:15. The three wildcard date fields allow the job to recur every day, subject to cron running.

Incorrect Answers

B:

crontab -e edits a per-user cron table that cron reads for scheduled execution; the requirement is scheduling a daily 02:15 cron event, outside the effect of this choice.

C:

ulimit manages limits for the current shell and its descendants, subject to hard limits and policy; it does not deliver scheduling a daily 02:15 cron event, which is decisive in this scenario.

D:

at queues a one-time job for a specified future time; the evidence calls for scheduling a daily 02:15 cron event, not merely this separate operation.

E:

crontab -l displays the current user's installed cron table; the task involves scheduling a daily 02:15 cron event, whereas this addresses another subsystem.

Question 220

Several Linux CPUs are unevenly busy, and the administrator needs per-CPU utilization samples. Which utility is suitable?

  1. ps aux
  2. mpstat -P ALL 1
  3. htop
  4. top

Explanation

Correct Answer

B:

mpstat reports processor statistics including per-CPU usage at chosen intervals. It helps distinguish one saturated core from overall host utilization.

Incorrect Answers

A:

ps aux displays a system-wide process snapshot including user, CPU and memory information; its scope differs from sampling each CPU's utilization, so it cannot meet the stated requirement.

C:

htop provides an interactive process interface with navigation and tree views; the administrator instead needs sampling each CPU's utilization; this option serves a different purpose.

D:

top updates an interactive table of processes and system load; it answers a neighboring question rather than sampling each CPU's utilization.

CompTIA Linux+ (XK0-006) Practice Tests