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

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

Q.562Medium

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

Q.563Medium

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

Q.564Medium

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

Q.565Easy

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

Q.566Medium

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

Q.567Medium

What is the difference between InputStreamReader and FileReader?

Q.568Medium

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

Q.569Medium

What does the available() method in InputStream return?

Q.570Medium

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

Q.571Medium

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

Q.572Hard

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

Q.573Medium

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

Q.574Hard

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

Q.575Hard

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

Q.576Easy

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

Q.577Medium

What is the default buffer size used by BufferedInputStream?

Q.578Easy

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

Q.579Easy

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

Q.580Medium

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