Question
<?php
class Example
{
public $name;
function Sample()
{
echo "This is an example";
}
}
?>
a.
echo “This is an example”;
b.
public $name;
c.
class Example
d.
function sample()
Posted under PHP
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. In the PHP code given below, what is/are the properties?
Similar Questions
Discover Related MCQs
Q. Which keyword is used to refer to properties or methods within the class itself?
View solution
Q. Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?
View solution
Q. Which of the following advanced OOP features is/are not supported by PHP?
i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning
View solution
Q. Which version of PHP introduced the advanced concepts of OOP?
View solution
Q. Which one of the following is the right way to clone an object?
View solution
Q. The class from which the child class inherits is called..
i) Child class
ii) Parent class
iii) Super class
iv) Base class
View solution
Q. Which of the following is/are true for an abstract class?
i) A class is declared abstract by prefacing the definition with the word abstract.
ii) A class is declare abstract by using the keyword implements.
iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.
iv) Attempting to instantiate an abstract class results in an error.
View solution
Q. If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?
View solution
Q. If your object must inherit behavior from a number of sources you must use a/an
View solution
Q. Which method is used to tweak an object’s cloning behavior?
View solution
Q. Which feature allows us to call more than one method or function of the class in single instruction?
View solution
Q. Which magic method is used to implement overloading in PHP?
View solution
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!