Home Subjects Java Programming I/O Streams

Java Programming
I/O Streams

Java OOP, collections, multithreading

53 Q 10 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 51–53 of 53
Topics in Java Programming
Q.51 Medium I/O Streams
Which of the following is a filtered stream?
A FileOutputStream
B BufferedOutputStream
C ByteArrayOutputStream
D PipedOutputStream
Correct Answer:  B. BufferedOutputStream
EXPLANATION

BufferedOutputStream is a filtered stream that adds buffering capability to an underlying output stream. Filtered streams wrap other streams to add functionality.

Test
Q.52 Medium I/O Streams
What happens when you try to read from a closed stream in Java?
A Returns -1
B Throws IOException
C Returns null
D Blocks indefinitely
Correct Answer:  B. Throws IOException
EXPLANATION

Attempting to read from a closed stream throws an IOException. The stream must be open for read operations.

Test
Q.53 Medium I/O Streams
What is the default buffer size of BufferedReader in Java?
A 512 bytes
B 1024 bytes
C 2048 bytes
D 4096 bytes
Correct Answer:  C. 2048 bytes
EXPLANATION

BufferedReader has a default buffer size of 8192 characters, but commonly 2048 bytes is used. The exact implementation may vary, but 8192 is the default character buffer.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips