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
Which of the following is a character stream class in Java?
Which method is used to read a single byte from a FileInputStream?
What is the purpose of the flush() method in output streams?
What is the return type of FileInputStream's read() method?
What exception is thrown when a file is not found while creating FileInputStream?
Which method reads a complete line from a BufferedReader?
Which of the following correctly demonstrates chaining multiple filters in Java I/O?
What will be the output of reading from a ByteArrayInputStream initialized with bytes [65, 66, 67] after calling read() three times?
A RandomAccessFile is opened with mode 'r'. Which operation will throw an exception?
When using ObjectInputStream, what exception is thrown if the serialVersionUID doesn't match?
Which class in Java I/O streams is used to read primitive data types from a binary file?
What is the purpose of the flush() method in PrintWriter?
Which of the following is a character-based stream in Java?
Which class would you use to read and write at arbitrary positions in a file?
What happens when you attempt to read from a closed InputStream?
Which class in Java is used to read primitive data types from a binary stream?
What is the output of the following code? FileReader fr = new FileReader("test.txt"); int data = fr.read(); System.out.println(data);
Which interface must be implemented by a class to make its objects serializable?
What does the flush() method do in output streams?
Which class provides buffering capability to improve I/O performance?