Explore topic-wise MCQs in Php.

This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following method scopes is/are not supported by PHP?

A. Only ii)
B. Only iv)
C. ii) and iv)
D. Only i)View Answer
Answer» B. Only iv)
2.

Which of the following is/are the right way to declare a method?

A. Only ii)
B. Only iv)
C. i) and ii)
D. iii) and iv)View Answer
Answer» D. iii) and iv)View Answer
3.

Which one of the following is the right way to define a constant?

A. constant PI = “3.1415”;
B. const $PI = “3.1415”;
C. constant PI = ‘3.1415’;
D. const PI = ‘3.1415’;
Answer» E.
4.

Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo?

A. $obj = new $foo;
B. $obj = new foo;
C. $obj = new foo ();
D. obj = new foo ();
Answer» D. obj = new foo ();
5.

Which one of the following property scopes is not supported by PHP?

A. friendly
B. final
C. public
D. static
Answer» B. final
6.

The practice of creating objects based on predefined classes is often referred to as ______________

A. class creation
B. object creation
C. object instantiation
D. class instantiation
Answer» E.
7.

Which of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?

A. Abstraction
B. Polymorphism
C. Inheritance
D. Differential
Answer» C. Inheritance
8.

The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________

A. Polymorphism
B. Inheritance
C. Encapsulation
D. Abstraction
Answer» D. Abstraction