Online Quiz Solution Object- Oriented Programming

1. In object-oriented programming terminology, an unexpected or error condition____________

a. anomaly

b. aberration

c. deviation

d. exception

 

2. All Java Exceptions are ___________

a. Errors

b. RuntimeExceptions

c. Throwables

d. Omissions

 

3. Which of the following statements is true?

a. Exceptions are more serious than Errors.

b. Errors are more serious than Exceptions.

c. Errors and Exceptions are equally serious.

d. Exceptions and Errors are the same thing.

 

4. The method that ends the current application and returns control to the operating

a. System.end()

b. System.done()

c. System.exit()

d. System.abort()

 

5. In object-oriented terminology, you__________a procedure that might not complete correctly.

a. try

b. catch

c. handle

d. encapsulate

 

6. A method that detects an error condition or Exception an___________ Exception.

a. throws

b. catches

c. handles

d. encapsulates

 

7. A try block includes all of the following elements except ___________

a. the keyword try

b. the keyword catch

c. curly braces

d. statements that might cause Exceptions

 

 

8. The segment of code that handles or takes appropriate action following an exception is a________block.

a. try

b. catch

c. throws

d. handles

 

9. You__________ within a try block.

a. must place only a single statement

b. can place any number of statements

c. must place at least two statements

d. must place a catch block

10. If you include three statements in a try block and follow the block with three catch blocks, and the second statement in the try block throws an Exception, then _______

a. the first catch block executes

b. the first two catch blocks execute

c. only the second catch block executes

d. the first matching catch block executes

 

11. When a try block does not generate an Exception and you have included multiple catch blocks________

a. they all execute

b. only the first one executes

c. only the first matching one executes

d. no catch blocks execute

 

12. The catch block that begins catch(Exception e) can catch Exceptions of type __________

a. IOException

b. ArithmeticException

c. both of the above

d. none of the above

 

 

13. The code within a final block executes when the try block.

a. identifies one or more Exceptions

b. does not identify any Exceptions

c. either a or b

d. neither a nor b

 

 

14. An advantage to using a try…catch block is that exceptional events are__________

a. eliminated

b. reduced

c. integrated with regular events

d. isolated from regular events

 

15. Which methods can throw an Exception?

a. methods with a throws clause

b. methods with a catch block

c. methods with both a throws clause and a catch block

d. any method

 

16. A method can ___________

a. check for errors but not handle them

b. handle errors but not check for them

c. either of the above

d. neither of the above

 

17. Which of the following is least important to know if you want to be able to use a method to its full potential?

a. the method’s return type

b. the type of arguments the method requires

the number of statements within the method

d. the type of Exceptions the method throws

 

18. The memory location where the computer stores the list of method locations to which the system must return is known as the _________________

a. registry

b. call stack

c. chronicle

d. archive

 

19. You can get a list of the methods through which an Exception has travelled by using the__________ method.

a. getMessage()

b. callStack()

c. getPath()

d. printStackTrace()

 

20. A (n)____________ is a statement used in testing programs that should be true; if it is not true, an Exception is thrown.

a. assertion

b. throwable

c. verification

d. declaration

Download Complete Solution

Enjoy 40% Discount on All Assignments. Call: +61 282 942 025

Or