Multiple choice questions with diagnotic answers
Both of my multiple choise questions are building on the lessons about Shell Pipes and Filters.
Which of the following combination of shell commands will return the
Welcome. (If you not familiar with the commands:
give a string to the standard output;
tr will replace one string by
sort return sorted lines;
tail will give the last
lines of a given input (
-n specifies the number of lines)).
echo "Welcome to the shell" | tr " " "\n" | sort | tail -n 1
echo "Welcome to the shell" ; tr " " "\n" ; sort ; tail -n 1
echo "Welcome to the shell" > tr " " "\n" > sort > tail -n 1
echo "Welcome to the shell" < tr " " "\n" < sort < tail -n 1
Let us assume we have the plain text file
fruits.txt with the
following 12 lines of content:
peach apple banana orange avocado cherry strawberry pineapple blueberry pear kiwi clementine
What will be the outcome of the following commands.
cat fruits.txt | head | wc -l
- Nothing as
wcdo not have any input files
10 10 77
What can the different answer tell us about misconception of the student?
- The student does not know how Unix shell pipes work. I.e. that the
output of one command that is given to the standard output is used by
the next command connected by
|as standard input.
- The student is not aware that
headwill show per default only the first 10 lines of a file.
- The correct answer
- The student is not aware the impact of the parameter
-lof the command