Java - Interview Questions and Answers for 'Oops concepts' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2098 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Oops concepts' - 21 question(s) found - Order By Newest

Very frequently asked to Fresh graduates.
  Q1. What is the difference between Encapsulation and Abstraction?Core Java
Anonymous
Ans. 1.Abstraction solves the problem at design level while encapsulation solves the problem at implementation level

2.Abstraction is used for hiding the unwanted data and giving relevant data. while Encapsulation means hiding the code and data into a single unit to protect the data from outside world.

3. Abstraction lets you focus on what the object does instead of how it does it while Encapsulation means hiding the internal details or mechanics of how an object does something.

4.For example: Outer Look of a Television, like it has a display screen and channel buttons to change channel it explains Abstraction but Inner Implementation detail of a Television how CRT and Display Screen are connect with each other using different circuits , it explains Encapsulation.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   oops concepts   encapsulation   abstraction   basic interview question     Synechron  Amazon  HCL Technologies  Tata Consultancy (TCS)  Wipro  Infosys Technologies  3DPLM Software Solutions      basic        frequent

Try 2 Question(s) Test


Very Frequently asked to fresh graduates and less experienced. Favorite question in Walk in drives.
  Q2. Difference between Overloading and Overriding ?Core Java
Anonymous
Ans. Overloading - Similar Signature but different definition , like function overloading.

Overriding - Overriding the Definition of base class in the derived class.

  Sample Code for overloading

  Sample Code for overriding

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   overloading   overriding   oops concepts   basic interview question     PC Technology  Cognizant (CTS)  Donlen   hybris Software  RedMane  Allerin Technologies  Gemalto  Allerin Technologies  HCL Technologies  Tata Consultancy (TCS)  Accenture India  Infosys Technologies  Polaris  United Healthcare India  IBM India  Xchanging  American Express  Antra  Flipp  Computer Sciences Corporation (CSC)  Garmin  NetSuite  Donlen  Hudsons Bay  Techlogix  SevOne  Synactive  Oodles Technologies  FDM Group  Marlabs  RedMane Technology  Faichi Solutions  TD  Tech Mahindra  Shutterfly  Luxoft  PC Technology  CCC Information Services  State Farm  Raja Software  Mastek  EPAM  Morgan Stanley  SummitWorks  Sony  Citibank  Emtec  LowerMyBills  Consilience  Xavor  AllState  FasTrak  AmTrust Financial  Walt Disney  Ultramain Systems  International Turnkey Systems  Knoldus Software  CA Technologies  Amdocs  FDM Group  Hybris  Fidelity  United Health Group (UHG)  Bluewhale Solutions  Pegasystems  Revature   Innoplexus  Vanguard  AptSource  Perficient  Grapecity  Subex  QuintilesIMS  NimbleUser  Expeditors Associate  Sapient  HR Cloud  Summitworks  Jabong.com  Kony Labs  Price Waterhouse Coopers (PWC)      basic        frequent

Try 1 Question(s) Test


Frequently asked to fresh graduates and less experienced.
 Q3. Difference between Compositions and Inheritance ?Core Java
Admin
info@buggybread.com
Ans. Inheritance means a object inheriting reusable properties of the base class. Compositions means that an abject holds other objects.

In Inheritance there is only one object in memory ( derived object ) whereas in Composition , parent object holds references of all composed objects.

From Design perspective - Inheritance is "is a" relationship among objects whereas Composition is "has a" relationship among objects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   oops concepts   inheritance   composition   difference between   basic interview question      basic        frequent

Try 2 Question(s) Test


 Q4. Which of the following Java feature promotes access protection or Hiding ?

a. Inheritance
b. Encapsulation
c. Abstraction
d. Composition
Core Java
Anonymous
Ans. Encapsulation

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   java concepts   java features   oops concepts   oops features   access protection   information hiding


Basic and Very Frequently asked.
  Q5. What is Polymorphism in Java ?Core Java2016-11-06 09:10:54

Ans. Polymorphism means the condition of occurring in several different forms.

Polymorphism in Java is achieved in two manners

1. Static polymorphism is the polymorphic resolution identified at compile time and is achieved through function overloading whereas

2. Dynamic polymorphism is the polymorphic resolution identified at runtime and is achieved through method overriding.

  Sample Code for overloading

  Sample Code for overriding

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     polymorphism  oops concepts     Credit Suisse  Unbounded Solutions  Microsoft   Google  Purch  HCL Technologies  Tata Consultancy (TCS)  Wipro  Mathworks  Accenture  ZonOff  ZapCom  Addteq  Priceline.com  Acute Informatics  Trimax IT Infrastructure & Services   USAA      Basic        frequent

Try 2 Question(s) Test


 Q6. How is Abstraction implemented in Java ?Core Java
Admin
info@buggybread.com
Ans. Abstraction is provided in Java by following ways -

Coding to the ( Interfaces / Abstract Classes ) or contracts

By Encapsulating details within classes and exposing the minimal Door ( few public methods )

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops concepts   abstraction   interfaces   abstract class   encapsulation     Accenture  Bureau Veritas      basic        frequent


 Q7. Difference between Encapsulation and Data Hiding ?
Admin
info@buggybread.com
Ans. Data Hiding is a broader concept. Encapsulation is a OOP's centri concept which is a way of data hiding in OOP's.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   oops concepts   encapsulation   data hiding   build management      basic


 Q8. Difference between Abstraction and Implementation hiding ?
