• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

OOP Interview Questions Answers

Question - 21 : - What is Downcasting ?

Answer - 21 : - Downcasting is the casting from a general to a more specific type, i.e. casting down the hierarchy.

Question - 22 : - Differentiate between the message and method.

Answer - 22 : - Message * Objects communicate by sending messages to each other. * A message is sent to invoke a method. Method * Provides response to a message. * It is an implementation of an operation.

Question - 23 : - What is difference between overloading and overriding?

Answer - 23 : - a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method. b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass. c) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the superclass. d) Overloading must have different method signatures whereas overriding must have same signature.  

Question - 24 : - What is a modifier?

Answer - 24 : - A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‘mutators’. Example: The function mod is a modifier in the following code snippet: class test { int x,y; public: test() { x=0; y=0; } void mod() { x=10; y=15; } };

Question - 25 : - When does a name clash occur?

Answer - 25 : - A name clash occurs when a name is defined in more than one place. For example., two different class libraries could give two different classes the same name. If you try to use many class libraries at the same time, there is a fair chance that you will be unable to compile or link the program because of name clashes.

Question - 26 : - Does a class inherit the constructors of its superclass?

Answer - 26 : - A class does not inherit constructors from any of its super classes. If a class is declared without any access modifiers, where may the class be accessed? A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners