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.21Easy

Which of the following correctly demonstrates chaining multiple filters in Java I/O?

Q.22Medium

A serialized object contains a field marked as 'transient'. What happens to this field when the object is deserialized?

Q.23Hard

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

Q.24Easy

What will be the output of reading from a ByteArrayInputStream initialized with bytes [65, 66, 67] after calling read() three times?

Q.25Hard

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

Q.26Medium

Which statement about ObjectOutputStream.reset() is correct?

Q.27Medium

When implementing Externalizable interface, which method is mandatory?

Q.28Easy

A RandomAccessFile is opened with mode 'r'. Which operation will throw an exception?

Q.29Medium

In a CSV file processing application, why is BufferedReader preferred over FileReader for reading large files?

Q.30Medium

What is the serialVersionUID used for in Java serialization?

Q.31Hard

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

Q.32Medium

What happens when you write to a closed PrintWriter?

Q.33Hard

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

Q.34Medium

Which scenario would require using a SequenceInputStream?

Q.35Medium

A file contains 1000 lines. Using BufferedReader.readLine() repeatedly reads all lines. What is the time complexity?

Q.36Easy

When using ObjectInputStream, what exception is thrown if the serialVersionUID doesn't match?

Q.37Hard

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

Q.38Easy

Which class in Java I/O streams is used to read primitive data types from a binary file?

Q.39Easy

What is the purpose of the flush() method in PrintWriter?

Q.40Easy

Which of the following is a character-based stream in Java?