Files and I/O


  1. Which of these is a type of stream in Java?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Java defines only two types of streams – Byte stream and character stream.


  1. Which of these classes are used by Byte streams for input and output operation?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Byte stream uses InputStream and OutputStream classes for input and output operation.



  1. Which of these classes are used by character streams for input and output operations?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Character streams uses Writer and Reader classes for input & output operations.


  1. Which of these class is used to read from byte array?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    ByteArrayInputStream



  1. 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');
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    prstq