Bird
0
0

Given a file example.txt containing the text:

medium📝 Command Output Q13 of 15
Linux CLI - Viewing and Editing Files
Given a file example.txt containing the text:
Hello world
This is a test
What is the output of wc example.txt?
A2 6 27 example.txt
B3 5 24 example.txt
C2 5 24 example.txt
D3 6 25 example.txt
Step-by-Step Solution
Solution:
  1. Step 1: Count lines, words, and characters in the file

    Lines: 2 ("Hello world" and "This is a test")
    Words: 6 ("Hello", "world", "This", "is", "a", "test")
    Characters: Count all characters including spaces and newlines.
    "Hello world" = 11 chars, newline = 1, "This is a test" = 14 chars, newline = 1, total = 27 chars.
  2. Step 2: Match counts with options

    2 6 27 example.txt matches exactly: 2 lines, 6 words, 27 characters.
  3. Final Answer:

    2 6 27 example.txt -> Option A
  4. Quick Check:

    Lines=2, Words=6, Characters=27 [OK]
Quick Trick: Count lines, words, chars carefully; wc shows all three by default [OK]
Common Mistakes:
  • Miscounting words or lines
  • Ignoring newline characters in count
  • Assuming output order is different

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes