1. Which one of the following is not a valid class name?
2. Fill in the blank with the best option. An Object is a/an ________ of a class.
3. Which version of PHP introduced the visibility keywords i.e public, private, and protected?
4. Which characters is used to access property variables on an object-by-object basis?
5. Code that uses a class, function, or method is often described as the.
6. Which keyword precedes a method name?
7. If you omit the visibility keyword in your method declaration, by default the method will be declared as.
8. Which function is used to determine whether the variable’s value is either TRUE or FALSE?
9. What will be the output of the following PHP code?
<?php
class ShopProductWriter
{
public function write($shopProduct)
{
$str = "{$shopProduct->title}: " .$shopProduct->getProducer() ." ({$shopProduct->price})n";
print $str;
}
}
$product1 = new ShopProduct( "My Antonia", "Willa", "Cather", 5.99 );
$writer = new ShopProductWriter();
$writer->write( $product1 );
?>
<?php
class ShopProductWriter
{
public function write($shopProduct)
{
$str = "{$shopProduct->title}: " .$shopProduct->getProducer() ." ({$shopProduct->price})n";
print $str;
}
}
$product1 = new ShopProduct( "My Antonia", "Willa", "Cather", 5.99 );
$writer = new ShopProductWriter();
$writer->write( $product1 );
?>
10. Which version of PHP introduced class type hints?
Read More Section(Object Oriented Concept)
Each Section contains maximum 100 MCQs question on Object Oriented Concept. To get more questions visit other sections.