OOPs Interview Questions and Answers for Experienced basic advanced 2015-2016,OOPs Interview Questions and Answers 2015,Top 20 OOPs Interview Questions,OOPs Interview Questions & Answers,OOPs Interview Questions and Answers For Freshers and Experienced, OOPs Frequently Asked Interview Questions,Freshers Latest OOPs Technical Interview Questions & Answers,F2F Interview,OOPs, Interview Questions & Answers,What would be some common OOPs interview questions,OOPs interview questions and answers for 2 years,OOPs Developer Interview Questions,10 Common face to face OOPs interview questions and answers,OOPs Interview Questions and Answers,Top 10 OOPs Interview Questions and Answers 2015,OOPs (CMS)Interview Question Answer,Technical OOPs Interview Questions and Answers for getting Job,Where can I find good OOPs interview questions,OOPs job interview questions and answers for freshers,OOPs interview questions and answers for experienced,10 Tough OOPs Interview Questions With Smart Answers,OOPs interview questions and answers for experienced,How to Answer OOPs Interview Questions,Where can I find good OOPs interview questions ,Download OOPs Interview Questions.
What is Object Oriented Programming?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.
Abstraction.
Encapsulation.
Inheritance.
Polymorphism.
What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.
What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
What is data modeling?
In class, we create multiple get/set function to get and set the data through the protected functions known as Data Modeling.
class dataModel {
public function __set( $key, $value ) {
$this->$key = $value;
}
}
Following are the benefits of Data Modeling
It is very fast.
Smart way to manipulation on data
Really flexible to be modeled per need
Setters can explicitly define what data can be loaded into the object
No extra layer of logic
What is the difference between class and interface?
1) Interfaces do not contain business logic
2)You must extend interface to use.
3) You can't create object of interface.
What is encapsulation?
The process of binding the data with related methods known as encapsulation.
Class is the base for encapsulation.
What are the Object Characteristics?
The three key characteristics of Object are
State
Behavior
Identity
State:
Instance variables value is called object state.
An object state will be changed if instance variables value is changed.
Behavior:
Behavior of an object is depends on the messages passed to it.
So an object behavior depends on the instance methods.
Behavior of an object is defined by instance methods.
Identity:
Developer can also generate hashcode of an object based on the state of that object by overriding hashcode() method of java.lang.Object class.
Then if state is changed , automatically hashcode will be changed.
Identity is the hashcode of an object, it is a 32 bit integer number created randomly and assigned to an object by default by JVM.
What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public,Protected, Private, Internal and Protected Internal.
What is Polymorphism?
Polymorphism is nothing butassigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.
What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. If inheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.
What are the types of inheritances?
There are two types of inheritance
1.Multilevel Inheritance
2.Multiple Inheritance
Similarities and differences between this and super keywords?
this:
This is a keyword used to store current object reference.
It must be used explicitly if non -static variable and local variables name is same.
System.out.print(this); works fine
super:
Super is a keyword used to store super class non -static members reference in sub class object.
used to separate super class and sub class members if both have same name.
System.out.println(super); compilation Error
Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules forconstructor are:.
Constructor Name should be same asclass name.
Constructor must have no return type.
Define Destructor?
Destructor is a method which is automatically called when the object ismade ofscope or destroyed. Destructor name is also same asclass name but with the tilde symbol before the name.
What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allowscreation of several methods with the same name which differ from each other by type of input and output of the function.
Example
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.
What is Object Oriented Programming?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.
Abstraction.
Encapsulation.
Inheritance.
Polymorphism.
What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.
What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
What is data modeling?
In class, we create multiple get/set function to get and set the data through the protected functions known as Data Modeling.
class dataModel {
public function __set( $key, $value ) {
$this->$key = $value;
}
}
Following are the benefits of Data Modeling
It is very fast.
Smart way to manipulation on data
Really flexible to be modeled per need
Setters can explicitly define what data can be loaded into the object
No extra layer of logic
What is the difference between class and interface?
1) Interfaces do not contain business logic
2)You must extend interface to use.
3) You can't create object of interface.
What is encapsulation?
The process of binding the data with related methods known as encapsulation.
Class is the base for encapsulation.
What are the Object Characteristics?
The three key characteristics of Object are
State
Behavior
Identity
State:
Instance variables value is called object state.
An object state will be changed if instance variables value is changed.
Behavior:
Behavior of an object is depends on the messages passed to it.
So an object behavior depends on the instance methods.
Behavior of an object is defined by instance methods.
Identity:
Developer can also generate hashcode of an object based on the state of that object by overriding hashcode() method of java.lang.Object class.
Then if state is changed , automatically hashcode will be changed.
Identity is the hashcode of an object, it is a 32 bit integer number created randomly and assigned to an object by default by JVM.
What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public,Protected, Private, Internal and Protected Internal.
What is Polymorphism?
Polymorphism is nothing butassigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.
What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. If inheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.
What are the types of inheritances?
There are two types of inheritance
1.Multilevel Inheritance
2.Multiple Inheritance
Similarities and differences between this and super keywords?
this:
This is a keyword used to store current object reference.
It must be used explicitly if non -static variable and local variables name is same.
System.out.print(this); works fine
super:
Super is a keyword used to store super class non -static members reference in sub class object.
used to separate super class and sub class members if both have same name.
System.out.println(super); compilation Error
Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules forconstructor are:.
Constructor Name should be same asclass name.
Constructor must have no return type.
Define Destructor?
Destructor is a method which is automatically called when the object ismade ofscope or destroyed. Destructor name is also same asclass name but with the tilde symbol before the name.
What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allowscreation of several methods with the same name which differ from each other by type of input and output of the function.
Example
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.
0 comments:
Post a Comment