

MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Unix knowledge and support exam preparation. Choose a topic below to get started.
1. |
Which command will be used for selecting lines 3 to 10 from emp.lst? |
A. | sed 3,10 emp.lst |
B. | sed -n ‘3,10p’ emp.lst |
C. | sed -n ‘^,10p’ emp.lst |
D. | sed -n, 10p |
Answer» C. sed -n ‘^,10p’ emp.lst | |
2. |
Which shortcut does sed offer to replace the string Linux with Red hat Linux? |
A. | { } |
B. | ( ) |
C. | ^^ |
D. | & |
Answer» E. | |
3. |
Which one of the following command will be used for adding two spaces before every line in emp.lst? |
A. | sed ‘s/^/ /’ emp.lst |
B. | sed ‘s / / /’emp.lst |
C. | sed ‘s /$/ /’emp.lst |
D. | sed ‘s/$/ |
Answer» B. sed ‘s / / /’emp.lst | |
4. |
The interval regular expression uses the character _______ |
A. | { |
B. | } |
C. | { and } |
D. | ( and ) |
Answer» D. ( and ) | |
5. |
Basic regular expressions are divided into ______ categories. |
A. | 1 |
B. | 3 |
C. | 2 |
D. | 5 |
Answer» C. 2 | |
6. |
What will be the function of the following command?$ sed ‘s/ *|/|/g’ emp.lst |
A. | replace * with | |
B. | replace / with | |
C. | compress multiple spaces |
D. | erroneous output |
Answer» D. erroneous output | |
7. |
Which of the following characters are used with sed as anchoring characters? |
A. | $ |
B. | ^ |
C. | % |
D. | $ and ^ |
Answer» E. | |
8. |
To replace the string ‘director’ in the first five lines of file emp.lst with ‘manager’ we can use _____ |
A. | sed ‘s/director/manager/’ emp.lst |
B. | sed ‘1-5s/director/manager/’ emp.lst |
C. | sed ‘1,5s/director/manager/’ emp.lst |
D. | sed ‘15s |
Answer» D. sed ‘15s | |
9. |
Which one of the following command is used for replacing | with : globally? |
A. | sed ‘s/|/:/’ emp.lst |
B. | sed ‘/|/:/’ emp.lst |
C. | sed ‘s/|/:/g’ emp.lst |
D. | sed ‘s/ |
Answer» D. sed ‘s/ | |
10. |
Which one of the following is the correct syntax for performing substitution using sed? |
A. | sed [address]s /expr1/ expr2 |
B. | sed [address]s /expr1 expr2 |
C. | sed [address]s /expr1/ expr2/ flags |
D. | sed [address]s |
Answer» D. sed [address]s | |
11. |
sed can also perform the substitution. |
A. | True |
B. | False |
Answer» B. False | |