Explore topic-wise MCQs in Unix.

This section includes 20 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 is invalid?

A. /printf
B. ?scanf
C. :%/abd/mash/wc
D. :1,%/file01/file02/g
Answer» E.
2.

Which one of the following commands will be used to delete all the instances of string ‘manager’ in file003?

A. 1,$s/manager/ /g
B. %s/manager/director/g
C. 1,$s/professor/director
D. %s/manager/ /
Answer» B. %s/manager/director/g
3.

Which of the following flag will be used for interactive substitution?

A. g
B. G
C. gc
D. cg
Answer» D. cg
4.

Which of the following commands can be used to replace ‘professor’ with ‘director’ throughout the whole file?

A. 1,$s/professor/director/g
B. %s/professor/director/g
C. 1,$s/professor/director
D. 1,$s/professor/director/g and %s/professor/director/g
Answer» E.
5.

The target pattern is optional.

A. True
B. False
Answer» B. False
6.

We cannot leave the flag field empty while performing the substitution.

A. True
B. False
Answer» C.
7.

____ searches for a first instance of a pattern in the backward direction.

A. /
B. %
C. &
D. ?
Answer» E.
8.

WE_CANNOT_LEAVE_THE_FLAG_FIELD_EMPTY_WHILE_PERFORMING_THE_SUBSTITUTION.?$

A. True
B. False
Answer» C.
9.

Which of the following commands can be used to replace ‘professor’ with ‘director’ throughout the whole file?$#

A. 1,$s/professor/director/g
B. %s/professor/director/g
C. 1,$s/professor/director
D. 1,$s/professor/director/g and %s/professor/director/g
Answer» E.
10.

The_target_pattern_is_optional.$

A. True
B. False
Answer» B. False
11.

Search and replace operations can also use regular expressions for matching multiple patterns.

A. True
B. False
Answer» B. False
12.

Which one of the following commands will be used to delete all the instances of string ‘manager’ in file003?$

A. 1,$s/manager/ /g
B. %s/manager/director/g
C. 1,$s/professor/director
D. %s/manager/ /
Answer» B. %s/manager/director/g
13.

Which_of_the_following_flag_will_be_used_for_interactive_substitution?

A. g
B. G
C. gc
D. cg
Answer» D. cg
14.

Which of the following is a correct syntax for performing substitution on a file?

A. :address/source_pattern/target_pattern/flag
B. :address/target_pattern source_pattern/flag
C. :address/flag
D. :address
Answer» B. :address/target_pattern source_pattern/flag
15.

Which of the following symbol is used for substitution command?

A. n
B. N
C. s
D. S
Answer» D. S
16.

Substitution command is an ex-mode command.

A. True
B. False
Answer» B. False
17.

Which command is used to reverse the direction of repeating the search?

A. n
B. N
C. nn
D. NN
Answer» C. nn
18.

Which command is used for repeating the search in the same direction?

A. n
B. N
C. nn
D. NN
Answer» B. N
19.

____ searches for a first instance of a pattern in forwarding direction.

A. /
B. %
C. &
D. ?
Answer» B. %
20.

Which of the following symbols are used for searching a pattern in vi?

A. /
B. ?
C. %
D. / and ?
Answer» E.