April 29, 2013

C, C++ Interview Questions And Answers

In C++, what is the difference between method overloading and method overriding?
Ans- Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.


What methods can be overridden in Java?  
Ans-  In C++ terminology, all public methods in Java are virtual. Therefore, all Java methods can be overwritten in subclasses except those that are declared final, static, and private.


In C, what is the difference between a static variable and global variable?
Ans- A static variable declared outside of any function is accessible only to all the functions defined in the same file (as the static variable). However, a global variable can be accessed by any function (including the ones from different files).


In C, why is the void pointer useful? When would you use it? 
Ans- The void pointer is useful becuase it is a generic pointer that any pointer can be cast into and back again without loss of information.


What are the defining traits of an object-oriented language? 
Ans- The defining traits of an object-oriented langauge are:
           encapsulation
            inheritance 
            polymorphism     

0 comments:

Post a Comment

  • Blogger news

    This Blog Contains All Topics Related To Internet, Website Help, Interview Questions, News, Results From Various Resources, Visit Daily For More Interesting And Famous Topics.
  • Random Post

  • About

    We Provide All Information Which you Needed. We Maintain This Blog Very Carefully, If You Find Any Mistake or Any Suggestions Then Please Let Us Know, You Can Contact Us By Comments, On FB Page Or On Google+ Page. ~ Thank You