LPI 102-500 Practice Test 2 - Prepaway
Practice Exams:

Pass LPI 102-500 Exam in First Attempt Guaranteed!

Get 100% Latest Exam Questions, Accurate & Verified Answers!

30 Days Free Updates, Instant Download!

Verified By Experts
Premium Bundle
$29.98
$79.99 $109.97

102-500 Premium Bundle


  • Premium File 120 Questions & Answers. Last update: Nov 13, 2026
  • Training Course 126 Lectures
  • Study Guide 962 Pages

LPI 102-500 Practice Test 2

Question 10

At fictional Westhaven University, the Linux shell and scripting team is working while investigating an observed production-like support incident. The Linux scenario is: A user runs a routine backup command but Bash executes a same-named executable from a writable folder ahead of the intended system directory. The decisive evidence is: The effective PATH begins with a team-writable directory and type -a finds the unexpected executable before the managed command. Which paired action and independent proof BEST satisfies the requirement?

  1. For Westhaven University, the Linux support team should: Scoped correction: Test the command's return code and route failure to cleanup and an explicit nonzero script exit. Independent acceptance: An injected archive failure produces no success message and the caller observes a nonzero status.
  2. For Westhaven University, the Linux support team should: Scoped correction: Remove writable directories from privileged PATH ordering and invoke the vetted absolute command path while correcting profile files. Independent acceptance: A clean login and interactive shell both resolve the intended root-owned executable and the backup output matches expected checks.
  3. For Westhaven University, the Linux support team should: Scoped correction: Set appropriate restrictive owner and execute permissions and check interpreter availability under the service account. Independent acceptance: An approved service identity can execute the script while unrelated users cannot modify it.
  4. For Westhaven University, the Linux support team should: Scoped correction: Read structured output line by line with an appropriate read loop and quote each value as data. Independent acceptance: A sample with spaces and blank fields preserves record boundaries and produces one output per intended record.

Explanation

Correct Answer

B:

A clean login and interactive shell both resolve the intended root-owned executable and the backup output matches expected checks. Without that result, the finding the effective PATH begins with a team-writable directory and type -a finds the unexpected executable before the managed command would remain unresolved.

Incorrect Answers

A:

A test that scoped correction: Test the command's return code and route failure to cleanup and an explicit nonzero script exit. Independent acceptance: An injected archive failure produces no success message and the caller observes a nonzero status would not demonstrate closure of this condition. The needed proof is a clean login and interactive shell both resolve the intended root-owned executable and the backup output matches expected checks.

C:

Scoped correction: Set appropriate restrictive owner and execute permissions and check interpreter availability under the service account. Independent acceptance: An approved service identity can execute the script while unrelated users cannot modify it. That does not demonstrate the case-specific success condition: a clean login and interactive shell both resolve the intended root-owned executable and the backup output matches expected checks. Bash searches PATH in order and an unsafe search path can shadow trusted commands.

D:

Scoped correction: Read structured output line by line with an appropriate read loop and quote each value as data. Independent acceptance: A sample with spaces and blank fields preserves record boundaries and produces one output per intended record. That result does not test the original problem, identified by the effective PATH begins with a team-writable directory and type -a finds the unexpected executable before the managed command. Recovery must show that a clean login and interactive shell both resolve the intended root-owned executable and the backup output matches expected checks.

Question 11

At fictional Riverton Research, the Linux shell and scripting team is working during a controlled system-configuration acceptance test. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The diagnostic evidence is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Which bounded step BEST resolves the described problem?

  1. For Riverton Research, the Linux support team should: Quote pathname expansions and validate parameters before invoking the file utility.
  2. For Riverton Research, the Linux support team should: Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently.
  3. For Riverton Research, the Linux support team should: Place environment setup in the appropriate login profile and source an interactive rc file only when suitable.
  4. For Riverton Research, the Linux support team should: Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths.

Explanation

Correct Answer

C:

The case reveals comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. That matters because Bash login startup files and interactive nonlogin rc files have different execution paths. The corrective step is to place environment setup in the appropriate login profile and source an interactive rc file only when suitable. Preserve this constraint during the change: Never assume every remote command sources ~/.bashrc or that a GUI terminal starts a login shell.

Incorrect Answers

A:

Another possible response is to quote pathname expansions and validate parameters before invoking the file utility. The case evidence instead shows that comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Bash login startup files and interactive nonlogin rc files have different execution paths.

B:

Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently. This does not address the reported incident: an engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The case-specific correction is to place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

D:

One alternative would be to use explicit if/then/else statements or carefully grouped tests for required success and recovery paths. The observed evidence instead shows that comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The more relevant correction is to place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Question 12

At fictional Riverton Research, the Linux shell and scripting team is working during a controlled system-configuration acceptance test. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. Which observation MOST directly supports the underlying diagnosis before any changes are made?

  1. The deciding Linux diagnostic evidence for Riverton Research is: Tracing shows a variable expanded unquoted in a file test and command argument.
  2. The deciding Linux diagnostic evidence for Riverton Research is: The shebang selects sh while the body uses Bash-specific conditional syntax.
  3. The deciding Linux diagnostic evidence for Riverton Research is: A trace of exit statuses and short-circuit operators shows the recovery command is reached in a success path.
  4. The deciding Linux diagnostic evidence for Riverton Research is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization.

Explanation

Correct Answer

D:

Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. It identifies the problem behind an engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. Bash login startup files and interactive nonlogin rc files have different execution paths.

Incorrect Answers

A:

A competing Linux diagnostic finding for Riverton Research is: Tracing shows a variable expanded unquoted in a file test and command argument. It does not account for the observation comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization in the reported situation.

B:

At Riverton Research, another diagnostic finding is: The shebang selects sh while the body uses Bash-specific conditional syntax. This would indicate another failure; here comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Bash login startup files and interactive nonlogin rc files have different execution paths.

C:

At Riverton Research, a different observation is: A trace of exit statuses and short-circuit operators shows the recovery command is reached in a success path. It concerns another dependency. This incident is distinguished by comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Bash login startup files and interactive nonlogin rc files have different execution paths.

Question 13

At fictional Riverton Research, the Linux shell and scripting team is working during a controlled system-configuration acceptance test. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The proposed intervention is: Place environment setup in the appropriate login profile and source an interactive rc file only when suitable. Which independent result BEST demonstrates a successful correction?

  1. The independent acceptance evidence for Riverton Research is: Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.
  2. The independent acceptance evidence for Riverton Research is: A test file whose name includes spaces is processed once and an absent path follows the error branch.
  3. The independent acceptance evidence for Riverton Research is: The script runs from its executable path in a clean environment and passes success and failure branch tests.
  4. The independent acceptance evidence for Riverton Research is: Unit tests for all command success and failure combinations take only the intended branch.

Explanation

Correct Answer

A:

Success requires both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. That result tests the previously observed condition: comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Bash login startup files and interactive nonlogin rc files have different execution paths.

Incorrect Answers

B:

At Riverton Research, another acceptance finding might be: A test file whose name includes spaces is processed once and an absent path follows the error branch. That would still leave the reported failure unproven. An acceptance test must show that both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

C:

At Riverton Research, a different acceptance result would be: The script runs from its executable path in a clean environment and passes success and failure branch tests. It may validate a separate setting, but not the required action: place environment setup in the appropriate login profile and source an interactive rc file only when suitable. The required observation is both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

D:

The independent acceptance evidence for Riverton Research is: Unit tests for all command success and failure combinations take only the intended branch. The evidence relevant to this incident is comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Confirm the corresponding recovery result: Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

Question 14

At fictional Riverton Research, the Linux shell and scripting team is working during a controlled system-configuration acceptance test. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The relevant evidence is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Which Linux administration principle MOST accurately explains the correct response?

  1. The relevant Linux system principle for Riverton Research is: Shell word splitting and pathname expansion occur on unquoted parameter expansions.
  2. The relevant Linux system principle for Riverton Research is: Bash login startup files and interactive nonlogin rc files have different execution paths.
  3. The relevant Linux system principle for Riverton Research is: A shebang selects the interpreter; shell dialect-specific features are not interchangeable.
  4. The relevant Linux system principle for Riverton Research is: The shell evaluates AND and OR operators by control-flow rules rather than natural-language intent.

Explanation

Correct Answer

B:

The governing distinction is that Bash login startup files and interactive nonlogin rc files have different execution paths. Here, comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Incorrect Answers

A:

A competing Linux principle for Riverton Research is: Shell word splitting and pathname expansion occur on unquoted parameter expansions. The decisive observation, comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization, requires a different explanation: Bash login startup files and interactive nonlogin rc files have different execution paths.

C:

A different principle is: the relevant Linux system principle for Riverton Research is: A shebang selects the interpreter; shell dialect-specific features are not interchangeable. The causal link actually supported by comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization is Bash login startup files and interactive nonlogin rc files have different execution paths.

D:

A competing Linux principle for Riverton Research is: The shell evaluates AND and OR operators by control-flow rules rather than natural-language intent. However, it does not explain comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The applicable principle is that Bash login startup files and interactive nonlogin rc files have different execution paths.

Question 15

At fictional Riverton Research, the Linux shell and scripting team is working during a controlled system-configuration acceptance test. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The decisive evidence is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Which paired action and independent proof BEST satisfies the requirement?

  1. For Riverton Research, the Linux support team should: Scoped correction: Quote pathname expansions and validate parameters before invoking the file utility. Independent acceptance: A test file whose name includes spaces is processed once and an absent path follows the error branch.
  2. For Riverton Research, the Linux support team should: Scoped correction: Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently. Independent acceptance: The script runs from its executable path in a clean environment and passes success and failure branch tests.
  3. For Riverton Research, the Linux support team should: Scoped correction: Place environment setup in the appropriate login profile and source an interactive rc file only when suitable. Independent acceptance: Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.
  4. For Riverton Research, the Linux support team should: Scoped correction: Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths. Independent acceptance: Unit tests for all command success and failure combinations take only the intended branch.

Explanation

Correct Answer

C:

Verify the change by checking that both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. The original clue was comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The test is meaningful because Bash login startup files and interactive nonlogin rc files have different execution paths.

Incorrect Answers

A:

Even verifying scoped correction: Quote pathname expansions and validate parameters before invoking the file utility. Independent acceptance: A test file whose name includes spaces is processed once and an absent path follows the error branch leaves the reported failure unproven. An acceptance test must show that both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

B:

The alternative outcome is scoped correction: Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently. Independent acceptance: The script runs from its executable path in a clean environment and passes success and failure branch tests. It may validate a separate setting, but not the required action: place environment setup in the appropriate login profile and source an interactive rc file only when suitable. The required observation is both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

D:

Scoped correction: Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths. Independent acceptance: Unit tests for all command success and failure combinations take only the intended branch. The evidence relevant to this incident is comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Confirm the corresponding recovery result: Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

Question 16

At fictional Northshore Engineering, the Linux shell and scripting team is working while investigating an observed production-like support incident. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The diagnostic evidence is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Which bounded step BEST resolves the described problem?

  1. For Northshore Engineering, the Linux support team should: Quote pathname expansions and validate parameters before invoking the file utility.
  2. For Northshore Engineering, the Linux support team should: Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently.
  3. For Northshore Engineering, the Linux support team should: Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths.
  4. For Northshore Engineering, the Linux support team should: Place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Explanation

Correct Answer

D:

Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Instead of unrelated changes, place environment setup in the appropriate login profile and source an interactive rc file only when suitable. The expected result is both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. Preserve this constraint during the change: Never assume every remote command sources ~/.bashrc or that a GUI terminal starts a login shell.

Incorrect Answers

A:

Quote pathname expansions and validate parameters before invoking the file utility. It could be useful for another problem, but it does not change comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The response needs to place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

B:

An alternative action is select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently. This incident instead involves comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Confirm the scoped change through both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

C:

Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths. That would not correct the reported comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The supported response is to place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Question 17

At fictional Northshore Engineering, the Linux shell and scripting team is working while investigating an observed production-like support incident. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. Which observation MOST directly supports the underlying diagnosis before any changes are made?

  1. The deciding Linux diagnostic evidence for Northshore Engineering is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization.
  2. The deciding Linux diagnostic evidence for Northshore Engineering is: Tracing shows a variable expanded unquoted in a file test and command argument.
  3. The deciding Linux diagnostic evidence for Northshore Engineering is: The shebang selects sh while the body uses Bash-specific conditional syntax.
  4. The deciding Linux diagnostic evidence for Northshore Engineering is: A trace of exit statuses and short-circuit operators shows the recovery command is reached in a success path.

Explanation

Correct Answer

A:

Look for the recorded condition: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. That is decisive because Bash login startup files and interactive nonlogin rc files have different execution paths. Correction should target place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Incorrect Answers

B:

A competing Linux diagnostic finding for Northshore Engineering is: Tracing shows a variable expanded unquoted in a file test and command argument. That finding does not isolate the reported issue: an engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The determining evidence is comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization.

C:

At Northshore Engineering, that alternative suggests: The shebang selects sh while the body uses Bash-specific conditional syntax. The actual diagnostic record shows comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization instead. The difference matters because Bash login startup files and interactive nonlogin rc files have different execution paths.

D:

At Northshore Engineering, another potential finding is: A trace of exit statuses and short-circuit operators shows the recovery command is reached in a success path. That would not establish the cause here. Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The case-specific correction is to place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Question 18

At fictional Northshore Engineering, the Linux shell and scripting team is working while investigating an observed production-like support incident. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The proposed intervention is: Place environment setup in the appropriate login profile and source an interactive rc file only when suitable. Which independent result BEST demonstrates a successful correction?

  1. The independent acceptance evidence for Northshore Engineering is: A test file whose name includes spaces is processed once and an absent path follows the error branch.
  2. The independent acceptance evidence for Northshore Engineering is: Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.
  3. The independent acceptance evidence for Northshore Engineering is: The script runs from its executable path in a clean environment and passes success and failure branch tests.
  4. The independent acceptance evidence for Northshore Engineering is: Unit tests for all command success and failure combinations take only the intended branch.

Explanation

Correct Answer

B:

To close the incident, demonstrate that both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. That addresses comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization and reflects the rule that Bash login startup files and interactive nonlogin rc files have different execution paths.

Incorrect Answers

A:

A separate test at Northshore Engineering could show: A test file whose name includes spaces is processed once and an absent path follows the error branch. That would not demonstrate closure of this condition. The needed proof is both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

C:

The independent acceptance evidence for Northshore Engineering is: The script runs from its executable path in a clean environment and passes success and failure branch tests. That does not demonstrate the case-specific success condition: both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. Bash login startup files and interactive nonlogin rc files have different execution paths.

D:

The independent acceptance evidence for Northshore Engineering is: Unit tests for all command success and failure combinations take only the intended branch. That result does not test the original problem, identified by comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Recovery must show that both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

Question 19

At fictional Northshore Engineering, the Linux shell and scripting team is working while investigating an observed production-like support incident. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The relevant evidence is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Which Linux administration principle MOST accurately explains the correct response?

  1. The relevant Linux system principle for Northshore Engineering is: Shell word splitting and pathname expansion occur on unquoted parameter expansions.
  2. The relevant Linux system principle for Northshore Engineering is: A shebang selects the interpreter; shell dialect-specific features are not interchangeable.
  3. The relevant Linux system principle for Northshore Engineering is: Bash login startup files and interactive nonlogin rc files have different execution paths.
  4. The relevant Linux system principle for Northshore Engineering is: The shell evaluates AND and OR operators by control-flow rules rather than natural-language intent.

Explanation

Correct Answer

C:

Bash login startup files and interactive nonlogin rc files have different execution paths. That explains the observed condition: comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. The scoped response is to place environment setup in the appropriate login profile and source an interactive rc file only when suitable.

Incorrect Answers

A:

At Northshore Engineering, another Linux system principle is: Shell word splitting and pathname expansion occur on unquoted parameter expansions. The present evidence is comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization, which instead follows from Bash login startup files and interactive nonlogin rc files have different execution paths.

B:

A competing Linux principle for Northshore Engineering is: A shebang selects the interpreter; shell dialect-specific features are not interchangeable. This describes another relationship, not the cause of an engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. Bash login startup files and interactive nonlogin rc files have different execution paths.

D:

At Northshore Engineering, a different Linux system principle is: The shell evaluates AND and OR operators by control-flow rules rather than natural-language intent does not account for comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. This case is governed by Bash login startup files and interactive nonlogin rc files have different execution paths.

Question 20

At fictional Northshore Engineering, the Linux shell and scripting team is working while investigating an observed production-like support incident. The Linux scenario is: An engineer puts an exported application directory in ~/.bashrc, but an SSH login launched with the user's login shell cannot locate the tool. The decisive evidence is: Comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Which paired action and independent proof BEST satisfies the requirement?

  1. For Northshore Engineering, the Linux support team should: Scoped correction: Quote pathname expansions and validate parameters before invoking the file utility. Independent acceptance: A test file whose name includes spaces is processed once and an absent path follows the error branch.
  2. For Northshore Engineering, the Linux support team should: Scoped correction: Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently. Independent acceptance: The script runs from its executable path in a clean environment and passes success and failure branch tests.
  3. For Northshore Engineering, the Linux support team should: Scoped correction: Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths. Independent acceptance: Unit tests for all command success and failure combinations take only the intended branch.
  4. For Northshore Engineering, the Linux support team should: Scoped correction: Place environment setup in the appropriate login profile and source an interactive rc file only when suitable. Independent acceptance: Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

Explanation

Correct Answer

D:

Both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. This measures whether the response corrected comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization rather than merely completing a configuration step.

Incorrect Answers

A:

A test that scoped correction: Quote pathname expansions and validate parameters before invoking the file utility. Independent acceptance: A test file whose name includes spaces is processed once and an absent path follows the error branch would not demonstrate closure of this condition. The needed proof is both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

B:

Scoped correction: Select a supported Bash shebang for Bash syntax or rewrite the script using POSIX shell constructs consistently. Independent acceptance: The script runs from its executable path in a clean environment and passes success and failure branch tests. That does not demonstrate the case-specific success condition: both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries. Bash login startup files and interactive nonlogin rc files have different execution paths.

C:

Scoped correction: Use explicit if/then/else statements or carefully grouped tests for required success and recovery paths. Independent acceptance: Unit tests for all command success and failure combinations take only the intended branch. That result does not test the original problem, identified by comparison of login and nonlogin shell environments shows PATH differs and the user's login profile does not source the expected initialization. Recovery must show that both a fresh login shell and an interactive child find the approved binary without duplicate PATH entries.

LPI Level 1 (102-500) Practice Tests