Object Oriented Programming interview questions part 17

Object Oriented Programming interview questions part 17

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. What is an exception?

Correct Answer is : Problem arising during runtime

2. Why do we need to handle exceptions?

Correct Answer is : To prevent abnormal termination of program

3. An exception may arise when _______________

Correct Answer is : Input given is invalid

4. If a file that needs to be opened is not found in the target location then _____________

Correct Answer is : Exception will be produced

5. Which is the universal exception handler class?

Correct Answer is : Exceptions

6. What are two exception classes in hierarchy of java exceptions class?

Correct Answer is : Runtime exceptions and other exceptions

7. Which are the two blocks that are used to check error and handle the error?

Correct Answer is : Try and catch

8. There can be a try block without catch block but vice versa is not possible.

Correct Answer is : TRUE

9. How many catch blocks can a single try block can have?

Correct Answer is : As many as required

10. Which among the following is not a method of Throwable class?

Correct Answer is : public Char toString()

11. To catch the exceptions ___________________

Correct Answer is : An object must be created to catch the exception

12. Multiple catch blocks __________________

Correct Answer is : Can be combined into a single catch block

13. Which symbol should be used to separate the type of exception handler classes in a single catch block?

Correct Answer is : |

14. Which class is used to handle the input and output exceptions?

Correct Answer is : IOExceptions

15. Why do we use finally block?

Correct Answer is : To execute a code with each and every run of program

16. Which among the following best describes the constructors?

Correct Answer is : A function which is called whenever an object is created to initialize the members

17. Which among the following best describes destructor?

Correct Answer is : A function which is called just before the objects are destroyed

18. Which among the following represents correct constructor?

Correct Answer is : classname()

19. Which among the following is correct syntax for the destructors?

Correct Answer is : ~classname()

20. Which among the following is true?

Correct Answer is : First the constructor of parent classes are called in sequence of inheritance

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon