Sail E0 Webinar

MCQs

Total Questions : 30 | Page 3 of 3 pages
Question 21. Which of the following advanced OOP features is/are not supported by PHP?(i) Method overloading(ii) Multiple Inheritance(iii) Namespaces(iv) Object Cloning
  1.    All of the mentioned
  2.    None of the mentioned
  3.    (i) and (ii)
  4.    (iii) and (iv)
 Discuss Question
Answer: Option C. -> (i) and (ii)


The advanced OOP features are: Object cloning, Inheritance, Interfaces, Abstract classes, and Namespaces.


Question 22. Which of the following is/are true for an abstract class?(i) A class is declared abstract by prefacing the definition with the word abstract.(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.
  1.    Only (ii)
  2.    All of the mentioned
  3.    (ii) and (iv)
 Discuss Question
Answer: Option A. -> Only (ii)


Only (ii)


Question 23. Which one of the following is the right way to clone an object?
  1.    _clone(targetObject);
  2.    destinationObject = clone targetObject;
  3.    destinationObject = _clone(targetObject);
  4.    destinationObject = clone(targetObject);
 Discuss Question
Answer: Option B. -> destinationObject = clone targetObject;


You can clone an object by prefacing it with the clone keyword.


Question 24. Which version of PHP introduced the advanced concepts of OOP?
  1.    PHP 4
  2.    PHP 5
  3.    PHP 5.3
  4.    PHP 6
 Discuss Question
Answer: Option B. -> PHP 5


PHP 5


Question 25. The class from which the child class inherits is called..(i) Child class(ii) Parent class(iii) Super class(iv) Base class
  1.    Only (i)
  2.    (ii), (iii) and (iv)
  3.    Only (iii)
  4.    (ii) and (iv)
 Discuss Question
Answer: Option D. -> (ii) and (iv)


(ii) and (iv)


Question 26. If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?
  1.    Normal class
  2.    Static class
  3.    Abstract class
  4.    Interface
 Discuss Question
Answer: Option C. -> Abstract class


Abstract class


Question 27. If your object must inherit behavior from a number of sources you must use a/an
  1.    Interface
  2.    Object
  3.    abstract class
  4.    static class
 Discuss Question
Answer: Option A. -> Interface


Interface


Question 28. Which magic method is used to implement overloading in PHP?
  1.    __call
  2.    __invoke
  3.    __wakeup
  4.    __unset
 Discuss Question
Answer: Option A. -> __call


__call


Question 29. Which feature allows us to call more than one method or function of the class in single instruction?
  1.    Typecasting
  2.    Method Including
  3.    Method adding
  4.    Method chaining
 Discuss Question
Answer: Option D. -> Method chaining


Following is a basic example of method chaining in php: $a = new Order();
$a->CreateOrder()->sendOrderEmail()->createShipment();


Question 30. Which method is used to tweak an object's cloning behavior?
  1.    clone()
  2.    __clone()
  3.    _clone
  4.    object_clone()
 Discuss Question
Answer: Option B. -> __clone()


__clone()


Latest Videos

Latest Test Papers