adplus-dvertising
frame-decoration

Question

What will be the output of the following PHP code?
<?php
class ParentClass
{
}
 
class MyClass extends ParentClass
{
}
 
$a = new MyClass;
 
var_dump($a instanceof MyClass);
var_dump($a instanceof ParentClass);
?>

a.

bool(false)
bool(false)

b.

bool(true)
bool(true)

c.

bool(false)
bool(true)

d.

bool(true)
bool(false)

Posted under PHP

Answer: (b).bool(true)
bool(true)

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following PHP code?

Similar Questions

Discover Related MCQs

Q. What should be used to refer to a method in the context of a class rather than an object you use?

Q. Prior to which version of PHP did constructors took the name of the enclosing class.

Q. Which method or property can only be accessed from within the enclosing class? Even subclasses have no access.

Q. A mutator method is also called as..

Q. Before you can start processing images with PHP, you must first add the ability to upload images to your administrative form on ________

Q. When you’re uploading files you need to set the enctype of the form to __________

Q. To check whether a file was uploaded, you look in the _______ superglobal array.

Q. To make the ImageHandler class portable you should create a separate file for it called __________

Q. DocBlocks are indicated by opening a comment using _________

Q. To process the file, you need to break the array from $_FILES into individual values. You can do this using the ________ function.

Q. Before you try to process the file, you need to make sure that your $err value is equivalent to _________

Q. You use the $_SERVER superglobal and your _______ property to create your path to check.

Q. Which function do you have to use to check whether the $path you’ve stored exists?

Q. Which one of the following is true about the following line –
$obj = new ImageHandler(‘/images/’, array(400, 300));

Q. Which version of PHP introduced the static keyword?

Q. Which keyword is used to access a static method or property from within the same class(rather than from child)?

Q. In which of the following circumstance should you use a static reference to a non static method?

Q. Which one of the following variable cannot be used inside a static method?

Q. What does PDO stand for?

Q. Which version of PHP allows you to define constant properties within a class?