exam questions

Exam LFCS All Questions

View all questions & answers for the LFCS exam

Exam LFCS topic 1 question 88 discussion

Actual exam question from Linux Foundation's LFCS
Question #: 88
Topic #: 1
[All LFCS Questions]

When given the following command line.
echo "foo bar" | tee bar | cat
Which of the following output is created?

  • A. cat
  • B. foo bar
  • C. tee bar
  • D. bar
  • E. foo
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
KMAV
3 months ago
Selected Answer: B
When the command line echo "foo bar" | tee bar | cat is executed, the following happens: echo "foo bar" prints "foo bar" to standard output (stdout). The | (pipe) symbol takes the output of the previous command and sends it as input to the next command. tee bar takes the input it receives from the pipe and writes it to standard output (stdout) as well as to a file named "bar". The second | (pipe) symbol takes the output of the previous command and sends it as input to the next command. cat takes the input it receives from the pipe and writes it to standard output (stdout). Therefore, the output that is created is: foo bar The output is printed to both the terminal (stdout) and the file "bar", but since the cat command only reads from standard input (stdin), it will only output "foo bar" to the terminal.
upvoted 1 times
...
rhylos
1 year, 12 months ago
tricky question. Output is "foo bar". file created is bar. Answer is correct
upvoted 2 times
...
rhylos
1 year, 12 months ago
Incorrect. Answer is D. output created bar. [student@centos ~]$ cat bar foo bar
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago