Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
16 / 16 published solutions
Question 2 NAT · 3.0 marks
A Linux-like file system uses **index nodes (inodes)** to manage files. A newly formatted volume has
10,000 free inodes. A user performs the following sequential actions:
1. A directory named
is created.
2. Inside
, a script creates a single large data file named
.
3. The script then successfully creates
**hard links** to
within the same
directory, each with a unique name.
4. Finally, the script successfully creates
**symbolic (soft) links**, each pointing to
.
Assume each symbolic link occupies its own inode and hard links do not allocate new inodes.
Assuming no other processes are writing to the volume, what is the total number of **free**
**inodes** remaining on the volume after these actions are completed?
Published solution
**1. Count new objects:** The directory needs one inode and dataset.bin needs one inode. The 1,500 hard links are additional directory entries referring to the same file inode, so they consume no new inodes.
**2. Count symbolic links:** Each of 500 symbolic links has its own inode. Total used is \(1+1+500=502\).
**3. Subtract from the free pool:** \(10000-502=9498\) free inodes remain.
**Answer: 9498.**
A system administrator is configuring a shared project directory. The requirements for three
specific system objects are defined as follows:
1.
: The owner can only read and write to it. Members of the group can only read
it. Everyone else has no access.
2.
: Anyone on the system can read and execute it, but only the owner can modify it.
3.
: It is a directory. The owner and group members have read, write, and execute
permissions on it. External users ("others") have execute permission only, allowing them to
access known files without listing the directory contents.
Which of the following lines matches the correct
**1. Translate each permission requirement:** archive.tar needs rw-r----- (640); deploy.sh needs rwxr-xr-x (755); logs needs rwxrwx--x (771).
**2. Include the object type:** Regular files begin with −, whereas the logs directory begins with d. These produce the lines shown in A, B and D.
**Answer: A, B, D — A, B and D — modes 640, 755 and directory 771.**
A: **Correct:** −rw-r----- gives owner read/write, group read and no others access.
B: **Correct:** −rwxr-xr-x gives everyone read/execute and only the owner write.
C: **Incorrect:** drwxrwxr-x also lets others read/list the directory.
D: **Correct:** drwxrwx--x gives others search/execute without read permission.
E: **Incorrect:** −rw-r--r-- wrongly allows others to read archive.tar.
An administrator uses different variations of regular expressions to extract specific log entries.
Which of the following statements is/are **TRUE** regarding the execution and matching behavior of
these commands?
6406537023184.
The command
will successfully
match and output the line
.
6406537023185.
To make standard
match the same lines as
, the pattern can be rewritten as:
.
6406537023186.
The command
will match
and
, but will exclude
.
6406537023187.
The command
will output nothing
because word boundary assertions (
) are only supported in Extended Regular Expressions (
).
Published solution
**1. Distinguish BRE and ERE:** Ordinary grep uses basic regex: unescaped parentheses and | are literal. In GNU BRE, backslash-prefixed parentheses group, and a backslash-prefixed bar supplies alternation; grep -E uses the unescaped forms.
**2. Apply the word boundary:** In error_404\b, the boundary requires the next character to be non-word or the end of the line. It accepts system_error_404 and error_404 but rejects system_error_4040. GNU grep supports this boundary in both modes.
**Answer: B, C — BRE rewrite and boundary-matching statements B and C.**
**Convention note:** The escaped alternation and word-boundary syntax here use GNU grep extensions.
A: **Incorrect:** The basic pattern searches for literal parentheses and |, so it does not match the displayed line.
B: **Correct:** Escaping the parentheses and alternation bar supplies the equivalent BRE grouping and alternatives.
C: **Correct:** The final \b excludes a following digit.
D: **Incorrect:** GNU basic grep supports \b too; the command prints the two matching lines.
**1. Require the full filename:** Use ^ and $ to anchor both ends, and \. for the literal extension separator.
**2. Choose exactly one digit:** In ERE, (1|2) and [12] each match a single 1 or 2. Therefore A and B match file1.txt and file2.txt without accepting file10.txt or file20.txt.
**Answer: A, B — Commands A and B.**
A: **Correct:** Grouped alternation confines the filename to exactly file1.txt or file2.txt.
B: **Correct:** The character class selects exactly one digit before the literal extension.
C: **Incorrect:** The prefix alternatives also match file10.txt and file20.txt.
D: **Incorrect:** Ungrouped alternation leaves the first branch as the prefix ^file1, which also matches file10.txt.
A system directory contains the following list of files:
•
•
•
•
•
An administrator wants to process a specific subset of these files using the following command:
Which of the following statements correctly describes which files are matched by this command
and why?
6406537023164.
It matches only
because the
wildcard acts as a quantifier
requiring exactly two digits total.
6406537023165.
It matches
and
because the
wildcard
matches any sequence of characters (including empty strings) following the first two digits.
6406537023166.
It matches
,
, and
because wildcards match files based only on the prefix before the first bracket.
6406537023167.
It matches
,
, and
because
matches any single alphanumeric character.
Published solution
**1. Parse the shell glob:** backup_[0-9][0-9]*.tar requires the backup_ prefix, two digit characters, then any additional characters, and the .tar suffix.
**2. Test the candidates:** backup_2025.tar and backup_26.tar match. The .log files have the wrong suffix, and backup_v2.tar fails the first digit requirement.
**Answer: B — backup_2025.tar and backup_26.tar.**
A: **Incorrect:** The glob * is not a repetition operator for the preceding digit class.
B: **Correct:** Both filenames meet the two-digit prefix and .tar suffix requirements.
C: **Incorrect:** backup_2026.log has the wrong extension.
D: **Incorrect:** [0-9] matches a digit, not the letter v.
A DevOps engineer is configuring secure, passwordless SSH access from a local administration
workstation to a remote Linux cloud server. Which of the following operations is correctly
described regarding the placement and management of the keys?
6406537023168.
The private key must be appended to the
file on
the remote server so it can decrypt incoming client challenges.
6406537023169.
Both the public and private keys must be copied to the remote server's
directory to establish trusted mutual identity.
6406537023170.
The public key must be securely transferred and appended to the
file on the remote server, while the private key remains exclusively on
the local workstation.
6406537023171.
The private key is automatically deleted from the local workstation by the
utility once the matching public key is uploaded to the destination server.
Published solution
**1. Place the public credential:** Append the client’s public key to the target remote account’s ~/.ssh/authorized_keys.
**2. Retain the secret locally:** The client uses its private key to sign authentication data. The server checks that signature using the public key; the private key need not be transferred.
**Answer: C — Public key in remote authorized_keys; private key stays local.**
A: **Incorrect:** authorized_keys contains public keys, not private keys.
B: **Incorrect:** Server host keys and user authentication keys serve different roles.
C: **Correct:** The public key is authorized remotely while the client retains its private key.
D: **Incorrect:** ssh-copy-id installs the public key and does not delete the private key.
**1. Match Vim operations:** dd deletes the current line (C); u undoes the last change (D); p puts register contents (B); / begins a forward search (A).
**2. Match Emacs operations:** C-x C-s saves (B); C-s searches incrementally forward (D); C-w kills the region (A); C-y yanks killed text (C).
**Answer: A — Vim 1-C,2-D,3-B,4-A; Emacs 1-B,2-D,3-A,4-C.**
A: **Correct:** Every Vim and Emacs mapping is correct.
B: **Incorrect:** It swaps Vim paste/search and Emacs search/kill.
C: **Incorrect:** It swaps Vim delete/undo and misassigns Emacs save/yank.
D: **Incorrect:** Several delete, undo, search and paste mappings are reversed.
A system administrator writes a maintenance script named
. They attempt to run
the script with the following redirection setup in the terminal:
What is the operational outcome of executing this specific command?
6406537023176.
Both standard output (
) and standard error (
) are appended to
because both redirections use the same filename.
6406537023177.
The command results in a syntax error because the same file cannot be used
for multiple redirections in a single command.
6406537023178.
Both
and
are redirected to
, but the file is
opened independently for each file descriptor. As a result, output from the two streams may
interleave, overwrite portions of each other, or appear in an unpredictable order.
6406537023179.
The shell detects that both streams target the same file and automatically
treats the command as
.
Published solution
**1. Process the redirections:** 2> debug.log opens the file for stderr; > debug.log opens it again for stdout. Both use truncating output redirection.
**2. Track the file offsets:** The two opens have independent offsets rather than sharing a duplicated descriptor. Writes from the streams can overwrite one another or mix, depending on the program’s writes and buffering.
**Answer: C — Independent stdout/stderr opens can overwrite or mix output.**
A: **Incorrect:** > truncates; it does not mean append.
B: **Incorrect:** Separate descriptors may legally redirect to the same pathname.
C: **Correct:** Independent opens create the stated overwrite/mixing risk.
D: **Incorrect:** The shell does not automatically replace separate opens with descriptor duplication.
**1. Select the failure branch:** A || B executes B only if A has a nonzero exit status, so || gives the required fallback.
**2. Filter and save only fallback output:** In A, the grouped fallback runs ./trace_route.sh, pipes its stdout to grep "DROP", and redirects those matched lines to network_errors.log.
**Answer: A — ./ping_server.sh || { ./trace_route.sh | grep "DROP" > network_errors.log; }.**
**Convention note:** For the literal whole-word requirement on arbitrary output, use grep -w "DROP". The offered correct command uses substring matching, so it would also match DROPPED; A is the intended combination.
A: **Correct:** It combines failure-only execution with filtering and file output.
B: **Incorrect:** && runs the fallback on success rather than failure.
C: **Incorrect:** It writes the entire tracer output without filtering.
D: **Incorrect:** It filters but does not save the result to the required file.
**1. Retain the prefix:** head -15 keeps original lines 1–15.
**2. Retain its suffix:** The last \(15-8+1=8\) lines of that prefix are original lines 8–15, so tail -8 selects exactly the requested range.
**Answer: A — cat system.log | head -15 | tail -8.**
A: **Correct:** It takes the last eight lines of the first fifteen.
B: **Incorrect:** It selects from the file’s final fifteen lines, not necessarily its beginning.
C: **Incorrect:** It retains only original lines 1–8.
D: **Incorrect:** It prints the final eight lines of the entire file.
retrieve information about a domain name, such as its server and IP address.
6406537023201.
looks up the number of pings to the domain name "google.com".
6406537023202.
Gets the DNS of the domain on google.com
6406537023203.
none of these
Published solution
**1. Identify the tool:** nslookup queries DNS. For nslookup google.com it reports the responding DNS server and the resolved domain-address information, subject to the DNS response.
**Answer: A — retrieve information about a domain name, such as its server and IP address..**
A: **Correct:** This describes the DNS lookup output.
B: **Incorrect:** It does not count or send ICMP ping requests.
C: **Incorrect:** The command queries configured DNS for google.com; it does not use google.com as a DNS server.
D: **Incorrect:** The first option correctly describes the lookup.
An operator attempts to run a critical update sequence on a production server using the following
two independent commands:
• **Command 1:**
• **Command 2:**
After running both commands, the engineer notices that
**did not execute**, but
**did execute**.
Based on the short-circuit behavior of shell operators, what can be definitively concluded about
the exit statuses of the initial scripts (
and
)?
6406537023204.
exited with a success status (0), and
exited with a failure status (non-zero).
6406537023205.
exited with a failure status (non-zero), and
exited with a success status (0).
6406537023206.
Both
and
exited with a success status
(0).
6406537023207.
Both
and
exited with a failure status
(non-zero).
Published solution
**1. Apply &&:** ./verify_env.sh && ./run_update.sh skips the second script only when verify_env.sh fails, returning nonzero.
**2. Apply ||:** ./check_disk.sh || ./clean_tmp.sh runs clean_tmp.sh when check_disk.sh fails. Thus both initial scripts returned nonzero exit statuses.
**Answer: D — Both initial scripts failed with nonzero status.**
A: **Incorrect:** A successful verification would have run the update.
B: **Incorrect:** A successful disk check would have skipped cleanup.
C: **Incorrect:** Both observed branches indicate failure, not success.
D: **Correct:** Both initial statuses must be nonzero.
**1. Build the exact pattern:** The required form is lowercase node_port=, followed by 80 and exactly two digits, then end of line.
**2. Compare regex forms:** B uses ERE repetition [0-9]{2}; D writes the two digit classes explicitly. Both select node_port=8080, node_port=8085 and node_port=8081 from the supplied file.
**Answer: B, D — B and D — exactly lowercase node_port=80 followed by two digits.**
A: **Incorrect:** .* accepts short, long and nondigit suffixes, including 80a0.
B: **Correct:** The anchors and exactly two trailing digits enforce the required form.
C: **Incorrect:** -i also accepts the uppercase NODE_PORT=8080 line.
D: **Correct:** Two consecutive digit classes enforce the same exact length without -E.
Consider the following standard IPv4 address class ranges:
• Class A:
• Class B:
• Class C:
• Loopback:
A file named
contains a list of various IP addresses. You want to extract **only the lines**
**containing Class B IP addresses** based strictly on their first octet value (ranging from 128 to 191).
Which of the following commands will correctly filter and print these lines?
**1. Split the first-octet range:** 128–191 is the union of 128–129, 130–189 and 190–191.
**2. Encode those intervals:** The alternatives 12[8-9], 1[3-8][0-9], and 19[0-1], anchored at the start and followed by a literal dot, implement exactly that first-octet range.
**Answer: A — grep -E '^(12[8-9]|1[3-8][0-9]|19[0-1])\.' ips.txt.**
**Convention note:** The task assumes valid IPv4 address lines and asks only for first-octet filtering; this expression is not a full IPv4 validator.
A: **Correct:** Its three alternatives cover precisely 128 through 191.
B: **Incorrect:** It matches only the two endpoints 128 and 191.
C: **Incorrect:** A bracket expression is a character class, not an integer range.
D: **Incorrect:** The extra digit classes in the middle alternative do not encode 130–189.
You always start executing each question from the base directory
.
Note: Both questions are to be answered independently, based solely on the directory structure provided
above.
Based on the above data, answer the given subquestions.
You want to perform the following operations:
1. Create a new nested directory path named
directly inside
.
2. Create an empty file named
inside that new
directory.
3. Inside the
directory, create nine new empty test files named
,
,
... up to
.
Which of the following command sets will perform all the above operations correctly?
**1. Create the missing parents:** mkdir -p src/utils/helpers creates both utils and helpers. touch then creates string_utils.py at the required location.
**2. Resolve paths and expansions:** In A, ../../../test from src/utils/helpers reaches /home/developer/test, and test_{1..9}.py expands into nine names. C uses valid relative paths and an explicit comma-list brace expansion.
**Answer: A, C — Command sets A and C.**
A: **Correct:** It creates the hierarchy, returns to the sibling test directory, and expands nine filenames.
B: **Incorrect:** Without -p, mkdir cannot create helpers when src/utils is absent.
C: **Correct:** All paths are correct and the brace list contains the nine requested filenames.
D: **Incorrect:** test_1..9.py is a single literal filename, not a Bash brace expansion.
You always start executing each question from the base directory
.
Note: Both questions are to be answered independently, based solely on the directory structure provided
above.
Based on the above data, answer the given subquestions.
An engineer executes the following command sequence in their terminal, starting from
:
Which of the following statements correctly describes the final outcome and system state after
these commands are run?
6406537023216.
The
file is moved to
, the empty
directory is
successfully deleted, and
lists
.
6406537023217.
The command sequence throws a syntax error on the first line because
must be specified as an absolute path.
6406537023218.
A copy of
is created in
, but the
command fails
with an error because the
directory still contains the original file.
6406537023219.
The entire
directory and its contents are forcefully removed, leaving
ouild
ae completely empty.
Published solution
**1. Apply cp:** cp test/test_core.py build/ creates a copy in build and leaves the original inside test.
**2. Apply rmdir and ls:** rmdir test fails because the directory is not empty. The separate next command ls build still runs and lists test_core.py.
**Answer: C — Copy created; rmdir fails because test remains nonempty.**
A: **Incorrect:** cp copies rather than moves, leaving test nonempty.
B: **Incorrect:** Relative destination paths are valid.
C: **Correct:** It correctly describes the copy, failed directory removal and resulting build content.
D: **Incorrect:** rmdir does not recursively or forcibly delete nonempty directories.