iGET

Java Programming - MCQ Practice Questions

Java interviews and campus tests lean heavily on object oriented behaviour rather than API recall. This set covers inheritance and polymorphism, interfaces and abstract classes, the collections framework, exception handling, multithreading, string handling, and JVM basics such as garbage collection. Output based questions are included because they expose the gaps that theory questions hide.

951 questions | 100% Free

Q.501Medium

What happens when you try to read from a closed stream in Java?

Q.502Medium

Which of the following is a filtered stream?

Q.503Easy

What is the purpose of the flush() method in output streams?

Q.504Medium

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

Q.505Easy

What is the return type of FileInputStream's read() method?

Q.506Medium

Which of the following creates a bridge between character and byte streams?

Q.507Easy

What exception is thrown when a file is not found while creating FileInputStream?

Q.508Easy

Which method reads a complete line from a BufferedReader?

Q.509Medium

What is the difference between FileInputStream and BufferedInputStream?

Q.510Medium

Which class allows reading and writing objects to a stream?

Q.511Medium

What is the mark() method used for in BufferedReader?

Q.512Medium

Which of the following statements will correctly read a file line by line?

Q.513Medium

What is the purpose of the skip() method in InputStream?

Q.514Hard

In Java NIO, which class replaces traditional Stream-based I/O for better performance?

Q.515Hard

What happens if you call close() multiple times on a stream?

Q.516Hard

Which of the following is true about serialization in Java?

Q.517Medium

A Java program needs to read a file containing 10 million integers. Which approach would be most memory-efficient?

Q.518Easy

Which of the following correctly demonstrates chaining multiple filters in Java I/O?

Q.519Medium

A serialized object contains a field marked as 'transient'. What happens to this field when the object is deserialized?

Q.520Hard

In a multi-threaded environment, which stream class provides thread-safe read/write operations without external synchronization?