Which one of the following functions is used to determine object type?
A. obj_type()
B. type()
C. is_a()
D. is_obj()
Select an option to see the answer and solution.
Which one of the following keyword is used to inherit our subclass into a superclass?
A. extends
B. implements
C. inherit
D. include
Select an option to see the answer and solution.
In the PHP code given below, what is/are the properties?
<?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()
Select an option to see the answer and solution.
Which keyword is used to refer to properties or methods within the class itself?
A. private
B. public
C. protected
D. $this
Select an option to see the answer and solution.
Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?
A. protected
B. final
C. static
D. private
Select an option to see the answer and solution.
Which of the following advanced OOP features is/are not supported by PHP?
1. Method overloading
2. Multiple Inheritance
3. Namespaces
4. Object Cloning
A. All of the mentioned
B. None of the mentioned
C. 1 and 2
D. 3 and 4
Select an option to see the answer and solution.
Which version of PHP introduced the advanced concepts of OOP?
A. PHP 4
B. PHP 5
C. PHP 5.3
D. PHP 6
Select an option to see the answer and solution.
Which one of the following is the right way to clone an object?
A. _clone(targetObject);
B. destinationObject = clone targetObject;
C. destinationObject = _clone(targetObject);
D. destinationObject = clone(targetObject);
Select an option to see the answer and solution.
The class from which the child class inherits is called.
1. Child class
2. Parent class
3. Super class
4. Base class
A. Only 1
B. 2, 3 and 4
C. Only 3
D. 2 and 4
Select an option to see the answer and solution.
Which of the following is/are true for an abstract class?
1. A class is declared abstract by prefacing the definition with the word abstract.
2. A class is declare abstract by using the keyword implements.
3. It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.
4. Attempting to instantiate an abstract class results in an error.
A. Only 2
B. All of the mentioned
C. 2 and 4
D. 2, 3 and 4
Select an option to see the answer and solution.
If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?
A. Normal class
B. Static class
C. Abstract class
D. Interface
Select an option to see the answer and solution.
If your object must inherit behavior from a number of sources you must use a/an
A. Interface
B. Object
C. Abstract class
D. Static class
Select an option to see the answer and solution.
Which method is used to tweak an object’s cloning behavior?
A. clone()
B. __clone()
C. _clone
D. object_clone()
Select an option to see the answer and solution.
Which feature allows us to call more than one method or function of the class in single instruction?
A. Typecasting
B. Method Including
C. Method adding
D. Method chaining
Select an option to see the answer and solution.
Which magic method is used to implement overloading in PHP?
A. __call
B. __invoke
C. __wakeup
D. __unset
Select an option to see the answer and solution.
A package is a set of related _________
A. Objects
B. Classes
C. Programs
D. Functions
Select an option to see the answer and solution.
Till which version of PHP, developers were forced to name their files in a global context?
A. PHP 4
B. PHP 5
C. PHP 5.2
D. PHP 5.3
Select an option to see the answer and solution.
Which of the following can you place inside a namespace?
1. classes
2. functions
3. variables
A. 1
B. 2
C. 3
D. All of the mentioned
Select an option to see the answer and solution.
Which one of the following is the correct way of declaring a namespace?
A. namespace my;
B. namespace my();
C. my namespace;
D. namespace(my);
Select an option to see the answer and solution.
Which symbol is used to declare nested namespaces?
Select an option to see the answer and solution.