PHP OOP Mcqs
Our collections of Multiple choice questions and answers focuses on study of PHP OOP. These questions are chosen from a collection of most authoritative and best reference books on PHP Language. Our aim is to prepare an individual for competitive exams like NTS, GAT, ECAT, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate PHP OOP Topics comprehensively.
PHP Programming Mcqs
- Basics of PHP Mcqs
- PHP Arrays and Functions Mcqs
- PHP Constants and Operators Mcqs
- PHP Controls Structures Mcqs
- PHP Error and Exception Handling Mcqs
- PHP Filesystem Mcqs
- PHP Functions Mcqs
- PHP Objects Tools and Variables Mcqs
- PHP OOP Mcqs
- PHP Session Handling Mcqs
- Strings and Regular Expressions Mcqs
Computer MCQS
Sciences MCQS
33.
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 }
i) function functionName() { function body }
ii) scope function functionName() { function body }
iii) method methodName() { method body }
iv) scope method methodName() { method body }
Only ii)
Only iv)
I) and ii)
Iii) and iv)
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
34.
Which of the following method scopes is/are not supported by PHP? i) private
ii) final
iii) static
iv) abstract
i) private
ii) final
iii) static
iv) abstract
Only ii)
Only iv)
Ii) and iv)
None of the mentioned
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
35.
Which method scope prevents a method from being overridden by a subclass?
Abstract
Protected
Final
Static
36.
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.
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.
Ii) and iii)
All of the mentioned
None of the mentioned
Ii), iii) and iv)
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
37.
PHP recognizes constructors by the name_________
Classname()
_construct()
Function _construct()
Function __construct()
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
38.
Which version of PHP introduced the instanceof keyword?
PHP 4
PHP 5
PHP 5.3
PHP 6
39.
Which one of the following functions is used to determine whether a class exists?
Exist()
Exist_class()
Class_exist()
__exist()
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
40.
Which one of the following functions is used to determine object type?
Obj_type()
Type()
Is_a()
Is_obj()
41.
Which one of the following keyword is used to inherit our subclass into a superclass?
Extends
Implements
Inherit
Include
42.
In the PHP code given below, what is/are the properties?
<?php
class Example
{
public $name;
function Sample()
{
echo "This is an example";
}
}
?>
<?php
class Example
{
public $name;
function Sample()
{
echo "This is an example";
}
}
?>
Public $name;
Class Example
Function sample()
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
43.
Which keyword is used to refer to properties or methods within the class itself?
Private
Public
Protected
$this
44.
Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?
Protected
Final
Static
Private
45.
Which of the following advanced OOP features is/are not supported by PHP? i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning
i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning
All of the mentioned
None of the mentioned
I) and ii)
Iii) and iv)
Answer & Solution
No Solution for this Answer..! Report or Discus this Question
46.
Which version of PHP introduced the advanced concepts of OOP?
PHP 4
PHP 5
PHP 5.3
PHP 6