All fields

“I/O & NIO” in Information Technology

24 questions across 2 technologies.

Information Technology

24 questions in 2 technologies

#QuestionTechnologyTopicLevel
1How does java.nio's Channel and Buffer abstraction differ fundamentally from the classic java.io Stream model, and what specific capability does this enable for non-blocking I/O? Java › I/O & NIOJavaI/O & NIOAdvanced
2How would you implement asynchronous file I/O using AsynchronousFileChannel, and how does this differ from both the classic blocking java.io model and NIO's Selector-based non-blocking channels? Java › I/O & NIOJavaI/O & NIOAdvanced
3How do you read all bytes or all lines of a small-to-medium text file in a single, concise call using modern NIO.2 utility methods? Java › I/O & NIOJavaI/O & NIOBeginner
4How does wrapping a FileInputStream in a BufferedInputStream (or FileReader in a BufferedReader) improve I/O performance, and what's the mechanism behind this improvement? Java › I/O & NIOJavaI/O & NIOIntermediate
5What are the modern java.nio.file utility classes (Path, Files) introduced in Java 7 (NIO.2), and how do they improve on the older java.io.File class? Java › I/O & NIOJavaI/O & NIOIntermediate
6How would you use try-with-resources combined with multiple chained I/O wrapper classes (like FileInputStream wrapped in BufferedInputStream wrapped in GZIPInputStream) to correctly read a compressed file while ensuring all layers are properly closed? Java › I/O & NIOJavaI/O & NIOIntermediate
7How would you use the WatchService API (java.nio.file) to monitor a directory for file system changes (creation, modification, deletion) in real time? Java › I/O & NIOJavaI/O & NIOIntermediate
8How would you implement memory-mapped file I/O using MappedByteBuffer, and what performance advantage does this provide for very large files compared to traditional stream-based reading? Java › I/O & NIOJavaI/O & NIOAdvanced
9What 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
10How would you implement object serialization using ObjectOutputStream/ObjectInputStream, and what does the Serializable marker interface and serialVersionUID actually do? Java › I/O & NIOJavaI/O & NIOIntermediate
11What is the purpose of the PrintStream and PrintWriter classes (like System.out), and how do they differ from lower-level OutputStream/Writer in their exception-handling behavior? Java › I/O & NIOJavaI/O & NIOIntermediate
12How would you recursively copy an entire directory tree (including all subdirectories and files) using the Files.walkFileTree() method and a FileVisitor implementation? Java › I/O & NIOJavaI/O & NIOIntermediate
13Why has Java's built-in serialization (ObjectInputStream.readObject()) been widely criticized as a security risk, and what specific attack does deserializing untrusted data enable? Java › I/O & NIOJavaI/O & NIOAdvanced
14How would you correctly handle character encoding when reading a text file whose encoding isn't known in advance (or might not be UTF-8), and what pitfalls exist with relying on the JVM's platform default charset? Java › I/O & NIOJavaI/O & NIOAdvanced
15How would you implement file locking (using FileLock) to coordinate exclusive access to a shared file across multiple processes, and what are the platform-specific reliability caveats? Java › I/O & NIOJavaI/O & NIOAdvanced
16How do you programmatically load a class by its fully-qualified name at runtime using Class.forName(), and what is a common real-world use case for this? Java › Class Loading & Bytecode VerificationJavaClass Loading & Bytecode VerificationBeginner
17What is the correct usage of try-with-resources, and how does it automatically ensure a resource's close() method is called even if an exception occurs? Java › ExceptionsJavaExceptionsIntermediate
18What is the finally block's execution guarantee, and what are the specific edge cases where a finally block might NOT execute? Java › ExceptionsJavaExceptionsIntermediate
19What is the purpose of the addSuppressed() mechanism and getSuppressed() method on Throwable, and in what specific scenario does the JVM automatically populate suppressed exceptions? Java › ExceptionsJavaExceptionsIntermediate
20How would you convert a checked-exception-throwing method into a lambda usable with a standard functional interface (which doesn't declare any checked exceptions), given standard interfaces like Function don't permit checked exceptions in their abstract method signature? Java › Functional Interfaces & Method ReferencesJavaFunctional Interfaces & Method ReferencesIntermediate
21What is the purpose of the finalize() method, and why has it been deprecated in favor of try-with-resources and Cleaner in modern Java? Java › Garbage CollectionJavaGarbage CollectionIntermediate
22What is the java.net.Socket and ServerSocket class pair, and how would you implement a basic TCP client-server communication using them at a lower level than HttpClient? Java › Java Networking & HTTP ClientJavaJava Networking & HTTP ClientIntermediate
23What 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
24How would you implement the Decorator pattern in Java, and how does java.io's InputStream/OutputStream class hierarchy exemplify this pattern in the JDK itself? Java › Design Patterns in JavaJavaDesign Patterns in JavaAdvanced