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

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

Q.2Easy

Which method is used to read a single byte from a FileInputStream?

Q.3Easy

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

Q.4Easy

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

Q.5Easy

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

Q.6Easy

Which method reads a complete line from a BufferedReader?

Q.7Easy

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

Q.8Easy

What will be the output of reading from a ByteArrayInputStream initialized with bytes [65, 66, 67] after calling read() three times?

Q.9Easy

A RandomAccessFile is opened with mode 'r'. Which operation will throw an exception?

Q.10Easy

When using ObjectInputStream, what exception is thrown if the serialVersionUID doesn't match?

Q.11Easy

Which class in Java I/O streams is used to read primitive data types from a binary file?

Q.12Easy

What is the purpose of the flush() method in PrintWriter?

Q.13Easy

Which of the following is a character-based stream in Java?

Q.14Easy

Which class would you use to read and write at arbitrary positions in a file?

Q.15Easy

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

Q.16Easy

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

Q.17Easy

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

Q.18Easy

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

Q.19Easy

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

Q.20Easy

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