Polymorphism
6.Why can overloaded methods have different access modifiers?
-
A. Because access modifiers do not affect method binding
-
B. Because overloaded methods are always resolved at runtime
-
C. Because Java allows access modifiers to be different only for constructors
-
D. Because different access modifiers improve performance
Because access modifiers do not affect method binding
Because access modifiers do not affect method binding
7.Why does Java not allow method overriding for static methods?
-
A. Because static methods belong to the class, not instances
-
B. Because static methods are resolved at runtime
-
C. Because static methods can only be overloaded
-
D. Because static methods do not support access control
Because static methods belong to the class, not instances
Because static methods belong to the class, not instances
8.What characteristic of polymorphism allows a subclass method to be called using a superclass reference?
-
A. Method Hiding
-
B. Method Overloading
-
C. Dynamic Method Dispatch
-
D. Static Binding
Dynamic Method Dispatch
Dynamic Method Dispatch
9.Why is method overloading not considered true polymorphism?
-
A. Because it does not involve inheritance
-
B. Because method selection happens at compile-time
-
C. Because overloading requires an explicit cast
-
D. Because method overloading is not possible in Java
Because method selection happens at compile-time
Because method selection happens at compile-time
10.What is the main advantage of runtime polymorphism?
-
A. It improves method execution speed
-
B. It allows method resolution at compile-time
-
C. It provides flexibility by enabling method behavior to change dynamically
-
D. It prevents method overriding
It provides flexibility by enabling method behavior to change dynamically
It provides flexibility by enabling method behavior to change dynamically