All fields

“I/O Streams” in Information Technology

27 questions across 3 technologies.

Information Technology

27 questions in 3 technologies

#QuestionTechnologyTopicLevel
1What are C++ I/O streams? C++ › I/O StreamsC++I/O StreamsBeginner
2How do you improve iostream performance for large I/O? C++ › I/O StreamsC++I/O StreamsAdvanced
3What is the difference between std::cout, std::cerr, and std::clog? C++ › I/O StreamsC++I/O StreamsBeginner
4How do you check for and handle stream errors? C++ › I/O StreamsC++I/O StreamsBeginner
5How do you read a file with ifstream and write with ofstream? C++ › I/O StreamsC++I/O StreamsIntermediate
6What is the difference between >> and std::getline for input? C++ › I/O StreamsC++I/O StreamsIntermediate
7What is the difference between std::endl and '\n'? C++ › I/O StreamsC++I/O StreamsIntermediate
8What is std::stringstream and when is it useful? C++ › I/O StreamsC++I/O StreamsIntermediate
9What are stream manipulators and how are they used? C++ › I/O StreamsC++I/O StreamsAdvanced
10How do you overload operator<< for a custom type? C++ › I/O StreamsC++I/O StreamsAdvanced
11How 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 & StreamsC#File I/O & StreamsIntermediate
12How do you correctly implement async, cancellable file I/O using CancellationToken with FileStream operations? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
13How do you read and write an entire text file's contents using the simplest File class methods? C# › File I/O & StreamsC#File I/O & StreamsBeginner
14What is the difference between File.ReadAllLines() and File.ReadLines() in terms of memory usage? C# › File I/O & StreamsC#File I/O & StreamsBeginner
15How does the 'using' statement (or 'using' declaration) ensure a FileStream is properly closed, even if an exception occurs? C# › File I/O & StreamsC#File I/O & StreamsIntermediate
16How do StreamReader and StreamWriter differ from directly using a FileStream, and when would you choose them? C# › File I/O & StreamsC#File I/O & StreamsIntermediate
17How would you implement a custom Stream subclass to wrap another stream with additional behavior, like counting bytes read? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
18How do you use FileSystemWatcher to monitor a directory for file changes, and what are its common reliability pitfalls? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
19How would you implement memory-mapped file access using MemoryMappedFile for efficient random access to a very large file? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
20How 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 & StreamsC#File I/O & StreamsAdvanced
21What is the difference between byte streams (InputStream/OutputStream) and character streams (Reader/Writer) in the classic java.io package? Java › I/O & NIOJavaI/O & NIOBeginner
22What are async streams in C#, and how does IAsyncEnumerable<T> differ from a regular IEnumerable<T> for handling large or slow data sources? C# › Asynchronous ProgrammingC#Asynchronous ProgrammingIntermediate
23What does the finally block guarantee, and when is it commonly used? C# › Exception HandlingC#Exception HandlingBeginner
24How do you efficiently build up a large string? C++ › Strings & string_viewC++Strings & string_viewIntermediate
25How 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 returnC#Iterators & yield returnIntermediate
26How does the IDisposable pattern and the 'using' statement help manage UNMANAGED resources that the garbage collector doesn't automatically clean up? C# › Memory & Garbage CollectionC#Memory & Garbage CollectionIntermediate
27How 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 returnC#Iterators & yield returnAdvanced