C++ Basic Interview Question and Answers

1. What are the advantages of object oriented programming?
 
  • Class data type allows programs to organize as objects that contain both data and functions.
  • Data hiding or Abstraction of data provides security to data, as unrelated member functions cannot access its data.
  • Polymorphism promotes, reduces software complexity, as multiple definitions are permitted to an operator or function.
  • Inheritance allows a class to be derived from an existing class, thus promoting reusability of code.
 
Your Name Your Email-ID
Your Answer
2. What are the two parts of a class specification?
 
    A class specification has two parts
  • Class Declaration
  • Class Function Definitions
 
Your Name Your Email-ID
Your Answer
3. What is meant by void function?
  The functions that return no value are declared as void. The data type of a function is treated as int, if no data type is explicitly mentioned.
 
Your Name Your Email-ID
Your Answer
4. What are header file?
 
  • A header file comprises of all standard declarations and definitions for pre defined functions.
  • One can include the header file in the program by using a preprocessor directive.
  • The other header files are iomanip.h, stdio.h, ctype.h, fstream.h etc.
  • A processor directive starts with #, which instructs the compiler to do the required job.
 
Your Name Your Email-ID
Your Answer
5. What are variables?
  Variables are user defined named entities of memory locations that can store data.
 
Your Name Your Email-ID
Your Answer
12345 Page 1 of 5