Unix Shell Input/Output Redirections MCQs

Shell Input/Output Redirections MCQs : This section focuses on "Input/Output Redirections" in Shell Progamming 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. Which symbol is used for taking input from standard input?

A. &
B. %
C. -
D. $

View Answer

2. Which of the following symbol(s) can be used to redirect the output to a file or another program?

A. |
B. >
C. >>
D. All of the above

View Answer

3. The >> symbol is used to overwrite the existing file if it exists and | is used to give input to another program.

A. True, False
B. True, True
C. False, True
D. False, False

View Answer

4. We can redirect the error message to file named newfile using __________ command.

A. cat foo errorfile
B. cat foo >errorfile
C. cat errorfile>foo
D. cat foo 2>errorfile

View Answer

5. Which symbol is used to redirect error messages to /dev/null?

A. <
B. >
C. %
D. $

View Answer

6. Which command saves one copy of character stream in a file and store the other to standard output?

A. who
B. tee
C. ls
D. wc

View Answer

7. Which of the following is not true about tee command?

A. it is a feature of the shell
B. it is an external command
C. tee command duplicates its input
D. tee is an internal command

View Answer

8. A _______ is used to redirect input into an interactive shell script or program.

A. document
B. here
C. here document
D. who

View Answer

9. What is the use of pgm < file command?

A. Output of pgm is redirected to file
B. Program pgm reads its input from file
C. Output of pgm is appended to file
D. Takes output from one program, or process, and sends it to another

View Answer

10. What is the use of n >& m command?

A. Merges output from stream n with stream m
B. Merges input from stream n with stream m
C. Both A and B
D. None of the above

View Answer


* You must be logged in to add comment.