JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Java interview questions part 13
Java interview questions part 13
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. When does method overloading is determined?
A. At run time
B. At compile time
C. At coding time
D. At execution time
Show Correct Answer
Correct Answer is :
At compile time
2. When Overloading does not occur?
A. More than one method with same name but different method signature and different number or type of parameters
B. More than one method with same name, same signature but different number of signature
C. More than one method with same name, same signature, same number of parameters but different type
D. More than one method with same name, same number of parameters and type but different signature
Show Correct Answer
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?
A. Polymorphism
B. Encapsulation
C. Abstraction
D. Inheritance
Show Correct Answer
Correct Answer is :
Abstraction
4. Which concept of Java is achieved by combining methods and attribute into a class?
A. Encapsulation
B. Inheritance
C. Polymorphism
D. Abstraction
Show Correct Answer
Correct Answer is :
Encapsulation
5. What is it called if an object has its own lifecycle and there is no owner?
A. Aggregation
B. Composition
C. Encapsulation
D. Association
Show Correct Answer
Correct Answer is :
Association
6. What is it called where child object gets killed if parent object is killed?
A. Aggregation
B. Composition
C. Encapsulation
D. Association
Show Correct Answer
Correct Answer is :
Composition
7. What is it called where object has its own lifecycle and child object cannot belong to another parent object?
A. Aggregation
B. Composition
C. Encapsulation
D. Association
Show Correct Answer
Correct Answer is :
Aggregation
8. Method overriding is combination of inheritance and polymorphism?
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
9. What is true about private constructor?
A. Private constructor ensures only one instance of a class exist at any point of time
B. Private constructor ensures multiple instances of a class exist at any point of time
C. Private constructor eases the instantiation of a class
D. Private constructor allows creating objects in other classes
Show Correct Answer
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?
A. Runtime error
B. Throws exception
C. compile time error
D. Runs successfully
Show Correct Answer
Correct Answer is :
compile time error
11. What is false about constructor?
A. Constructors cannot be synchronized in Java
B. Java does not provide default copy constructor
C. Constructor can be overloaded
D. “this” and “super” can be used in a constructor
Show Correct Answer
Correct Answer is :
Constructor can be overloaded
12. What is true about Class.getInstance()?
A. Class.getInstance calls the constructor
B. Class.getInstance is same as new operator
C. Class.getInstance needs to have matching constructor
D. Class.getInstance creates object if class does not have any constructor
Show Correct Answer
Correct Answer is :
Class.getInstance creates object if class does not have any constructor
13. What is true about constructor?
A. It can contain return type
B. It can take any number of parameters
C. It can have any non access modifiers
D. Constructor cannot throw an exception
Show Correct Answer
Correct Answer is :
It can take any number of parameters
14. Abstract class cannot have a constructor.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
15. What is true about protected constructor?
A. Protected constructor can be called directly
B. Protected constructor can only be called using super()
C. Protected constructor can be used outside package
D. protected constructor can be instantiated even if child is in a different package
Show Correct Answer
Correct Answer is :
Protected constructor can only be called using super()
16. What is not the use of “this” keyword in Java?
A. Passing itself to another method
B. Calling another constructor in constructor chaining
C. Referring to the instance variable when local variable has the same name
D. Passing itself to method of the same class
Show Correct Answer
Correct Answer is :
Passing itself to method of the same class
17. What would be the behaviour if one parameterized constructor is explicitly defined?
A. Compilation error
B. Compilation succeeds
C. Runtime error
D. Compilation succeeds but at the time of creating object using default constructor, it throws compilation error
Show Correct Answer
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?
A. Compilation error
B. Runtime error
C. Compilation and runs successfully
D. Only String return type is allowed
Show Correct Answer
Correct Answer is :
Compilation error
19. Which one of the following is not an access modifier?
A. Public
B. Private
C. Protected
D. Void
Show Correct Answer
Correct Answer is :
Void
20. All the variables of class should be ideally declared as?
A. private
B. public
C. protected
D. default
Show Correct Answer
Correct Answer is :
private
Similar Interview Questions
Search for latest jobs
Find Jobs