Multiple choice technology operating systems

Read following two commands: cat | sort sort < cat What is the diffrence between both the commands?

  1. First command will display the file in sorted order.But second result an error.

  2. Second command will display the file in sorted order.But first result an error.

  3. Both give the same result, Display the file in a sorted order.

  4. Both command will work but only first result in a sorted file.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Both commands use input redirection to feed the file content to the sort command. 'cat file | sort' pipes output, and 'sort < file' redirects input, but both result in the file being displayed in sorted order. Note: 'sort < cat < file' has invalid syntax but the question intends to show input redirection.