Explore topic-wise MCQs in Unix.

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_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
2.

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
3.

Which shortcut does sed offer to replace the string Linux with Red hat Linux?$

A. { }
B. ( )
C. ^^
D. &
Answer» E.
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?

A.
B. replace * with |
C. replace / with |
Answer» D.
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