Q: What is meant by container ship?
Solution: Container ship is a class contains objects of other class types as its members.
Q: How many types of the constructor are there in C++?
Solution: There are three types of constructor in C++. They are the Default constructor, Parameterized constructor, Copy constructor.
Q: How many constructors can present in a class?
Solution: There can be multiple constructors of the same class, provided they have different signatures.
Q: What should be the name of the constructor?
Solution: Constructor name should be same as the class name.
Q: What does derived class does not inherit from the base class?
Solution: The derived class inherits everything from the base class except the given things.
Q: What is a template?
Solution: Templates are used for creating generic classes to handle different types in single classes.
Q: Pick out the correct statement about string template.
Solution: Every string template is used to replace the string with another string at runtime.
Q: How to declare a template?
Solution: template<> syntax is used. An example for calculating max of two ints, floats, doubles, or any other number type where T indicates the type of the parameters passes. templateT max(T a, T b){ return a > b? a : b; }
Q: Which are done by compiler for templates?
Solution: The compiler can determine at compile time whether the type associated with a template definition can perform all of the functions required by that template definition.
Q: What may be the name of the parameter that the template should take?
Solution: The name of the parameter that the template should take same as the template.
You Have Score    | /10 |