| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

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

Total Questions: 20

1. When does method overloading is determined?

Correct Answer is : At compile time

2. When Overloading does not occur?

Correct Answer is : More than one method with same name, same number of parameters and type but different signature

3. Which concept of Java is a way of converting real world objects in terms of class?

Correct Answer is : Abstraction

4. Which concept of Java is achieved by combining methods and attribute into a class?

Correct Answer is : Encapsulation

5. What is it called if an object has its own lifecycle and there is no owner?

Correct Answer is : Association

6. What is it called where child object gets killed if parent object is killed?

Correct Answer is : Composition

7. What is it called where object has its own lifecycle and child object cannot belong to another parent object?

Correct Answer is : Aggregation

8. Method overriding is combination of inheritance and polymorphism?

Correct Answer is : TRUE

9. What is true about private constructor?

Correct Answer is : Private constructor ensures only one instance of a class exist at any point of time

10. What would be the behaviour if this() and super() used in a method?

Correct Answer is : compile time error

11. What is false about constructor?

Correct Answer is : Constructor can be overloaded

12. What is true about Class.getInstance()?

Correct Answer is : Class.getInstance creates object if class does not have any constructor

13. What is true about constructor?

Correct Answer is : It can take any number of parameters

14. Abstract class cannot have a constructor.

Correct Answer is : FALSE

15. What is true about protected constructor?

Correct Answer is : Protected constructor can only be called using super()

16. What is not the use of “this” keyword in Java?

Correct Answer is : Passing itself to method of the same class

17. What would be the behaviour if one parameterized constructor is explicitly defined?

Correct Answer is : Compilation succeeds but at the time of creating object using default constructor, it throws compilation error

18. What would be behaviour if the constructor has a return type?

Correct Answer is : Compilation error

19. Which one of the following is not an access modifier?

Correct Answer is : Void

20. All the variables of class should be ideally declared as?

Correct Answer is : private