Bird
0
0

Why does this code fail to flush output immediately?

medium📝 Debug Q7 of 15
Python - File Reading and Writing Strategies
Why does this code fail to flush output immediately?
print('Start')
print('End', flush=False)
ABecause print buffers output regardless of flush
BBecause print does not support flush parameter
CBecause flush=True is the default behavior
DBecause flush=False disables immediate flushing
Step-by-Step Solution
Solution:
  1. Step 1: Understand flush parameter default

    The flush parameter defaults to False, meaning output is buffered.
  2. Step 2: Analyze code

    Explicitly setting flush=False prevents immediate flushing.
  3. Step 3: Conclusion

    To flush immediately, flush=True must be used.
  4. Final Answer:

    Because flush=False disables immediate flushing -> Option D
  5. Quick Check:

    flush=False means no immediate flush [OK]
Quick Trick: flush=True forces immediate output flush [OK]
Common Mistakes:
  • Assuming flush=False flushes output
  • Believing print always flushes immediately
  • Ignoring flush parameter effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes