Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.
15 / 17 published solutions
Question 128 MCQ · 2.0 marks
6406535115703.
(A)
6406535115704.
(B)
**System commands**
**Section Id :** 640653106046
**Section Number :** 8
**Section type :** Online
**Mandatory or Optional :** Mandatory
**Number of Questions :** 16
**Number of Questions to be attempted :** 16
**Section Marks :** 50
**Display Number Panel :** Yes
**Section Negative Marks :** 0
**Group All Questions :** No
**Enable Mark as Answered Mark for Review and**
No
**Clear Response :**
**Section Maximum Duration :** 0
**Section Minimum Duration :** 0
**Section Time In :** Minutes
**Maximum Instruction Time :** 0
A published solution is not available for this question yet.
**1. Follow the hard link:** ln data.txt hardlink_data creates another name for data.txt’s inode, without copying its data.
**2. Follow the symbolic link:** ln -s creates softlink_data as a separate inode storing the path data.txt. Thus the two regular-file names share an inode and the symlink has its own.
**Answer: A — data.txt and hardlink_data share an inode; softlink_data differs.**
A: **Correct:** It correctly separates hard-link identity from symbolic-link storage.
B: **Incorrect:** The symbolic link has a distinct inode.
C: **Incorrect:** This reverses the two link types.
D: **Incorrect:** The two hard-linked names share one inode.
Owner can only execute, group can only write, others can read
6406535115732.
Owner can read and execute, group can read and execute, others can read
6406535115733.
Owner can read and execute, group can write and execute, others can read
6406535115734.
Owner can read and execute, group can read and write, others can read and
write
Published solution
**1. Decode the octal digits:** Read=4, write=2, execute=1. Mode 554 gives owner \(5=4+1\), group \(5=4+1\), others \(4\).
**2. Translate to permissions:** Owner and group can read and execute; others can read. No category receives write permission.
**Answer: B — Owner/group read and execute; others read.**
A: **Incorrect:** The owner also has read, and the group has no write.
B: **Correct:** It matches r-x r-x r--.
C: **Incorrect:** The group has read rather than write.
D: **Incorrect:** No category has write permission.
**1. Restrict the filename:** sales_[a-z].csv contains exactly one lowercase-letter position between sales_ and .csv.
**2. Count results:** The shell expands that glob to the matching files; piping the ordinary ls listing to wc -l counts them.
**Answer: D — ls /home/user/Data/sales_[a-z].csv | wc -l.**
**Convention note:** This course-style counting pipeline assumes ordinary matching filenames and at least one match.
A: **Incorrect:** * allows any number and type of intervening characters.
B: **Incorrect:** ? allows any single character, including a digit.
C: **Incorrect:** [a-z]? requires two intervening characters.
D: **Correct:** [a-z] requires exactly one lowercase letter.
**1. Identify the network-status tool:** netstat displays socket and network-connection information, including local port numbers. Options such as -l and -n are used when specifically listing listening sockets numerically.
**Answer: A — netstat.**
**Convention note:** Bare netstat normally shows active sockets; netstat -lntu is a more specific command for listening TCP/UDP ports.
A: **Correct:** It reports local network sockets and port information.
B: **Incorrect:** whois retrieves registration information.
C: **Incorrect:** Wireshark captures packets rather than directly listing local listening sockets.
D: **Incorrect:** nslookup queries DNS.
**1. Replace throughout Vim:** :%s/Hello/Hi/g applies substitution to every line (%) and every occurrence per line (g); :wq writes and quits.
**2. Replace throughout nano:** Ctrl+\ starts replacement. Enter Hello and Hi, choose A for all matches, then Ctrl+O, Enter writes the file and Ctrl+X exits.
**Answer: B — Global substitution in Vim and Replace All in nano.**
A: **Incorrect:** :s without a range operates on the current line only.
B: **Correct:** It uses each editor’s global replacement workflow and saves the result.
C: **Incorrect:** The search/overwrite and delete shortcuts do not perform an all-occurrences replacement.
D: **Incorrect:** Deleting a line and inserting Hi does not preserve the rest of the file.
**1. Identify the streams:** Normal output is descriptor 1; error output is descriptor 2.
**2. Redirect only errors:** ./deploy.sh 2> errors.txt sends descriptor 2 to the file while leaving descriptor 1 connected to the terminal.
**Answer: C — ./deploy.sh 2> errors.txt.**
A: **Incorrect:** > redirects normal output, contrary to the request.
B: **Incorrect:** It discards normal output and does not save errors.
C: **Correct:** It redirects only stderr and leaves stdout visible.
D: **Incorrect:** &> redirects both streams into the file.
**1. Combine both inputs:** cat intro.txt summary.txt emits both files’ contents in sequence.
**2. Sort and overwrite:** The pipe feeds their combined lines to sort; > full_report.txt saves the sorted result and truncates any previous content.
**Answer: D — cat intro.txt summary.txt | sort > full_report.txt.**
A: **Incorrect:** cat with a named summary.txt does not also consume the piped intro.txt stream.
B: **Incorrect:** >> appends instead of overwriting.
C: **Incorrect:** It saves only intro.txt and sends the second sorted stream to the terminal.
D: **Correct:** It combines, sorts and overwrites the requested destination.
Lines starting with 3 letters and containing 2 digits anywhere.
6406535115760.
Lines containing exactly 3 letters followed by exactly 2 digits.
6406535115761.
Lines ending with 2 digits.
6406535115762.
Any line containing at least 3 letters and 2 digits.
Published solution
**1. Parse the counts:** In grep -E, [A-Za-z]{3} requires three letters and [0-9]{2} requires two following digits.
**2. Apply the anchors:** ^ and $ require that exact five-character pattern to occupy the whole line, such as Abc12, with no prefix or suffix.
**Answer: B — Exactly three letters followed by exactly two digits.**
A: **Incorrect:** The digits must immediately follow the three letters and end the line.
B: **Correct:** Exactly three letters followed by exactly two digits form the entire line.
C: **Incorrect:** It also restricts the preceding three characters and total length.
D: **Incorrect:** Both the order and exact counts are constrained.
**1. Encode both boundaries:** ^report anchors the prefix and \.txt$ anchors the literal extension at line end.
**2. Allow intermediate text:** .* permits zero or more characters, so the pattern matches report1.txt, report123.txt and report.txt in the supplied file.
**Answer: B — grep "^report.*\.txt$" /home/user/files/files.txt.**
A: **Incorrect:** The escaped dot and following * repeat literal dots; they do not stand for arbitrary intervening text.
B: **Correct:** It correctly anchors the prefix and literal suffix with an arbitrary middle.
C: **Incorrect:** report* repeats only the preceding t and does not encode an arbitrary middle.
D: **Incorrect:** It effectively limits the filename to report plus one character and txt, omitting valid longer names.
**1. Test extraction:** head -n 5 input.txt prints the prefix and returns success if it can read the file.
**2. Chain status messages:** && writes Done to status.log after success; || writes Error in input to error.log after failure of the preceding AND-list. This is option A.
**Answer: A — head -n 5 input.txt && echo "Done" > status.log || echo "Error in input" > error.log.**
**Convention note:** In A && B || C, C also runs if B fails, for example if status.log cannot be written. A is the intended answer assuming the log writes succeed.
A: **Correct:** It places success after && and the fallback after ||.
B: **Incorrect:** It swaps the success/failure branches and then chains an extra command.
C: **Incorrect:** A pipeline to echo does not test head’s success under normal pipeline status rules.
D: **Incorrect:** It writes the failure text on success and the success text on failure.
**1. Identify interface-address commands:** ifconfig displays interface configuration when installed; ip addr displays interfaces and their assigned addresses.
**2. Exclude other tools:** ping probes reachability, netstat focuses on sockets/routes/statistics, and ipconf is not the standard Ubuntu command in the list.
**Answer: B, E — ifconfig and ip addr.**
A: **Incorrect:** It probes a target rather than listing local interface configuration.
B: **Correct:** It displays interface addresses when the net-tools command is available.
C: **Incorrect:** It is not the direct interface-address listing command asked for.
D: **Incorrect:** ipconf is not the listed standard interface utility.
E: **Correct:** ip addr directly displays interfaces and assigned IP addresses.
**1. Expand the first command:** test-{0..3} becomes test-0 through test-3, creating four directories. Its success enables the && command.
**2. Expand the second command:** test-{4..6} creates three more directories and succeeds. Therefore the || fallback for test-7 through test-10 is skipped.
**3. Add:** \(4+3=7\) directories are created.
**Answer: 7.**
**1. Decode the range:** The alternatives match first octets 1–9,10–99,100–119,120–126, followed by a literal dot. They exclude loopback 127 and all larger octets.
**2. Check the supplied list:** 10.0.0.1, 8.8.8.8, 15.12.34.56, 1.2.3.4 and 100.50.25.75 match. wc -l therefore prints 5.
**Answer: 5.**
**1. Use the existing parent:** Resources already exists, so mkdir Resources/Reference creates the required subdirectory.
**2. Create the file:** A addresses the file using its full relative path; B enters the new directory and touches index.md there. Both place it correctly.
**Answer: A, B — Command sets A and B.**
A: **Correct:** It creates the specified directory and file by relative paths.
B: **Correct:** It creates the directory, enters it and touches the required file.
C: **Incorrect:** It swaps the file and directory names and types.
D: **Incorrect:** It creates Reference under home instead of under Resources.
**MLT**
**Section Id :** 640653106047
**Section Number :** 9
**Section type :** Online
**Mandatory or Optional :** Mandatory
**Number of Questions :** 11
**Number of Questions to be attempted :** 11
**Section Marks :** 40
**Display Number Panel :** Yes
**Section Negative Marks :** 0
**Group All Questions :** No
**Enable Mark as Answered Mark for Review and**
No
**Clear Response :**
**Section Maximum Duration :** 0
**Section Minimum Duration :** 0
**Section Time In :** Minutes
**Maximum Instruction Time :** 0
Published solution
**1. Move the file:** mv Projects/ProjectA/main.py Projects/ProjectB/ leaves ProjectA empty and puts main.py alongside app.js in ProjectB.
**2. Remove the empty directory and list destination:** A uses rmdir, D uses rm -rf; both then list Projects/ProjectB.
**Answer: A, D — Command sets A and D.**
A: **Correct:** It completes the move, removes the empty source directory and lists the destination.
B: **Incorrect:** Plain rm refuses the directory.
C: **Incorrect:** cp leaves main.py in the source, so rmdir fails; it also lists the source rather than the destination.
D: **Correct:** It removes the now-empty source recursively and lists the correct destination.