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.261Medium

What is the serialVersionUID used for in Java serialization?

Q.262Medium

What happens when you write to a closed PrintWriter?

Q.263Medium

Which scenario would require using a SequenceInputStream?

Q.264Medium

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

Q.265Medium

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

Q.266Medium

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

Q.267Medium

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

Q.268Medium

In a multi-threaded application, which stream class is thread-safe?

Q.269Medium

Which method of PushbackInputStream allows you to return bytes to the stream to be read again?

Q.270Medium

For processing delimited text files with variable field counts, which class is most suitable?

Q.271Medium

What is the primary purpose of transient keyword in Java serialization?

Q.272Medium

In a file compression utility, which stream would you use for reading compressed data?

Q.273Medium

When combining multiple input sources into one logical stream, which class should be used?

Q.274Medium

What is the purpose of the mark() and reset() methods in buffered streams?

Q.275Medium

Consider a scenario where you need to read a line from a file. Which class would be most efficient?

Q.276Medium

In a multi-threaded application, what is a concern when sharing streams between threads?

Q.277Medium

What is the difference between InputStreamReader and FileReader?

Q.278Medium

Consider processing a 1GB file. Which approach would be most memory-efficient?

Q.279Medium

What does the available() method in InputStream return?

Q.280Medium

In Java NIO, which class is used for channel-based I/O?