1. What are the four corner stones of OOP ?Abstraction, Encapsulation, Polymorphism and Inheritance.
2. What do you understand by private, protected and public ?These are accessibility modifiers. Private is the most restrictive, while public is the least restrictive. There is no real difference between protected and the default type (also known as package protected) within the context of the same package, however the protected keyword allows visibility to a derived class in a different package.
3. Difference between a Class and an Object ?A class is a definition or prototype whereas an object is an instance or living representation of the prototype.4.
What is Downcasting ?Downcasting is the casting from a general to a more specific type, i.e. casting down the hierarchy.5. What is Polymorphism ? What kinds ?
6. What is the difference between method overriding and overloading?Overriding is a method with the same name and arguments as in a parent, whereas overloading is the same method name but different arguments.7. What is the restriction on an Overridden methods’ accessibility ?Overriding methods cannot reduce accessibility - they can either have same or greater accessibility.8. What is the concept of a Virtual Function ?9. What is the implication of a Virtual Destructor ? Virtual Constructor ?10. Can a method be overloaded based on different return type but same argument type ?No, because the methods can be called without using their return type in which case there is ambiquity for the compiler.11. What is a "stateless" protocol ?Without getting into lengthy debates, it is generally accepted that protocols like HTTP are stateless i.e. there is no retention of state between a transaction which is asingle request response combination.12. What happens to a static var that is defined within a method of a class ?Can't do it. You'll get a compilation error.13. What is constructor chaining and how is it achieved in Java ?A child object constructor always first needs to construct its parent (which in turn calls its parent constructor.). In Java it is done via an implicit call to the no-argsconstructor as the first statement.
Custom Search