PHP OOP Mcqs

Our collections of Multiple choice questions and answers focuses on study of PHP OOP. These questions are chosen from a collection of most authoritative and best reference books on PHP Language. Our aim is to prepare an individual for competitive exams like NTS, GAT, ECAT, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate PHP OOP Topics comprehensively.

32.
Which one of the following is the right way to invoke a method?

$object->methodName();

Object->methodName();

Object::methodName();

$object::methodName();

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

i) function functionName() { function body }
ii) scope function functionName() { function body }
iii) method methodName() { method body }
iv) scope method methodName() { method body }

Only ii)

Only iv)

I) and ii)

Iii) and iv)

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

i) private
ii) final
iii) static
iv) abstract

Only ii)

Only iv)

Ii) and iv)

None of the mentioned

36.
Which of the following statements is/are true about Constructors in PHP?

i) PHP 4 introduced class constructors.
ii) Constructors can accept parameters.
iii) Constructors can call class methods or other functions.
iv) Class constructors can call on other constructors.

Ii) and iii)

All of the mentioned

None of the mentioned

Ii), iii) and iv)

42.
In the PHP code given below, what is/are the properties?
<?php
    class Example 
    {
        public $name;
        function Sample()
        {
            echo "This is an example";
        }
    } 
?>

Public $name;

Class Example

Function sample()

45.
Which of the following advanced OOP features is/are not supported by PHP?

i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning

All of the mentioned

None of the mentioned

I) and ii)

Iii) and iv)

error: You are not allowed to do so.....
0Shares
0
Scroll to Top