Java - Exceptions - Interview Questions and Answers on ParseException

Q1.  What will the following code do ?

String dateStr = "2011 11 19";
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = dateFormat.parse(dateStr);
System.out.println(date);
 
Ans. It will throw the ParseException as the date format doesn't abide with the format of the specified date.

Q2.  Which of the following exception is thrown when we try to access element which is beyond the size ?

 a. NullPointerException
 b. ArrayIndexOutOfBoundException
 c. ArithmeticException
 d. ParseException

Ans. ArrayIndexOutOfBoundException

Q3. Which interfaces are implemented by  ParseException?

Ans.[Serializable]

Q4. Which is the Parent Class of  ParseException class?

Ans.Exception