PHP OOPs Concepts
PHP OOPs Concepts - Important Points
16. | Which OOPs concept allows multiple classes to implement the same method in different ways? |
---|
A. Polymorphism
B. Inheritance
C. Encapsulation
D. Abstraction
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Polymorphism is the OOPs concept that allows multiple classes to implement the same method in different ways.
17. | Which keyword is used to access a static property or method of a class in PHP? |
---|
A. self
B. static
C. $this
D. parent
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The "static" keyword is used to access a static property or method of a class in PHP.
18. | Which OOPs concept is used to create objects from abstract classes and interfaces? |
---|
A. Abstraction
B. Encapsulation
C. Polymorphism
D. Inheritance
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Abstraction is the OOPs concept that is used to create objects from abstract classes and interfaces.
19. | Which keyword is used to prevent a class from being inherited by other classes in PHP? |
---|
A. $final
B. final
C. abstract
D. private
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The "final" keyword is used to prevent a class from being inherited by other classes in PHP.
20. | Which OOPs concept allows a class to have multiple methods with the same name but different parameters? |
---|
A. Overloading
B. Polymorphism
C. Inheritance
D. Encapsulation
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Overloading is the OOPs concept that allows a class to have multiple methods with the same name but different parameters.