Unix Pipes and Filters MCQs
Pipes and Filters MCQs : This section focuses on "Pipes and Filters" in unix. These Multiple Choice Questions (MCQ) should be practiced to improve the unix skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. What is true about pipes in unix?
A. Pipe can connect two commands together so that the output from one program becomes the input of the next program
B. To make a pipe, put a hash (#) on the command line between two commands.
C. Two or more commands connected in this way form a pipe.
D. Both A and C
View Answer
Ans : D
Explanation: Option A and Option C is correct about Pipes.
2. To make a pipe, put a ________ on the command line between two commands.
A. |
B. /
C. \
D. $
View Answer
Ans : A
Explanation: To make a pipe, put a vertical bar (|) on the command line between two commands.
3. Which command searches a file or files for lines that have a certain pattern?
A. erep
B. pgrp
C. grep
D. drep
View Answer
Ans : C
Explanation: The grep command searches a file or files for lines that have a certain pattern.
4. What does -c operation do in grep command?
A. Matches either upper or lowercase.
B. Prints only the count of matching lines.
C. Prints the matched line and its line number.
D. Prints all lines that do not match pattern.
View Answer
Ans : B
Explanation: Prints only the count of matching lines is correct answer.
5. Which command is used to arranges lines of text alphabetically or numerically?
A. sort
B. psort
C. asort
D. series
View Answer
Ans : A
Explanation: The sort command arranges lines of text alphabetically or numerically.
6. Which option is used ignores first x fields when sorting?
A. -x
B. +x
C. -X
D. +X
View Answer
Ans : B
Explanation: +x : Ignores first x fields when sorting.
7. If there are special characters in a pattern, then we've to enclose them in ______
A. single quotes
B. double quotes
C. Without any quotes
D. None of the above
View Answer
Ans : B
Explanation: If there are special characters in a pattern, then we've to enclose them in double quotes.
8. POSIX identifies regular expressions as belonging to ____ categories.
A. 2
B. 3
C. 4
D. 5
View Answer
Ans : A
Explanation: POSIX identifies regular expressions as belonging to two categories i.e. regular and extended.
9. Which of the following is not filter in unix?
A. cat
B. head
C. tail
D. cd
View Answer
Ans : D
Explanation: cd is not a filter in unix.
10. Which of the following filter is used to remove duplicate lines?
A. cat
B. sed
C. uniq
D. grep
View Answer
Ans : C
Explanation: uniq : Removes duplicate lines.
Discussion