Vidyalelo
PHP · all questions

Object Oriented Concept
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

141

Questions

4/8

Page

Pick an option on a question to see the right answer and solution.

Which one of the following functions is used to determine object type?

Select an option to see the answer and solution.

Which one of the following keyword is used to inherit our subclass into a superclass?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which keyword is used to refer to properties or methods within the class itself?

Select an option to see the answer and solution.

Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?

Select an option to see the answer and solution.

Which of the following advanced OOP features is/are not supported by PHP?
1. Method overloading
2. Multiple Inheritance
3. Namespaces
4. Object Cloning

Select an option to see the answer and solution.

Which version of PHP introduced the advanced concepts of OOP?

Select an option to see the answer and solution.

Which one of the following is the right way to clone an object?

Select an option to see the answer and solution.

The class from which the child class inherits is called.
1. Child class
2. Parent class
3. Super class
4. Base class

Select an option to see the answer and solution.

Which of the following is/are true for an abstract class?
1. A class is declared abstract by prefacing the definition with the word abstract.
2. A class is declare abstract by using the keyword implements.
3. It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.
4. Attempting to instantiate an abstract class results in an error.

Select an option to see the answer and solution.

If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?

Select an option to see the answer and solution.

If your object must inherit behavior from a number of sources you must use a/an

Select an option to see the answer and solution.

Which method is used to tweak an object’s cloning behavior?

Select an option to see the answer and solution.

Which feature allows us to call more than one method or function of the class in single instruction?

Select an option to see the answer and solution.

Which magic method is used to implement overloading in PHP?

Select an option to see the answer and solution.

A package is a set of related _________

Select an option to see the answer and solution.

Till which version of PHP, developers were forced to name their files in a global context?

Select an option to see the answer and solution.

Which of the following can you place inside a namespace?
1. classes
2. functions
3. variables

Select an option to see the answer and solution.

Which one of the following is the correct way of declaring a namespace?

Select an option to see the answer and solution.

Which symbol is used to declare nested namespaces?

Select an option to see the answer and solution.