C++ Programming Question and Answers

16. What is the use of input stream?
 
  • Cin is a predefined object that corresponds to a standard input stream.
  • Input stream represents the flow of data from the standard input device – the keyboard.
 
Your Name Your Email-ID
Your Answer
17. What are the features that are provided to make a program modular?
  To create a program requires self sufficient resources, the way to make a piece of code modular so that it can be handled properly. This shows the relationship between different objects or in between the same objects. Different functions have to be used to keep the code different from the data provided. Object oriented programming allows creating a modular approach to make it more abstract and create the interactions between them. The features that are being provided in object oriented programming are:
    Encapsulation:
  • it deals with the grouping of data and functions together at one place or it can be said in an object that defines the interface of their interaction and the relationship between them.
  • Inheritance:
  • it deals with the relationship that exists between the parent and child classes. A child can inherit the properties of the parent and it remains helpful in creating a hierarchy in the system to keep things more modular.
  • Polymorphism:
  • is a feature that deals with different values that can be used by only one function. It doesn't have to re-create the same function again and again for different values but, it uses the same functions to call different data types.
 
Your Name Your Email-ID
Your Answer
18. What is function overloading?
  The ability of the function to process the message or data in more than one form is called as function overloading.
 
Your Name Your Email-ID
Your Answer
19. How is polymorphism different from inheritance?
 
  • 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
20. What is polymorphism?
 
  • The ability of an object to respond differently to different messages is called polymorphism.
 
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 4 of 15