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

Which class provides buffering capability to improve I/O performance?

Q.62Medium

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

Q.63Medium

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

Q.64Medium

What exception is thrown when attempting to deserialize an object with a different serialVersionUID?

Q.65Easy

Which stream class is used to write primitive data types in binary format?

Q.66Medium

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

Q.67Medium

What is the difference between InputStreamReader and FileReader?

Q.68Medium

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

Q.69Medium

What does the available() method in InputStream return?

Q.70Medium

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

Q.71Medium

What is the correct way to ensure resources are properly closed in Java 7+?

Q.72Hard

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

Q.73Medium

What happens when you create a FileOutputStream with an existing file?

Q.74Hard

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

Q.75Hard

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

Q.76Easy

Which of the following is NOT a character stream class in Java?

Q.77Medium

What is the default buffer size used by BufferedInputStream?

Q.78Easy

Which interface must be implemented to make an object serializable in Java?

Q.79Easy

In Java, what is the primary purpose of the flush() method in output streams?

Q.80Medium

Which class is used to read primitive data types and strings from a binary stream?