Web Designing MCQs

20 Objective Questions on Classes and Objects in PHP

Google+ Pinterest LinkedIn Tumblr
Here are the collections of objective questions on classes and objects in PHP includes multiple-choice questions on the fundamentals of classes and objects in PHP. It includes MCQ questions on the different functions such as class_alias(), class_exists(), _ _isset(), get_class(), get_class_methods(), _ _unset(), get_class_vars(), get_parent_class(), _ _wakeup() etc. used on classes and objects in PHP.

Read Also: Top 20 MCQ Questions on Classes and Objects in PHP

1) The …. function allows the class to be referred to by more than one name.
A. class_referred()
B. class_exists()
C. class_multiple()
D. class_alias()

2) The …. function returns TRUE if the class specified by class_name exists within the currently executing script context and returns FALSE otherwise.
A. class_available()
B. class_exists()
C. is_class_name()
D. is_class_exists()

3) … is triggred by calling isset() or empty() on inaccessible or non-existing properties.
A. _ _ set()
B. _ _ get()
C. _ _isset()
D. _ _isempty()

4) The …. function returns the name of the class to which the object belongs and returns FALSE if the object is not an object.
A. class_name()
B. get_class()
C. is_class_name()
D. get_class_exists()

5) The …. function returns an array containing all method names defined by the class_name.
A. class_name()
B. get_class()
C. get_class_name()
D. get_class_methods()

6) … is invoked when uset() is used on inaccessible or non-existing properties.
A. _ _ set()
B. _ _ get()
C. _ _isset()
D. _ _unset()

7) The …. function returns an associative array containing the names of all properties and their corresponding values defined within the class specified by class_name.
A. get_class_vars()
B. get_object_vars()
C. get_class_values()
D. get_object_vars()

8) The …. function returns an array containing the names of all classes defined within the currently executing script.
A. get_parent_classes()
B. get_object_classes()
C. get_declared_classes()
D. get_object_vars()

9) … is used to commit pending data or perform similar cleanup tasks.
A. _ _ commit()
B. _ _ sleep()
C. _ _cleanup()
D. _ _unset()

10) The …. function returns an associative containing the defined properties available to object and their corresponding values.
A. get_parent_class()
B. get_object_classes()
C. get_declared_classes()
D. get_object_vars()

11) The …. function returns the name of the parent of the class to which the object belongs.
A. get_parent_class()
B. get_object_classes()
C. get_declared_classes()
D. get_object_vars()

12) … is used to re-establish any database connections that may have been lost during serialization and perform other reinitialization tasks.
A. _ _ re_estiblish()
B. _ _ wake()
C. _ _wakeup()
D. _ _unset()

13) The …. function determines whether an interface exists, returning TRUE if it does, and FALSE otherwise.
A. class_exists()
B. interfase_exists()
C. exists()
D. method_exists()

14) The …. function returns TRUE if the object belongs to a class of type class_name or if it belongs to a class that is a child of class_name.
A. is_class()
B. is_object_belongs()
C. is_a()
D. is_a_class()

15) The … method allows a class to decide how it will react when it is treated as a string.
A. _ _ tostring()
B. _ _ string()
C. _ _decide()
D. _ _isstring()

16) The …. function returns TRUE if the object belongs to a class inherited from class_name and returns FALSE otherwise.
A. is_class()
B. is_class_of()
C. is_subclass_of()
D. is_class_inherited()

17) The …. function returns TRUE if a method named method_name is available to object and returns FALSE otherwise.
A. class_exists()
B. interfase_exists()
C. exists()
D. method_exists()

18) The … method is called when a script tries to call an object as a function.
A. _ _ set()
B. _ _ call()
C. _ _invoke()
D. _ _wakeup()

19) The function … can be used to retrieve a string with the name of the called class.
A. get_called_class()
B. called_class()
C. retrieve_class()
D. retrieve_called_class()

20) … returns a string containing a byte-stream representation of any value that can be stored in PHP.
A. unserialize()
B. serialize()
C. return_stream()
D. return_string()

Answers:

  1. D. class_alias()
  2. B. class_exists()
  3. C. _ _isset()
  4. B. get_class()
  5. D. get_class_methods()
  6. D. _ _unset()
  7. A. get_class_vars()
  8. C. get_declared_classes()
  9. B. _ _ sleep()
  10. D. get_object_vars()
  11. A. get_parent_class()
  12. C. _ _wakeup()
  13. B. interfase_exists()
  14. C. is_a()
  15. A. _ _ tostring()
  16. C. is_subclass_of()
  17. D. method_exists()
  18. C. _ _invoke()
  19. A. get_called_class()
  20. B. serialize()

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Write A Comment