Question 110
Netplan YAML has been reviewed and the new definition must be activated without a confirmation timeout. Which command applies it?
- netplan apply
- /etc/resolv.conf
- netplan try
- nmcli connection modify
Explanation
Correct Answer
A:netplan apply generates and activates backend networking configuration. Care is needed on remote hosts because an incorrect route can sever the session.
Incorrect Answers
B:resolv.conf exposes resolver configuration, often generated by NetworkManager or systemd-resolved; it answers a neighboring question rather than activating a saved Netplan configuration.
C:netplan try temporarily applies a candidate configuration and reverts it if not confirmed; that changes a different part of the system; the requested outcome is activating a saved Netplan configuration.
D:nmcli edits NetworkManager connection profiles, including addresses, gateways and DNS; this does not achieve activating a saved Netplan configuration on the system described.
Question 111
A space-delimited text report needs the third field printed from each record. Which tool handles field-oriented processing?
- tr '[:lower:]' '[:upper:]'
- awk '{print $3}' report.txt
- wc -l export.csv
- sort -n values.txt
Explanation
Correct Answer
B:awk evaluates an action per input record, with $3 referring to the third whitespace-delimited field by default. Its field separator is configurable.
Incorrect Answers
A:tr translates matching characters in a byte or character stream using supplied sets; using it would leave projecting the third field of each row unresolved.
C:wc -l counts newline characters in a text stream; it does not deliver projecting the third field of each row, which is decisive in this scenario.
D:sort -n compares numerical values instead of plain character ordering; the evidence calls for projecting the third field of each row, not merely this separate operation.
Question 112
A text stream should convert lowercase ASCII characters to uppercase without using an editor. Which command performs this?
- xargs
- uniq
- tr '[:lower:]' '[:upper:]'
- wc -l export.csv
Explanation
Correct Answer
C:tr translates matching characters in a byte or character stream using supplied sets. It does not perform context-sensitive multi-line substitutions.
Incorrect Answers
A:xargs constructs command arguments from input items; its scope differs from translating letter case in a stream, so it cannot meet the stated requirement.
B:uniq removes consecutively repeated input records rather than converting character encodings or letter case; that is not equivalent to translating letter case in a stream.
D:wc -l counts newline characters in a text stream; it answers a neighboring question rather than translating letter case in a stream.
Question 113
A list of filenames on stdin should become arguments for a repeated utility invocation. Which tool is designed for that?
- tr '[:lower:]' '[:upper:]'
- sed 's/old/new/g' config.ini
- sort -n values.txt
- xargs
Explanation
Correct Answer
D:xargs constructs command arguments from input items. Null-delimited operation with -0 is safer for arbitrary filenames containing spaces or newlines.
Incorrect Answers
A:tr translates matching characters in a byte or character stream using supplied sets; this does not achieve converting input records to command arguments on the system described.
B:sed transforms text as it passes through its editing script; it will not provide converting input records to command arguments under these conditions.
C:sort -n compares numerical values instead of plain character ordering; using it would leave converting input records to command arguments unresolved.
Question 114
Command output should both appear in the terminal and be saved to a file. Which pipeline element does that?
- tee output.log
- command 2>error.log
- command <<< "$value"
- Here-document with <<EOF
Explanation
Correct Answer
A:tee reads standard input and writes copies to standard output and named files. It can be inserted into a pipeline without discarding live display.
Incorrect Answers
B:File descriptor 2 represents standard error in the shell; the task involves splitting a pipeline stream to screen and file, whereas this addresses another subsystem.
C:A Bash here-string supplies a string to standard input, with a terminating newline; its scope differs from splitting a pipeline stream to screen and file, so it cannot meet the stated requirement.
D:A here-document provides literal or expanded lines as standard input until a delimiter is reached; that is not equivalent to splitting a pipeline stream to screen and file.
Question 115
A file must supply standard input to a command that reads from stdin. Which syntax uses input redirection?
- tee output.log
- command <<< "$value"
- command >> logfile
- command 2>error.log
- command < input.txt
Explanation
Correct Answer
E:The less-than operator opens a file as standard input for the process. It does not send the process's output into that file.
Incorrect Answers
A:tee reads standard input and writes copies to standard output and named files; it answers a neighboring question rather than feeding a process's standard input from disk.
B:A Bash here-string supplies a string to standard input, with a terminating newline; that changes a different part of the system; the requested outcome is feeding a process's standard input from disk.
C:Double greater-than redirects standard output in append mode; this does not achieve feeding a process's standard input from disk on the system described.
D:File descriptor 2 represents standard error in the shell; it will not provide feeding a process's standard input from disk under these conditions.
Question 116
In Vim normal mode, which keystroke saves the current buffer and exits the editor?
- tail -n 30 service.log
- Ctrl+O in nano
- PATH
- :wq
Explanation
Correct Answer
D:The :wq Ex command writes the buffer and quits when successful. It differs from quitting while discarding unsaved changes.
Incorrect Answers
A:tail selects records from the end of a file and can optionally follow new appends; the requirement is writing changes and exiting Vim, outside the effect of this choice.
B:Nano's Write Out shortcut prompts for the destination filename and saves the text; it does not deliver writing changes and exiting Vim, which is decisive in this scenario.
C:PATH is an ordered list of directories searched for external commands without slash-containing paths; the evidence calls for writing changes and exiting Vim, not merely this separate operation.
Question 117
A GUI application started through SSH needs to know where its X display is located. Which environment variable is relevant?
- HOME
- DISPLAY
- source ./env.sh
- PATH
- PS1
- ~/.bashrc
Explanation
Correct Answer
B:DISPLAY identifies the X server connection for X11 clients. Setting it alone does not provide authorization or X11 forwarding transport.
Incorrect Answers
A:HOME normally contains the current account's configured home path; that is not equivalent to directing X11 clients to a display.
C:source executes shell code in the current shell rather than launching an independent process; it answers a neighboring question rather than directing X11 clients to a display.
D:PATH is an ordered list of directories searched for external commands without slash-containing paths; that changes a different part of the system; the requested outcome is directing X11 clients to a display.
E:PS1 expands escape sequences into the interactive primary prompt; this does not achieve directing X11 clients to a display on the system described.
F:Bash normally reads ~/.bashrc for interactive non-login sessions; it will not provide directing X11 clients to a display under these conditions.
Question 118
A sorted input stream contains adjacent duplicate lines and the operator wants one of each. Which utility is appropriate?
- tr '[:lower:]' '[:upper:]'
- sort -n values.txt
- cut -d: -f1 input.txt
- uniq
Explanation
Correct Answer
D:uniq removes consecutively repeated input records rather than converting character encodings or letter case. Sorting first is required when matching lines are separated.
Incorrect Answers
A:tr translates matching characters in a byte or character stream using supplied sets; it will not provide removing adjacent repeated records under these conditions.
B:sort -n compares numerical values instead of plain character ordering; using it would leave removing adjacent repeated records unresolved.
C:cut can extract selected delimiter-separated fields; the requirement is removing adjacent repeated records, outside the effect of this choice.
Question 119
A one-line string must be passed as standard input to a command without echo. Which form uses a here-string?
- tee output.log
- Here-document with <<EOF
- command 2>error.log
- command <<< "$value"
Explanation
Correct Answer
D:A Bash here-string supplies a string to standard input, with a terminating newline. It differs from a here-document's multi-line delimiter structure.
Incorrect Answers
A:tee reads standard input and writes copies to standard output and named files; the task involves streaming a short variable value into stdin, whereas this addresses another subsystem.
B:A here-document provides literal or expanded lines as standard input until a delimiter is reached; its scope differs from streaming a short variable value into stdin, so it cannot meet the stated requirement.
C:File descriptor 2 represents standard error in the shell; that is not equivalent to streaming a short variable value into stdin.
Question 120
An interactive non-login Bash shell must load user aliases automatically. Which startup file is commonly used?
- DISPLAY
- ~/.bashrc
- PS1
- source ./env.sh
Explanation
Correct Answer
B:Bash normally reads ~/.bashrc for interactive non-login sessions. Login-shell startup may involve files such as ~/.bash_profile instead.
Incorrect Answers
A:DISPLAY identifies the X server connection for X11 clients; that changes a different part of the system; the requested outcome is configuring interactive non-login Bash behavior.
C:PS1 expands escape sequences into the interactive primary prompt; it will not provide configuring interactive non-login Bash behavior under these conditions.
D:source executes shell code in the current shell rather than launching an independent process; using it would leave configuring interactive non-login Bash behavior unresolved.