My Report

PHP OOP Test – 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

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

2. PHP recognizes constructors by the name _________

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

4. 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.

5. Which version of PHP introduced the instanceof keyword?

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

7. In the following PHP code, what is/are the properties?

    <?php
    class Example 
    {
        public $name;
        function Sample()
        {
            echo "This is an example";
        }
    } 
    ?>

8. Which one of the following functions is used to determine whether a class exists?

9. Which method scope prevents a method from being overridden by a subclass?

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


 

Start practicing “1000 MCQs on PHP”, and once you are ready, you can take tests on all topics by attempting our “PHP Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.