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

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

Q.22Medium

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

Q.23Medium

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

Q.24Medium

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

Q.25Medium

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

Q.26Medium

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

Q.27Medium

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

Q.28Medium

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

Q.29Medium

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

Q.30Medium

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

Q.31Medium

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

Q.32Medium

What is the difference between InputStreamReader and FileReader?

Q.33Medium

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

Q.34Medium

What does the available() method in InputStream return?

Q.35Medium

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

Q.36Medium

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

Q.37Medium

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

Q.38Medium

What is the default buffer size used by BufferedInputStream?

Q.39Medium

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

Q.40Medium

Which of the following best describes the relationship between InputStream and Reader classes?