iGET

Java Programming - MCQ Practice Questions

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

951 questions | 100% Free

Q.521Easy

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

Q.522Hard

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

Q.523Medium

Which statement about ObjectOutputStream.reset() is correct?

Q.524Medium

When implementing Externalizable interface, which method is mandatory?

Q.525Easy

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

Q.526Medium

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

Q.527Medium

What is the serialVersionUID used for in Java serialization?

Q.528Hard

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

Q.529Medium

What happens when you write to a closed PrintWriter?

Q.530Hard

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

Q.531Medium

Which scenario would require using a SequenceInputStream?

Q.532Medium

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

Q.533Hard

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

Q.534Easy

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

Q.535Easy

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

Q.536Easy

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

Q.537Medium

In a real-time application processing sensor data streams, which buffering approach would minimize latency?

Q.538Easy

Which class would you use to read and write at arbitrary positions in a file?

Q.539Medium

When processing a large XML file, which approach is most memory-efficient?

Q.540Medium

What is the default charset used by InputStreamReader if none is specified?