PHP OOPs Concepts
PHP OOPs Concepts - Important Points
6. | Which OOPs concept is used to restrict access to properties and methods of a class? |
---|
A. Encapsulation
B. Inheritance
C. Polymorphism
D. Abstraction
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Encapsulation is the OOPs concept that is used to restrict access to properties and methods of a class.
7. | Which keyword is used to refer to the current instance of a class in PHP? |
---|
A. self
B. object
C. this
D. new
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The "this" keyword is used to refer to the current instance of a class in PHP.
8. | Which OOPs concept allows objects of different classes to be treated as if they were objects of the same class? |
---|
A. Polymorphism
B. Inheritance
C. Encapsulation
D. Abstraction
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Polymorphism is the OOPs concept that allows objects of different classes to be treated as if they were objects of the same class.
9. | Which keyword is used to access a property or method of a class within the class itself? |
---|
A. this
B. $this
C. parent
D. static
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The "$this" keyword is used to access a property or method of a class within the class itself.
10. | Which OOPs concept is used to define a blueprint for a class? |
---|
A. Abstraction
B. Inheritance
C. Encapsulation
D. Polymorphism
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Abstraction is the OOPs concept that is used to define a blueprint for a class.