Explore topic-wise MCQs in Php.

This section includes 10 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 class accepts a class name or an object reference and returns an array of interface name?

A. class_implements()
B. is_subclass()
C. is_subclass_of()
D. class_interface()
Answer» B. is_subclass()
2.

Which one of the following function should I use to find the parent class of a class?

A. get_parent_class()
B. parent_class()
C. class_parent()
D. get_class_parent()
Answer» B. parent_class()
3.

What will be the output if a protected method is given as the argument to the function method_exist()?

A. Method does not exist
B. False
C. Error
D. True
Answer» E.
4.

If you call a method and it doesn’t exist it’ll cause a problem. To check the method which function will you use?

A. _method()
B. methodexists()
C. is_callable()
D. is_method()
Answer» D. is_method()
5.

You use the get_class_methods() function to return the names of all the methods in the class. Which function will you use to print it on the screen?

A. printf()
B. print_ar
C. print_r
D. echo
Answer» D. echo
6.

PHP 4 did not support instanceof. Instead, which function did it provide?

A. is()
B. get_class()
C. is_a()
D. is_the()
Answer» D. is_the()
7.

Which one of the following will you use to check the class of an object?

A. class()
B. _class()
C. class_check()
D. get_class()
Answer» E.
8.

Which one of the following functions will you use to check that the class exists before you work with it?

A. class_exist()
B. class_exists()
C. exist()
D. exists_class()
Answer» C. exist()
9.

How many times can you define _________ autoload in a process?

A. once
B. twice
C. thrice
D. as many times as needed
Answer» B. twice
10.

Which function was introduced to help automate the inclusion of class files?

A. __load()
B. __preload()
C. __autoload()
D. __inload()
Answer» D. __inload()