menu

PHP OOPs Concepts


1. Which keyword is used to create a new instance of a class in PHP?

this

class

object

new


2. Which OOPs concept is used to define a class in terms of other classes?

Inheritance

Abstraction

Encapsulation

None of the above


3. Which OOPs concept is used to restrict access to properties and methods of a class?

Encapsulation

Inheritance

Polymorphism

Abstraction


4. Which keyword is used to declare a method as static in PHP?

static

function

self

$this


5. Which OOPs concept is used to define a blueprint for a class?

Abstraction

Inheritance

Encapsulation

Polymorphism


6. Which keyword is used to refer to the parent class of a class in PHP?

this

self

static

parent


7. Which keyword is used to declare a class in PHP?

object

new

class

this


8. Which keyword is used to prevent a class from being inherited by other classes in PHP?

$final

final

abstract

private


9. Which OOPs concept allows objects of different classes to be treated as if they were objects of the same class?

Polymorphism

Inheritance

Encapsulation

Abstraction


10. Which OOPs concept allows a class to have multiple methods with the same name but different parameters?

Overloading

Polymorphism

Inheritance

Encapsulation