PHP OOPS Interview Question and Answers
ANS: Object oriented programming language allows concepts such as modularity, encapsulation, polymorphism and inheritance. Objects are said to be the most important part of object oriented language.
2. State about Java and its relation to Object oriented programming?
ANS: Java is widely used and its share is increasing considerably which is partly due to its close resemblance to object oriented languages such as C and C++. Code written in Java can be transported to many different platforms without changing it. It implements virtual machine.
3. Name some languages which have object oriented language and characteristics?
ANS: Some of the languages which have object oriented languages present in them are ABAP, ECMA Script, C++, Perl, LISP, C#, Tcl, VB, Ruby, Python, PHP, etc. Popularity of these languages has increased considerably as they can solve complex problems with ease.
4. Explain about UML?
ANS: UML or unified modeling language is regarded to implement complete specifications and features of object oriented language.
5. What is a Class?
ANS: Class in OOP:
Class is like a blueprint/template in OOPs, and this template is used to create objects. The collection of properties & behavior of an object is also called as class. A class contains properties, fields, data members, attributes.
Abstract design can be implemented in object oriented programming languages.
It lacks implementation of polymorphism on message arguments which is a OOPs feature.
6. Explain the meaning of object in object oriented programming?
ANS: Languages which are called as object oriented almost implement everything in them as objects such as punctuations, characters, prototypes, classes, modules, blocks, etc. They were designed to facilitate and implement object oriented methods.
7. Explain about message passing in object oriented programming?
ANS: Message passing is a method by which an object sends data to another object or requests other object to invoke method. This is also known as interfacing.
It acts like a messenger from one object to other object to convey specific instructions.
8. What are the problems faced by the developer using object oriented programming language?
ANS: These are some of the problems faced by the developer using object oriented language they are: –
a) Object oriented uses design patterns which can be referred to as anything in general.
b) Repeatable solution to a problem can cause concern and disagreements and it is one of the major problems in software design.
9. Explain about inheritance in OOPS?
ANS: Objects in one class can acquire properties of the objects in other classes by way of inheritance. Reusability which is a major factor is provided in object oriented programming which adds features to a class without modifying it. New class can be obtained from a class which is already present.
10.Explain about the Design Phase?
ANS: In the design phase, the developers of the system document their understanding of the system. Design generates the blue print of the system that is to be implemented. The first step in creating an object oriented design is the identification of classes and their relationships.
11. Explain about encapsulation?
ANS: Encapsulation passes the message without revealing the exact functional details of the class. It allows only the relevant information to the user without revealing the functional mechanism through which a particular class had functioned.
12. Explain the mechanism of composition?
Composition helps to simplify a complex problem into an easier problem. It makes different classes and objects to interact with each other thus making the problem to be solved automatically. It interacts with the problem by making different classes and objects to send a message to each other.
13. Explain about abstraction?
Abstraction simplifies a complex problem to a simpler problem by specifying and modeling the class to the relevant problem scenario. It simplifies the problem by giving the class its specific class of inheritance. Composition also helps in solving the problem to an extent.
14. Explain about polymorphism?
Polymorphism helps a sub class to behave like a parent class. When an object belonging to different data types respond to methods which have a same name, the only condition being that those methods should perform different function.
15. Explain about parametric polymorphism?
Parametric polymorphism is supported by many object oriented languages and they are very important for object oriented techniques. In parametric polymorphism code is written without any specification for the type of data present. Hence it can be used any number of times.