Computer Science I / Input, Output, and File Thinking
Practice question · Select all that apply

Select every statement that is true of the stream model and file handling.

Hints
  1. One option flatly contradicts the whole reason streams exist.
  2. Think about how a program reads a file that is bigger than its memory.
Show the answer
  • B. A stream reads a file a piece at a time
  • C. Opening a file requires choosing a read or write mode
  • D. Closing a file flushes writes that were still buffered
  • E. Streaming lets a program handle a file larger than available memory
Why

Streaming reads incrementally, which is exactly what lets a program exceed memory; closing flushes buffered writes; opening picks a mode. The false option is that a file must be fully loaded first, that is what the stream model is designed to avoid.

Read the lesson: Input, Output, and File Thinking →

Practise Input, Output, and File Thinking

The app has 5 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Input, Output, and File Thinking