JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Object Oriented Programming interview questions part 17
Object Oriented Programming interview questions part 17
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What is an exception?
A. Problem arising during compile time
B. Problem arising during runtime
C. Problem in syntax
D. Problem in IDE
Show Correct Answer
Correct Answer is :
Problem arising during runtime
2. Why do we need to handle exceptions?
A. To prevent abnormal termination of program
B. To encourage exception prone program
C. To avoid syntax errors
D. To save memory
Show Correct Answer
Correct Answer is :
To prevent abnormal termination of program
3. An exception may arise when _______________
A. Input is fixed
B. Input is some constant value of program
C. Input given is invalid
D. Input is valid
Show Correct Answer
Correct Answer is :
Input given is invalid
4. If a file that needs to be opened is not found in the target location then _____________
A. Exception will be produced
B. Exceptions are not produced
C. Exception might get produced because of syntax
D. Exceptions are not produced because of logic
Show Correct Answer
Correct Answer is :
Exception will be produced
5. Which is the universal exception handler class?
A. Object
B. Math
C. Errors
D. Exceptions
Show Correct Answer
Correct Answer is :
Exceptions
6. What are two exception classes in hierarchy of java exceptions class?
A. Runtime exceptions only
B. Compile time exceptions only
C. Runtime exceptions and other exceptions
D. Other exceptions
Show Correct Answer
Correct Answer is :
Runtime exceptions and other exceptions
7. Which are the two blocks that are used to check error and handle the error?
A. Try and catch
B. Trying and catching
C. Do and while
D. TryDo and Check
Show Correct Answer
Correct Answer is :
Try and catch
8. There can be a try block without catch block but vice versa is not possible.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
9. How many catch blocks can a single try block can have?
A. Only 1
B. Only 2
C. Maximum 127
D. As many as required
Show Correct Answer
Correct Answer is :
As many as required
10. Which among the following is not a method of Throwable class?
A. public String getMessage()
B. public Throwable getCause()
C. public Char toString()
D. public void printStackTrace()
Show Correct Answer
Correct Answer is :
public Char toString()
11. To catch the exceptions ___________________
A. An object must be created to catch the exception
B. A variable should be created to catch the exception
C. An array should be created to catch all the exceptions
D. A string have to be created to store the exception
Show Correct Answer
Correct Answer is :
An object must be created to catch the exception
12. Multiple catch blocks __________________
A. Are mandatory for each try block
B. Can be combined into a single catch block
C. Are not possible for a try block
D. Can never be associated with a single try block
Show Correct Answer
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?
A. ?
B. ,
C. –
D. |
Show Correct Answer
Correct Answer is :
|
14. Which class is used to handle the input and output exceptions?
A. InputOutput
B. InputOutputExceptions
C. IOExceptions
D. ExceptionsIO
Show Correct Answer
Correct Answer is :
IOExceptions
15. Why do we use finally block?
A. To execute the block if exception occurred
B. To execute a code when exception is not occurred
C. To execute a code whenever required
D. To execute a code with each and every run of program
Show Correct Answer
Correct Answer is :
To execute a code with each and every run of program
16. Which among the following best describes the constructors?
A. A function which is called whenever an object is referenced
B. A function which is called whenever an object is created to initialize the members
C. A function which is called whenever an object is assigned to copy the values
D. A function which is called whenever an object is to be given values for members
Show Correct Answer
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?
A. A function which is called just before the objects are destroyed
B. A function which is called after each reference to the object
C. A function which is called after termination of the program
D. A function which is called before calling any member function
Show Correct Answer
Correct Answer is :
A function which is called just before the objects are destroyed
18. Which among the following represents correct constructor?
A. ()classname
B. ~classname()
C. –classname()
D. classname()
Show Correct Answer
Correct Answer is :
classname()
19. Which among the following is correct syntax for the destructors?
A. classname()
B. ()classname
C. ~classname()
D. -classname()
Show Correct Answer
Correct Answer is :
~classname()
20. Which among the following is true?
A. First the constructor of parent classes are called in sequence of inheritance
B. First the constructor of child classes are called in the sequence of inheritance
C. First constructor called is of the object being created
D. Constructors are called randomly
Show Correct Answer
Correct Answer is :
First the constructor of parent classes are called in sequence of inheritance
Similar Interview Questions
Search for latest jobs
Find Jobs