Menu
H
HomeA
AptitudeE
EnglishR
ReasoningD
DIG
GKC
Current AffairsI
Interview- Computer
C
Computer FundamentalsN
NetworkingS
SQLD
Database
- Programming
C
C ProgramJ
Java ProgramH
HTMLC
CSSJ
JavascriptP
PHP Program
- Engineering
C
E
Electrical EngineeringM
Mechanical EngineeringC
Civil EngineeringC
Chemical Engineering
- More
B
Banking AwarenessC
CommerceM
Management
A
Ask Question
- Home
- Aptitude
- English
- Reasoning
- DI
- GK
- Current Affairs
- Interview
- Computer
- Computer Fundamentals
- Networking
- SQL
- Database
- Programming
- C Program
- Java Program
- HTML
- CSS
- Javascript
- PHP Program
- Engineering
- Computer Science
- Electrical Engineering
- Mechanical Engineering
- Civil Engineering
- Chemical Engineering
- More
- Banking Awareness
- Commerce
- Management
- Ask Question
Join The Discussion
Related Questions on Object Oriented Concept
A. All of the mentioned
Nội dung chính
- Solution[By Examveda Team]
- Which of the following advanced features is or are not supported by PHP?
- Which of the following is not supported by PHP?
- What are the object oriented features supported by PHP?
- Which version of PHP introduced the advanced concepts of OOP?
B. None of the mentioned
C. 1 and 2
D. 3 and 4
Solution[By Examveda Team]
The advanced OOP features are: Object cloning, Inheritance, Interfaces, Abstract classes, and Namespaces.
This set of PHP Multiple Choice Questions & Answers [MCQs] focuses on “Advanced Object-Oriented PHP”.
1. Which of the following advanced OOP features is/are not supported by PHP?
i] Method overloading ii] Multiple Inheritance iii] Namespaces iv] Object Cloning
a] i]
b] ii]
c] i] and ii]
d] iii] and iv]
View Answer
Answer: c
Explanation: The advanced OOP features are: Object cloning, Inheritance, Interfaces, Abstract classes, and Namespaces.
2. Which version of PHP introduced the advanced concepts of OOP?
a] PHP 4
b] PHP 5
c] PHP 5.3
d] PHP 6
View Answer
Answer: b
Explanation: Advanced concepts of OOP were introduced in PHP version
5.
3. 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];
View answer
Answer: b
Explanation: You can clone an object by prefacing it with the clone keyword. A copy of an object is created by using the clone keyword. $copy_of_object = clone $object;
4. The class from which the child class inherits is called ________
i] Child class ii] Parent class iii] Super class iv] Base class
a] Only i]
b] ii], iii] and iv]
c] Only iii]
d] ii] and iv]
View Answer
Answer: d
Explanation: The class whose properties are inherited by child class is called Base Class or Parent class.
5. 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.
a] Only i]
b] Only iii]
c] ii] and iv]
d] ii], iii] and iv]
View Answer
Answer: a
Explanation: The abstract classes are the classes in which at least one method need to be abstract. Abstract classes in PHP are declared with the help of abstract keyword.
6. 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
View Answer
Answer: c
Explanation: The abstract classes are the classes in which at least one method need to be abstract. Abstract classes in PHP are declared with the help of keyword abstract. The use of class abstract are that all base classes implementing abstract
class should give implementation of abstract methods declared in parent class.
7. 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
View Answer
Answer: a
Explanation: An interface in PHP consists of methods that have no implementations, i.e. the interface methods are abstract methods. The methods in the interfaces must have public visibility scope. The
interfaces are different from classes as the class can inherit from one class only whereas the class can implement one or more interfaces.
8. Which method is used to tweak an object’s cloning behavior?
a] clone[]
b] __clone[]
c] _clone
d] object_clone[]
View Answer
Answer: b
Explanation: A copy of an object is created by using the clone keyword, which calls the object’s __clone[] method.
9. 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
View Answer
Answer: d
Explanation: When many methods are called in a single instruction in PHP, it is called method chaining. Following is a basic example of method chaining in php:
$a = new Order[]; $a->CreateOrder[]->sendOrderEmail[]->createShipment[];
10. Which magic method is used to implement overloading in PHP?
a] __call
b] __invoke
c] __wakeup
d] __unset
View Answer
Answer: a
Explanation: When a class implements __call[], then an object of that class is called with a method that doesn’t exist, __call[] is called instead.
Sanfoundry Global Education & Learning Series – PHP Programming.
To practice all questions on PHP Programming, here is complete set of 1000+ Multiple Choice Questions and Answers on PHP.
Next Steps:
- Get Free Certificate of Merit in PHP Programming
- Participate in PHP Programming Certification Contest
- Become a Top Ranker in PHP Programming
- Take PHP Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.
Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.
Which of the following advanced features is or are not supported by PHP?
Which of the following advanced OOP features is/are not supported by PHP? Explanation: The advanced OOP features are: Object cloning, Inheritance, Interfaces, Abstract classes, and Namespaces. 2. Which version of PHP introduced the advanced concepts of OOP?
Which of the following is not supported by PHP?
Explanation: PHP supports six method scopes: public, private, final, static, protected and abstract. But it does not support friendly.
What are the object oriented features supported by PHP?
Object-Oriented Features in PHP 5.0.
Abstraction: The process of extracting the properties and behavior of real world objects and representing them in software..
Encapsulation: Combining data and methods as one entity. ... .
Inheritance: Simulate the real world ordering of objects..
Which version of PHP introduced the advanced concepts of OOP?
1 Answer. For explanation: Advanced concepts of OOP were introduced in PHP version 5.