Java polymorphism and inheritance also oop concepts
Encapsulation concept in java is 1. Hiding complexity 2. method hiding 3. Hiding constructor 4. None
1
Exposing only necessary information to clients ( main programs, classes) is known as 1. Abstraction 2. Encapsulation 3. Data hiding 4. Hiding complexity
1
For Cat and Animal class, correct way of inheritance in java is 1. class Cat extends Animal 2. class Animal extends Cat 3. Both are correct way 4. None is correct way
1
IS-A relationship in java is related to 1. Inheritance 2. Encapsulation 3. Composition 4. None
1
To prevent a class to be inherited / extended, the class should be 1. final class 2. abstract class 3. final and abstract both 4. none
1
What is subclass in java? 1. A subclass is a class that extends another class 2. A subclass is a class declared inside a class 3. Both above. 4. None of the above.
1
Which class cannot be sub classed? 1. final class 2. object class 3. abstract class 4. child class
1
Which cannot be inherited from a base class in Java programming 1. Constructor 2. final method 3. Both 4. None
1 Constructor of a class cannot be inherited. But note that they can be invoked from a derived class. final method can be inherited just they cannot be overridden in sub class.
Which of the following is/are true statements? 1. A class can extend only one class but can implement many interfaces 2. An interface can extend many interfaces 3. An interface can implement another interface 4. An interface can implement a class
1 and 2
In which java oops feature one object can acquire all the properties and behaviors of the parent object? 1. Encapsulation 2. Inheritance 3. Polymorphism 4. None of the above
2
Inheritance relationship in Java language is 1. Association 2. Is-A 3. Has-A 4. None
2
Java does not support _______________? 1. Inheritance 2. Multiple inheritance for classes 3. multiple inheritance of interfaces 4. compile time polymorphism
2 Java does not support multiple inheritance for classes but in java multiple inheritance behavior is implemented using interfaces.
Polymorphism types in Java is/are 1. Compile time 2. Run time 3. Both 4. None
3
The functionality of multiple inheritance can be implemented in Java by I. Extending one class and implementing multiple interfaces. II.Implementing multiple interfaces. III.Extending multiple classes and interfaces. IV. Extending multiple classes and one interface 1. Only I 2. Only III 3. I & II 4. II & III
3
Which is/are false statements 1. final class cannot be inherited 2. final method can be inherited 3. final method can be overridden 4. final variable of a class cannot be changed.
3
Which polymorphism concept is applied to inheritance relationship in java programming? 1. Method overloading 2. Constructor overloading 3. Method overriding 4. None
3
Which polymorphism feature is related to parent and child class relationship in java. 1. Method overloading 2. Constructor overloading 3. Method overriding 4. Both A and B 5. Bothe A and C
3
Advantage of inheritance in java programming is/are 1. Code Re-usability 2. Class Extendibility 3. Save development time 4. All
4
Java object oriented programming concepts is/are 1. Encapsulation 2. Inheritance 3. polymorphism 4. All of the above.
4
What concepts come under Polymorphism in java? 1. Method overloading 2. Constructor overloading 3. Method overriding 4. All the above
4
Which are true statements regarding polymorphism concept? 1. Method overloading is used in same class only 2. Constructor overloading is used in same class only 3. Method overriding is used in base class and derived class 4. All
4
Which cannot be inherited from a base class in Java programming? 1. Cannot override private method of a class 2. Protected methods are visible to only immediate child class 3. Public methods of a class are visible to all. 4. All
4
Which feature comes under compile time polymorphism? 1. Method overloading 2. Constructor overloading 3. Method overriding 4. Both A and B 5. Both A and C
4 Method overloading, and constructor overloading come under compile time polymorphism. as compiler resolves overloaded method at compile time. in simple word, compiler can understand which overloaded method or constructor to call at compile time itself.Read more on compile time and run time polymorphism in java with example.
Following concept can be used for encapsulation in java programs 1. Wrapping data fields with methods 2. Hiding data and internal methods using access modifiers in a class 3. Using Interfaces 4. All of the above
4 Encapsulation means, hiding the complexities in java programs. All options above are used to implement encapsulation in java object oriented programming.
