in Education by
Which of these values is returned by read() method is end of file (EOF) is encountered? (a) 0 (b) 1 (c) -1 (d) Null This question was addressed to me by my college director while I was bunking the class. Question is taken from Reading & Writing Files in portion I/O & Applets of Java Select the correct answer from above options JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Right option is (c) -1 The best 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.

Related questions

0 votes
    What is the range of numbers returned by Math.random() method? (a) -1.0 to 1.0 (b) -1 ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of these methods are used to read in from file? (a) get() (b) read() (c) scan() ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    When an empty statement is encountered, a JavaScript interpreter __________ (a) Ignores the statement (b) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which exception is thrown by read() method? (a) IOException (b) InterruptedException (c) SystemException (d ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
0 votes
    Which of the following is used to limit the number of rows returned? (a) setMaxRows(int i) (b) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    How to read entire file in one line using java 8? (a) Files.readAllLines() (b) Files.read() (c ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    How will you convert the returned API into an XML object? (a) SimpleElement() (b) SimpleXMLElement() ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    Which of these is used to read a string from the input stream? (a) get() (b) getLine() (c ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which method is used to generate boolean random values in java? (a) nextBoolean() (b) randomBoolean() ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of the following matches end of the string using regular expression in java? (a) \z (b) \\ ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
...