Professional Documents
Culture Documents
1. What is the process of defining a method in a subclass having same name & type Answer: b
signature as a method in its superclass?
a) Method overloading c) Method hiding
b) Method overriding d) Method encapsulation
2. Which of these is supported by method overriding in Java? Answer: C
a) Abstraction c) Polymorphism
b) Encapsulation d) Inheritance
3. When the subclass method is intended as a replacement of the superclass method. Answer: A
a) Overriding c) Dependency
b) Extension d) Overloading
4. Which of this keyword can be used in a subclass to call the constructor of Answer: A
superclass?
a) super
b) this
c) extent
d) extends
5. What is the process of defining a method in a subclass having same name & type Answer: B
signature as a method in its superclass?
a) Method overloading
b) Method overriding
c) Method hiding
d) None of the mentioned
6. Which of these is supported by method overriding in Java? Answer: C
a) Abstraction
b) Encapsulation
c) Polymorphism
d) None of the mentioned
7. What will be the output of the following Java code? Answer: B
public class Person {
public void talk() {
System.out.print(“I am a Person”);
}
}
class B extends A {
private void printName() {
System.out.println(“Name-B”);
}
}
A. C.
D.
B.