MCQOPTIONS
Saved Bookmarks
This section includes 13 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 magic method is used to implement overloading in PHP? |
| A. | __call |
| B. | __invoke |
| C. | __wakeup |
| D. | __unset |
| Answer» B. __invoke | |
| 2. |
Which feature allows us to call more than one method or function of the class in single instruction? |
| A. | Typecasting |
| B. | Method Including |
| C. | Method adding |
| D. | Method chaining |
| Answer» E. | |
| 3. |
If one intends to create a model that will be assumed by a number of closely related objects, which class must be used? |
| A. | Normal class |
| B. | Static class |
| C. | Abstract class |
| D. | Interface |
| Answer» D. Interface | |
| 4. |
Which of the following is/are true for an abstract class?i) Abstract classes in PHP are declared with the help of abstract keyword.ii) A class is declare abstract by using the keyword implements.iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.iv) Attempting to instantiate an abstract class results in an error. |
| A. | Only i) |
| B. | Only iii) |
| C. | ii) and iv) |
| D. | ii), iii) and iv) |
| Answer» B. Only iii) | |
| 5. |
The class from which the child class inherits is called ________ |
| A. | Only i) |
| B. | ii), iii) and iv) |
| C. | Only iii) |
| D. | ii) and iv)View Answer |
| Answer» E. | |
| 6. |
WHICH_MAGIC_METHOD_IS_USED_TO_IMPLEMENT_OVERLOADING_IN_PHP??$ |
| A. | __call |
| B. | __invoke |
| C. | __wakeup |
| D. | __unset |
| Answer» B. __invoke | |
| 7. |
Which method is used to tweak an object’s cloning behavior?$ |
| A. | clone() |
| B. | __clone() |
| C. | _clone |
| D. | object_clone() |
| Answer» C. _clone | |
| 8. |
If your object must inherit behavior from a number of sources you must use a/an |
| A. | Interface |
| B. | Object |
| C. | Abstract class |
| D. | Static class |
| Answer» B. Object | |
| 9. |
Which of the following is/are true for an abstract class? |
| A. | A class is declared abstract by prefacing the definition with the word abstract. |
| B. | A class is declare abstract by using the keyword implements. |
| C. | It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class. |
| D. | Attempting to instantiate an abstract class results in an error. |
| Answer» B. A class is declare abstract by using the keyword implements. | |
| 10. |
The class from which the child class inherits is called.. |
| A. | Child class |
| B. | Parent class |
| C. | Super class |
| D. | Base class |
| Answer» E. | |
| 11. |
Which one of the following is the right way to clone an object? |
| A. | _clone(targetObject); |
| B. | destinationObject = clone targetObject; |
| C. | destinationObject = _clone(targetObject); |
| D. | destinationObject = clone(targetObject); |
| Answer» C. destinationObject = _clone(targetObject); | |
| 12. |
Which version of PHP introduced the advanced concepts of OOP? |
| A. | PHP 4 |
| B. | PHP 5 |
| C. | PHP 5.3 |
| D. | PHP 6 |
| Answer» C. PHP 5.3 | |
| 13. |
Which of the following advanced OOP features is/are not supported by PHP? |
| A. | Method overloading |
| B. | Multiple Inheritance |
| C. | Namespaces |
| D. | Object Cloning |
| Answer» D. Object Cloning | |