Explore topic-wise MCQs in Php.

This section includes 9 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 function is used to determine whether the variable’s value is either TRUE or FALSE?

A. boolean()
B. is_boolean()
C. bool()
D. is_bool()
Answer» E.
2.

If you omit the visibility keyword in your method declaration, by default the method will be declared as ____________

A. public
B. private
C. protected
D. friendly
Answer» B. private
3.

Which keyword precedes a method name?

A. method
B. function
C. public
D. protected
Answer» C. public
4.

Code that uses a class, function, or method is often described as the ____________

A. client code
B. user code
C. object code
D. class code
Answer» B. user code
5.

Which characters is used to access property variables on an object-by-object basis?

A. ::
B. =
C. ->
D. .
Answer» D. .
6.

Which version of PHP introduced the visibility keywords i.e public, private, and protected?

A. PHP 4
B. PHP 5
C. PHP 5.1
D. PHP 5.3
Answer» C. PHP 5.1
7.

There are two objects- $product1 = new Shop(); $product2 = new Shop();Which one of the following statements is right about them?

A. $product1 and $product2 are same objects of the same type generated from a single class
B. $product1 and $product2 are different objects of the same type generated from a single class
C. $product1 and $product2 are same objects of the different type generated from a single class
D. $product1 and $product2 are different objects of the different type generated from a single class
Answer» C. $product1 and $product2 are same objects of the different type generated from a single class
8.

Fill in the blank with the best option. An Object is a/an ________ of a class.

A. type
B. prototype
C. instance
D. object
Answer» D. object
9.

Which one of the following is not a valid class name?

A. ShopProduct
B. Shopproduct
C. Shopproduct1
D. 1shopproduct
Answer» E.