If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?
1.Normal class
2.Static class
3.Abstract class
4.Interface
The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________
1.Polymorphism
2.Inheritance
3.Encapsulation
4.Abstraction
Which version of PHP introduced the instanceof keyword?
1.PHP 4
2.PHP 5
3.PHP 5.3
4.PHP 6
. In the following PHP code, what is/are the properties? <?php class Example { public $name; function Sample() { echo "This is an example"; } } ?>
1.echo “This is an exampleâ€;
2. public $name;
3.class Example
4.function sample()
. Which of the following method scopes is/are not supported by PHP? i) private ii) friendly iii) static iv) abstract
1.Only ii)
2.Only iv)
3.ii) and iv)
4.Only i)
PHP recognizes constructors by the name _________
1.classname()
2._construct()
3.function _construct()
4.function __construct()
The practice of creating objects based on predefined classes is often referred to as ______________
1.class creation
2.object creation
3.object instantiation
4.class instantiation
Which feature allows us to call more than one method or function of the class in single instruction?
1.Typecasting
2.Method Including
3.Method adding
4.Method chaining
Which keyword is used to refer to properties or methods within the class itself?
1.private
2.public
3.protected
4.$this
Which magic method is used to implement overloading in PHP?
1.__call
2.__invoke
3.__wakeup
4.__unset
Which method is used to tweak an object’s cloning behavior?
1.clone()
2.__clone()
3._clone
4. object_clone()
Which of the following advanced OOP features is/are not supported by PHP?
1.Method overloading
2.Multiple Inheritance
3.Namespaces
4.Object Cloning
Which of the following is/are the right way to declare a method? i) function functionName() { function body } ii) scope function functionName() { function body } iii) method methodName() { method body } iv) scope method methodName() { method body }
1.Only ii)
2. Only iv)
3.i) and ii)
4. iii) and iv)
Which of the following is/are true for an abstract class? i) Abstract classes in PHP are declared with the help of abstract keyword. 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.
1.Only i)
2.Only iii)
3.ii) and iv)
4. ii), iii) and iv)
Which of the following statements is/are true about Constructors in PHP? i) PHP 4 introduced class constructors. ii) Constructors can accept parameters. iii) Constructors can call class methods or other functions. iv) Class constructors can call on other constructors.
1.ii)
2. ii) and iii)
3.i), ii), iii) and iv)
4. ii), iii) and iv)
Which of the following term originates from the Greek language that means “having multiple forms,†defines OOP’s ability to redefine, a class’s characteristics?
1.Abstraction
2.Polymorphism
3.Inheritance
4.Differential
Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo?
1. $obj = new $foo;
2.$obj = new foo;
3. $obj = new foo ();
4.obj = new foo ();
Which one of the following functions is used to determine object type?
1.obj_type()
2. type()
3.is_a()
4.is_obj()
Which one of the following functions is used to determine whether a class exists?
1.exist()
2.exist_class()
3.class_exist()
4.__exist()
Which one of the following is the right way to call a class constant, given that the class is mathFunction?
1.echo PI;
2. echo mathFunction->PI;
3.echo mathFunction::PI;
4.echo mathFunction=PI;
Which one of the following is the right way to clone an object?
1._clone(targetObject);
2.destinationObject = clone targetObject;
3.destinationObject = _clone(targetObject);
4.destinationObject = clone(targetObject);
Which one of the following is the right way to define a constant?
1.constant PI = “3.1415â€;
2.const $PI = “3.1415â€;
3.constant PI = ‘3.1415’;
4.const PI = ‘3.1415’;
Which one of the following keyword is used to inherit our subclass into a superclass?
1.extends
2.implements
3.inherit
4.include