adplus-dvertising

Welcome to the Objects and Databases in PHP MCQs Page

Dive deep into the fascinating world of Objects and Databases in PHP with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Objects and Databases in PHP, a crucial aspect of PHP. In this section, you will encounter a diverse range of MCQs that cover various aspects of Objects and Databases in PHP, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within PHP.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Objects and Databases in PHP. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of PHP.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Objects and Databases in PHP. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Objects and Databases in PHP MCQs | Page 8 of 10

Q71.
Which one of the following method is invoked when a value is assigned to an undefined property?
Discuss
Answer: (b).__set()
Q72.
Which one of the following method is invoked when an undefined method is called by client code?
Discuss
Answer: (d).__call()
Q73.
Which method introduced in PHP 5, is invoked just before an object is garbage collected?
Discuss
Answer: (c).__destruct()
Discuss
Answer: (a).In PHP 4: $second and $first are 2 distinct objects
Q75.
What will be output of following code ? (Before the version PHP 5.2)
class StringThing {}
$st = new StringThing();
print $st;
Discuss
Answer: (b).Object id #1
Q76.
What will be the output of the following PHP code
class Person 
{
    function getName() { return "Bob"; }
    function getAge() { return 44; }
    function __toString() {
        $desc = $this->getName();
        $desc .= " (age ".$this->getAge().")";
        return $desc;
    }
}
$person = new Person();
print $person;
Discuss
Answer: (c).BOB (age 44)
Q77.
__clone() is run on the ___ object.
Discuss
Answer: (d).copied
Q78.
Which method is invoked when an undefined property is accessed ?
Discuss
Answer: (a).__get()
Q79.
What will be the output of the following PHP code?
class Checkout
 {
    final function totalize() 
    {
        // calculate bill
    }
 }
 
class IllegalCheckout extends Checkout 
{
    final function totalize() 
    {
        // change bill calculation
    }
}
Discuss
Answer: (d).PHP Fatal error: Cannot override final method
Q80.
Which one of the following statements should be used to include a file?
Discuss
Answer: (b).include ‘filename’;
Page 8 of 10

Suggested Topics

Are you eager to expand your knowledge beyond PHP? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!