Files and I/O


  1. Which of these methods are used to read in from file?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Each time read() is called, it reads a single byte from the file and returns the byte as an integer value. read() returns -1 when the end of the file is encountered.


  1. Which of these exception is thrown in cases when the file specified for writing is not found?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    In cases when the file specified is not found, then FileNotFoundException is thrown by java run-time system, earlier versions of java used to throw IOException but after Java 2.0 they throw FileNotFoundException.



  1. Which of these class contains the methods used to write in a file?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    FileInputStream


  1. Which of these class is used to read from a file?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    FileInputStream



  1. Which of these classes are used by character streams 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.