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

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

Q.542Medium

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

Q.543Hard

For encrypting data while writing to a file, which approach is most appropriate?

Q.544Easy

What happens when you attempt to read from a closed InputStream?

Q.545Hard

In Java NIO, what is a key advantage of FileChannel over traditional I/O streams?

Q.546Hard

Which serialization approach maintains backward compatibility better?

Q.547Medium

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

Q.548Medium

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

Q.549Medium

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

Q.550Medium

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

Q.551Hard

For developing a high-performance file copying utility handling files up to 10GB, which approach is optimal?

Q.552Easy

Which class in Java is used to read primitive data types from a binary stream?

Q.553Easy

What is the output of the following code? FileReader fr = new FileReader("test.txt"); int data = fr.read(); System.out.println(data);

Q.554Easy

Which interface must be implemented by a class to make its objects serializable?

Q.555Easy

What does the flush() method do in output streams?

Q.556Easy

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

Q.557Medium

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

Q.558Medium

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

Q.559Easy

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

Q.560Medium

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