iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.1Hard

In Java NIO, which class replaces traditional Stream-based I/O for better performance?

Q.2Hard

What happens if you call close() multiple times on a stream?

Q.3Hard

Which of the following is true about serialization in Java?

Q.4Hard

In a multi-threaded environment, which stream class provides thread-safe read/write operations without external synchronization?

Q.5Hard

A developer uses PipedInputStream and PipedOutputStream in the same thread. What will happen?

Q.6Hard

A program reads a 1 GB binary file and needs to modify specific bytes at random positions. Which class is most suitable?

Q.7Hard

In Java NIO, what is the primary advantage of FileChannel over traditional streams?

Q.8Hard

For a real-time log file monitoring application, which approach is most suitable?

Q.9Hard

For encrypting data while writing to a file, which approach is most appropriate?

Q.10Hard

In Java NIO, what is a key advantage of FileChannel over traditional I/O streams?

Q.11Hard

Which serialization approach maintains backward compatibility better?

Q.12Hard

For developing a high-performance file copying utility handling files up to 10GB, which approach is optimal?

Q.13Hard

Given the code: PrintWriter pw = new PrintWriter(new FileWriter("file.txt")); What issue might occur?

Q.14Hard

Which approach would you use to read and write objects to a file efficiently in a production application?

Q.15Hard

In a log aggregation system, what is the primary advantage of using RandomAccessFile over sequential streams?

Q.16Hard

What is the main advantage of using RandomAccessFile over sequential streams?

Q.17Hard

When deserializing an object, which methods are called in order?

Q.18Hard

Consider a scenario where you need to read a large binary file efficiently without loading it entirely into memory. Which approach combines best practices?

Q.19Hard

What is the primary advantage of PushbackInputStream?

Q.20Hard

In a multi-threaded application, multiple threads are writing to the same file simultaneously using FileOutputStream. What is the primary issue and best solution?