Sail E0 Webinar

MCQs

Total Questions : 15 | Page 1 of 2 pages
Question 1. Which of these operator is used to generate an instance of an exception than can be thrown by using throw?
  1.    new
  2.    malloc
  3.    alloc
  4.    thrown
 Discuss Question
Answer: Option A. -> new


new is used to create instance of an exception. All of java's built in run-time exceptions have two constructors : one with no parameters and one that takes a string parameter.


Question 2. Which of these keywords is used to generate an exception explicitly?
  1.    try
  2.    finally
  3.    throw
  4.    catch
 Discuss Question
Answer: Option C. -> throw


throw


Question 3. Which of these class is related to all the exceptions that are explicitly thrown?
  1.    Error
  2.    Exception
  3.    Throwable
  4.    Throw
 Discuss Question
Answer: Option C. -> Throwable


Throwable


Question 4. Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?
  1.    try
  2.    throw
  3.    throws
  4.    catch
 Discuss Question
Answer: Option C. -> throws


If a method is capable of causing an exception that it does not handle. It must specify this behaviour the behaviour so that callers of the method can guard themselves against that exception. This is done by using throws clause in methods declaration.


Question 5. Which of these handles the exception when no catch is used?
  1.    Default handler
  2.    finally
  3.    throw handler
  4.    Java run time system
 Discuss Question
Answer: Option A. -> Default handler


Default handler


Question 6. When does Exceptions in Java arises in code sequence?
  1.    Run Time
  2.    Compilation Time
  3.    Can Occur Any Time
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> Run Time


Exceptions in java are run-time errors.


Question 7. Which of these keywords is not a part of exception handling?
  1.    try
  2.    finally
  3.    thrown
  4.    catch
 Discuss Question
Answer: Option C. -> thrown


Exceptional handling is managed via 5 keywords “ try, catch, throws, throw and finally.


Question 8. Which of these keywords is used to manually throw an exception?
  1.    try
  2.    finally
  3.    throw
  4.    catch
 Discuss Question
Answer: Option C. -> throw


throw


Question 9. Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
  1.    try
  2.    finally
  3.    throw
  4.    catch
 Discuss Question
Answer: Option D. -> catch


If an exception occurs within the try block, it is thrown and cached by catch block for processing.


Question 10. Which of these keywords must be used to monitor for exceptions?
  1.    try
  2.    finally
  3.    throw
  4.    catch
 Discuss Question
Answer: Option A. -> try


try


Latest Videos

Latest Test Papers