Anonymous
Ans. Implementation Hiding is a broader concept. Abstraction is a way of implementation hiding in OOP's.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   oops concepts   abstraction   hiding information   build management


 Q9. What are the features of encapsulation ?Core Java
Admin
info@buggybread.com
Ans. Combine the data of our application and its manipulation at one place.

Encapsulation Allow the state of an object to be accessed and modified through behaviors.

Reduce the coupling of modules and increase the cohesion inside them.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   oops concepts   encapsulation   basic interview question     Addteq  IBM      basic        frequent



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. What are the examples of Abstraction in Java ?
Admin
info@buggybread.com
Ans. function calling - hides implementation details
wrapper classes
new operator - Creates object in memory, calls constructor

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   oops   oops concepts   abstraction


Must know at all levels. Among Top 10 frequently asked questions in Java. Very frequently asked to fresh graduates or less experienced professionals.
  Q11. What is Inheritance ?Core Java

Ans. Its a facility for code reuse and independent extension wherein a derived class inherits the properties of parent class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     inheritance  oops concepts  java concepts  code reuse  code re-use   classes  derived classes     Maverick Software  Infosys  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Myntra  Capital One  Barclays  Accenture  Infoview Technologies  Wipro      basic        frequent


  Q12. How is multiple inheritance implemented in Java ?Core Java

Ans. There was no multiple inheritance in java before version 8 as implementing multiple interfaces cannot be termed as inheritance.

With Java 8 , came the concept of default methods wherein the class implementing the interface carries the default implementation from the interface and hence facilitating multiple inheritance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     multiple inheritance   inheritance   oops concept     Credit Suisse  Amdocs  Ample Softwares  Tudip Technologies  Edifecs  VMWare  NSEiT  Exterro  theScore  BlackRock        frequent


Very Frequently asked to fresh graduates and less experienced.
 Q13. What are the principle concepts of Object Oriented Programming ?Core Java2016-10-18 13:53:31

Ans. Abstraction Polymorphism Inheritance Encapsulation

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     oops  oops concepts     Cognizant (CTS)      basic        frequent


 Q14. What is multilevel inheritance ?Core Java2016-06-23 13:52:50

Ans. Multi Level Inheritance is multi level hierarchy of classes. Here is the example - http://www.buggybread.com/2015/09/java-se-class-diagram-classes-that_603.html

Class RoleList extends ArrayList which in turn extends AbstractList which in turn extends AbstractCollection.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     multilevel inheritance  inheritance  oops concepts     Charles Schwab  ZapBuild Technologies  Cardinal Health      basic

Try 1 Question(s) Test


 Q15. What are the core OOPs concepts ?Core Java2017-02-06 16:15:55

Ans. Abstraction, Encapsulation, Polymorphism , Composition and Inheritance

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     core oops concepts      basic        frequent


Very frequently asked. Usually among very first few questions.
 Q16. Define encapsulation in Java ?Core Java2017-06-12 07:55:47

Ans. Encapsulation is a feature of OOP's that binds the data and it's associated methods together as a single unit and facilitate protection and data hiding by providing minimal interface to outside. For example - member variables are declared private and are accessed through public methods. Moreover we have private methods that can only be used internally and hence providing minimal interface to outside class through use of public methods.

  Sample Code for encapsulation

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     encapsulation  oops  oops concepts  oops features     Trimax IT Infrastructure & Services      Basic        frequent


 Q17. Give an example of how Object Oriented Programming Concepts can be implemented.Design2017-06-18 06:45:37

 This question was recently asked at 'Accenture'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     oops  oops example  oops concepts  oops features     Accenture      basic        frequent


 Q18. What are the uses of Abstraction ?Core Java2017-08-03 07:41:32

 This question was recently asked at 'Zipdial mobile solutions'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     oops concepts  abstraction     Zipdial mobile solutions


 Q19. What is the relationship between Vehicle and Engine in this example ?

public class Vehicle {
   Enginer engine;
   public void move(){
      engine = new Engine();
      engine.start();
   }
}
Core Java
a. Composition ( Vehicle has a Engine )
b. Composition ( Engine has a Vehicle )
c. Inheritance ( Vehicle is a Engine )
d. Inheritance ( Engine is a Vehicle )

Ans.a. Composition ( Vehicle has a Engine )

 Q20. What is the relationship between Car and Vehicle in the following code ?

public class Car extends Vehicle{
   Engine engine;   
   
   public static void main(String[] args){
      Vehicle vehicle = new Car();
      car.move();
   }   

   public void move(){
      engine = new Engine();
      engine.start();
   }
}
Core Java
a. Composition ( Vehicle has a Car )
b. Composition ( Car has a Vehicle )
c. Inheritance ( Vehicle is a Car )
d. Inheritance ( Car is a Vehicle )

Ans.d. Inheritance ( Car is a Vehicle )

 Q21. What is the problem with the following code ?

public class Car extends Vehicle{
   Vehicle vehicle;
   
   Car(){
      super();
      this.vehicle = new Vehicle();
   }
}
Core Java
a. There is an Inheritance as well as Composition relationship between Vehicle and Car which is not permitted
b. We cannot initialize the parent class instance within the constructor
c. Call to super is illegal
d. There is no problem

Ans.d. There is no problem



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: