W3
Teacher
Explore
Browse by field
Artificial Intelligence
Accounting & Finance
Information Technology
Show all fields
Interview Q&A
All Interview Questions
Beginner
Intermediate
Advanced
Practice
MCQs
Quizzes
Mock Interviews
About
Light
Dark
Auto
Sign in
Get Started
Search interview questions
Search
All fields
“File I/O & Streams” in Information Technology
15 questions across 2 technologies.
Information Technology
15 questions in 2 technologies
#
Question
Technology
Topic
Level
1
How do you correctly implement async, cancellable
file
I/O
using CancellationToken with
File
Stream operations?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Advanced
2
How do you read and write an entire text
file
's contents using the simplest
File
class methods?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Beginner
3
What is the difference between
File
.ReadAllLines() and
File
.ReadLines() in terms of memory usage?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Beginner
4
How does the 'using' statement (or 'using' declaration) ensure a
File
Stream is properly closed, even if an exception occurs?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Intermediate
5
How do StreamReader and StreamWriter differ from directly using a
File
Stream, and when would you choose them?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Intermediate
6
How do you efficiently copy data between two
streams
using Stream.CopyToAsync(), and why is this preferred over a manual byte-by-byte loop?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Intermediate
7
How do you use
File
SystemWatcher to monitor a directory for
file
changes, and what are its common reliability pitfalls?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Advanced
8
How would you implement memory-mapped
file
access using MemoryMapped
File
for efficient random access to a very large
file
?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Advanced
9
How would you implement a robust, atomic
file
-write operation that avoids leaving a corrupted or partially-written
file
if the process crashes mid-write?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Advanced
10
How would you implement a custom Stream subclass to wrap another stream with additional behavior, like counting bytes read?
C# › File I/O & Streams
C#
File
I/O
&
Streams
Advanced
11
How do you read a
file
with ifstream and write with ofstream?
C++ › I/O Streams
C++
I/O
Streams
Intermediate
12
What does the finally block guarantee, and when is it commonly used?
C# › Exception Handling
C#
Exception Handling
Beginner
13
How does an iterator method interact with try/finally, and when does the finally block actually execute given the method's lazy, on-demand nature?
C# › Iterators & yield return
C#
Iterators & yield return
Intermediate
14
How does the IDisposable pattern and the 'using' statement help manage UNMANAGED resources that the garbage collector doesn't automatically clean up?
C# › Memory & Garbage Collection
C#
Memory & Garbage Collection
Intermediate
15
How would you write a custom iterator that safely handles resource cleanup for a lazily-enumerated database cursor, ensuring the connection is closed even if enumeration is abandoned early?
C# › Iterators & yield return
C#
Iterators & yield return
Advanced