Use the code below to answer the following questions. Note that the catch statements in the code are not implemented, but you will not need those details. Assume filename is a String, x is an int, a is a double array and i is an int. Use the comments i1, i2, i3, e1, e2, e3, e4, e5 to answer the questions (i for instruction, e for exception handler) .
try
{
BufferedReader infile = new BufferedReader(new FileReader(filename) ) ; // i1
int x = Integer.parseInt(infile.readLine( ) ) ; // i2
a[++i] = (double) (1 / x) ; // i3
}
catch (FileNotFoundException ex) {...} // e1
catch (NumberFormatException ex) {...} // e2
catch (ArithmeticException ex) {...} // e3
catch (ArrayIndexOutOfBounds ex) {...} // e4
catch (IOException ex) {...} // e5
-An exception that could also arise in the try statement that does not have an associated catch statement is
A) ClassNotFoundException
B) IllegalArgumentException
C) NegativeArraySizeException
D) NullPointException
E) OutOfMemoryException
Correct Answer:
Verified
Q8: For the questions below, use the following
Q9: Use the code below to answer the
Q10: The Scanner class provides an abstraction for
Q12: For the questions below, use the following
Q13: The idea that an object can exist
Q14: Use the code below to answer the
Q16: For the questions below, use the following
Q16: An exception can produce a "call stack
Q17: A finally clause will execute
A) only if
Q22: Character streams manage
A) byte-sized data
B) binary data
C)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents