Log In Register

Units


Reading & Writing Files - Questions and Answers

 

Practice these Reading & Writing Files under Java Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Reading & Writing Files for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Reading & Writing Files of Java Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge Java Programming specifically Reading & Writing Files.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Reading & Writing Files under Java Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Reading & Writing Files topic of Java Programming:

 

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

Answer: Option C

Explanation:
 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.

2. Which of these exception is thrown by close() and read() methods?

Answer: Option A

Explanation:
Both close() and read() method throw IOException.

3. Which of these values is returned by read() method is end of file (EOF) is encountered?

Answer: Option C

Explanation:
 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.

4. Which of these methods is used to write() into a file?

Answer: Option C

Explanation:

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

Answer: Option B

Explanation:
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.

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

Answer: Option B

Explanation: