Bird
0
0

If you run cat file.txt twice consecutively on a Linux system with enough free memory, what difference in execution time should you expect?

medium📝 Command Output Q4 of 15
Linux CLI - Viewing and Editing Files
If you run cat file.txt twice consecutively on a Linux system with enough free memory, what difference in execution time should you expect?
AThe second run will be faster due to file caching
BBoth runs will take the same time since disk access is constant
CThe first run is faster because the file is smaller initially
DThe second run will be slower due to increased CPU usage
Step-by-Step Solution
Solution:
  1. Step 1: Analyze first run

    The first cat reads the file from disk, which is slower.
  2. Step 2: Analyze second run

    The second cat reads from cached RAM, making it faster.
  3. Final Answer:

    The second run will be faster due to file caching -> Option A
  4. Quick Check:

    Disk vs RAM access speed difference [OK]
Quick Trick: Second read uses cache, so it's faster [OK]
Common Mistakes:
  • Assuming disk speed is always constant
  • Ignoring the effect of RAM caching
  • Believing CPU load slows second run

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes