Files and I/O
- Which of these is a type of stream in Java?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Java defines only two types of streams – Byte stream and character stream.
- Which of these classes are used by Byte streams for input and output operation?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Byte stream uses InputStream and OutputStream classes for input and output operation.
- Which of these classes are used by character streams for input and output operations?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Character streams uses Writer and Reader classes for input & output operations.
- Which of these class is used to read from byte array?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
ByteArrayInputStream
- What is the output of this program if input given is ‘prstquvwxyz’?
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String args[]) throws IOException
{
char c;
BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
do
{
c = (char) obj.read();
System.out.print(c);
} while(c != 'q');
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
prstq