LPI 010-160 Practice Test 1
Question 1
A student wants to see all `.txt` files using filename pattern expansion. Which action BEST accomplishes the stated Linux task?
- Treat a glob as a command executable rather than an argument.
- Assume a quoted asterisk always matches every filename.
- Use `*.txt` unquoted for matching filenames and quote it when literal text is intended.
- Replace all wildcard patterns with regular expression anchors.
Explanation
Correct Answer
C:Use `*.txt` unquoted for matching filenames and quote it when literal text is intended. Shell globbing occurs before the command runs and quoting controls it. To confirm completion, the unquoted glob expands to matching filenames while the quoted pattern remains literal.
Incorrect Answers
A:Treat a glob as a command executable rather than an argument. It would not produce the expected result: The unquoted glob expands to matching filenames while the quoted pattern remains literal. The named operation concerns Globbing versus literal pattern.
B:Passing the wrong quoted form can make a command use a literal asterisk as a pathname. This changes the workflow in the wrong way for Globbing versus literal pattern.
D:Replace all wildcard patterns with regular expression anchors. It does not meet the requirement in this case: A student wants to see all `.txt` files using filename pattern expansion. Shell globbing occurs before the command runs and quoting controls it.
Question 2
A maker wants a Linux-based operating system for a Raspberry Pi learning kit. Which action BEST accomplishes the stated Linux task?
- Install a board-compatible Raspberry Pi OS image and verify the device model and architecture.
- Choose a Windows device driver instead of a Linux distribution image.
- Flash an x86-only installation image to any ARM board.
- Assume every Linux ISO supports every single-board computer.
Explanation
Correct Answer
A:Install a board-compatible Raspberry Pi OS image and verify the device model and architecture. Raspberry Pi OS is a Debian-derived Linux distribution built for supported Raspberry Pi hardware. To confirm completion, the board boots to a usable Linux userspace with the expected peripherals supported.
Incorrect Answers
B:Choose a Windows device driver instead of a Linux distribution image. It does not meet the requirement in this case: A maker wants a Linux-based operating system for a Raspberry Pi learning kit. Raspberry Pi OS is a Debian-derived Linux distribution built for supported Raspberry Pi hardware.
C:This changes the workflow in the wrong way for Raspberry Pi Linux deployment.
D:Assume every Linux ISO supports every single-board computer. It would not produce the expected result: The board boots to a usable Linux userspace with the expected peripherals supported. The named operation concerns Raspberry Pi Linux deployment.
Question 3
An administrator needs documentation distributed in GNU Info format. Which action BEST accomplishes the stated Linux task?
- Expect `rmdir` to display an Info manual.
- Run a browser command without opening the requested local documentation.
- Use `chmod` to navigate Info nodes.
- Open `info` for the intended subject and follow its node navigation.
Explanation
Correct Answer
D:Open `info` for the intended subject and follow its node navigation. GNU Info documents are organized as hypertext-style nodes, distinct from plain file listings. To confirm completion, a navigable set of linked Info nodes is available.
Incorrect Answers
A:Expect `rmdir` to display an Info manual. It does not meet the requirement in this case: An administrator needs documentation distributed in GNU Info format. GNU Info documents are organized as hypertext-style nodes, distinct from plain file listings.
B:Run a browser command without opening the requested local documentation. It would not produce the expected result: A navigable set of linked Info nodes is available. The named operation concerns Info documentation navigation.
C:Use `chmod` to navigate Info nodes. This changes the workflow in the wrong way for Info documentation navigation. Treating Info as a command-execution shell does not reveal documentation. For this task the appropriate operation is to open `info` for the intended subject and follow its node navigation.
Question 4
A monitoring script needs the last ten lines of an activity log. Which action BEST accomplishes the stated Linux task?
- Use `sort` to read only the newest appended lines.
- Use `cut` to choose file start and end by timestamps.
- Use `tail -n 10 log` for the end or `head -n 5 file` for the beginning.
- Use `head` to guarantee the final log lines.
Explanation
Correct Answer
C:Use `tail -n 10 log` for the end or `head -n 5 file` for the beginning. `head` selects beginning lines and `tail` selects ending lines. To confirm completion, only the requested prefix or suffix lines appear.
Incorrect Answers
A:Use `sort` to read only the newest appended lines. It does not meet the requirement in this case: A monitoring script needs the last ten lines of an activity log. `head` selects beginning lines and `tail` selects ending lines.
B:Use `cut` to choose file start and end by timestamps. It would not produce the expected result: Only the requested prefix or suffix lines appear. The named operation concerns head and tail line selection.
D:This changes the workflow in the wrong way for head and tail line selection.
Question 5
A user deletes a symlink target and later receives no-such-file errors following the link. Which action BEST accomplishes the stated Linux task?
- Run `chmod 777 link` as a guaranteed way to restore a missing target.
- Change the link's display color to reconstruct its target.
- Assume every symbolic link contains a full independent copy of target bytes.
- Inspect the symbolic link target and repair or recreate the link with a valid path.
Explanation
Correct Answer
D:Inspect the symbolic link target and repair or recreate the link with a valid path. Symbolic links can dangle when their targets are removed or relocated. To confirm completion, the repaired link resolves to an existing target pathname.
Incorrect Answers
A:Run `chmod 777 link` as a guaranteed way to restore a missing target. It does not meet the requirement in this case: A user deletes a symlink target and later receives no-such-file errors following the link. Symbolic links can dangle when their targets are removed or relocated.
B:Change the link's display color to reconstruct its target. It would not produce the expected result: The repaired link resolves to an existing target pathname. The named operation concerns Dangling symbolic links.
C:This changes the workflow in the wrong way for Dangling symbolic links.
Question 6
A student compares Android phones with GNU/Linux desktop distributions. Which action BEST accomplishes the stated Linux task?
- Claim Android relies on the Windows NT kernel.
- Explain that Android uses the Linux kernel with an Android-specific userspace and application framework.
- Assume every GNU/Linux desktop binary runs unchanged as an Android app.
- Infer all Android devices expose a conventional Bash login shell.
Explanation
Correct Answer
B:Explain that Android uses the Linux kernel with an Android-specific userspace and application framework. Kernel lineage does not require Android to use a conventional GNU desktop userspace. To confirm completion, the architecture identifies a Linux kernel underneath Android system services.
Incorrect Answers
A:This changes the workflow in the wrong way for Android Linux kernel relationship.
C:Assume every GNU/Linux desktop binary runs unchanged as an Android app. It does not meet the requirement in this case: A student compares Android phones with GNU/Linux desktop distributions. Kernel lineage does not require Android to use a conventional GNU desktop userspace.
D:Infer all Android devices expose a conventional Bash login shell. It would not produce the expected result: The architecture identifies a Linux kernel underneath Android system services. The named operation concerns Android Linux kernel relationship.
Question 7
A host can ping an IP address but cannot resolve any domain names. Which action BEST accomplishes the stated Linux task?
- Remove the default gateway as the only DNS fix.
- Treat the host's CPU clock as a nameserver configuration.
- Edit `/etc/hosts` expecting to change every upstream DNS server.
- Inspect `/etc/resolv.conf` or the system's effective resolver configuration.
Explanation
Correct Answer
D:Inspect `/etc/resolv.conf` or the system's effective resolver configuration. DNS converts names into addresses and is separate from IP routing. To confirm completion, the configured DNS resolver addresses are available for diagnosis.
Incorrect Answers
A:Remove the default gateway as the only DNS fix. It does not meet the requirement in this case: A host can ping an IP address but cannot resolve any domain names. DNS converts names into addresses and is separate from IP routing.
B:Treat the host's CPU clock as a nameserver configuration. It would not produce the expected result: The configured DNS resolver addresses are available for diagnosis. The named operation concerns DNS resolver configuration.
C:Edit `/etc/hosts` expecting to change every upstream DNS server. This changes the workflow in the wrong way for DNS resolver configuration. Broken resolver settings can affect names while raw IP connectivity still works. For this task the appropriate operation is to inspect `/etc/resolv.conf` or the system's effective resolver configuration.
Question 8
A report generator must replace the old contents of an output file. Which action BEST accomplishes the stated Linux task?
- Use `>` to overwrite stdout to a file and `>>` to append stdout to the file.
- Use `>` when the requirement is to keep all earlier lines.
- Assume `>>` always truncates the file first.
- Use `|` to create a persistent output file without a receiving command.
Explanation
Correct Answer
A:Use `>` to overwrite stdout to a file and `>>` to append stdout to the file. Shell redirection changes file-writing behavior before a program processes its arguments. To confirm completion, the target file is replaced or extended according to the chosen operator.
Incorrect Answers
B:This changes the workflow in the wrong way for Redirecting output and append.
C:Assume `>>` always truncates the file first. It does not meet the requirement in this case: A report generator must replace the old contents of an output file. Shell redirection changes file-writing behavior before a program processes its arguments.
D:Use `|` to create a persistent output file without a receiving command. It would not produce the expected result: The target file is replaced or extended according to the chosen operator. The named operation concerns Redirecting output and append.
Question 9
A command and configuration file share the name `passwd` in documentation. Which action BEST accomplishes the stated Linux task?
- Rename the file to change its manual section.
- Specify the manual section, for example `man 5 passwd`, when the subject is the file format.
- Use `man 1 passwd` to read `/etc/passwd` file syntax.
- Assume a shared name means all manual sections contain identical text.
Explanation
Correct Answer
B:Specify the manual section, for example `man 5 passwd`, when the subject is the file format. Manual sections separate user commands from formats and other interfaces. To confirm completion, the selected manual describes the requested topic rather than the other same-named entry.
Incorrect Answers
A:Rename the file to change its manual section. It would not produce the expected result: The selected manual describes the requested topic rather than the other same-named entry. The named operation concerns Manual sections for commands and config.
C:Use `man 1 passwd` to read `/etc/passwd` file syntax. It does not meet the requirement in this case: A command and configuration file share the name `passwd` in documentation. Manual sections separate user commands from formats and other interfaces.
D:This changes the workflow in the wrong way for Manual sections for commands and config.
Question 10
A file contains unsorted usernames and must be alphabetized. Which action BEST accomplishes the stated Linux task?
- Run `grep . file` expecting a sorted result.
- Run `sort file` or pipe records into sort.
- Use `tail -n 10` as the sorting command.
- Use `wc -l file` to alphabetize rows.
Explanation
Correct Answer
B:Run `sort file` or pipe records into sort. `sort` orders lines while other tools filter or count them. To confirm completion, the resulting output is ordered according to the active locale's sort rules.
Incorrect Answers
A:Run `grep . file` expecting a sorted result. It does not meet the requirement in this case: A file contains unsorted usernames and must be alphabetized. `sort` orders lines while other tools filter or count them.
C:Use `tail -n 10` as the sorting command. It would not produce the expected result: The resulting output is ordered according to the active locale's sort rules. The named operation concerns sort text records.
D:Use `wc -l file` to alphabetize rows. This changes the workflow in the wrong way for sort text records. Counting lines does not put records in lexical order. For this task the appropriate operation is to run `sort file` or pipe records into sort.