Question: c++ questions 3. [4 marks] True or False: a) The vector size is fixed after it is created. b) We cannot return a vector from

c++ questions

3. [4 marks] True or False:

a) The vector size is fixed after it is created.

b) We cannot return a vector from a function.

c) We can use a vector object just like an array, but a vector's size can grow automatically when we call the push_back member function to add an element in the vector.

d) The statement vector x(10) creates a vector object of 10 int values. 4. [6 marks] True or False:

a) A derived class is a subset of a base class.

b) The derived class can access the private attributes of the base class using dot(.) operator directly.

c) The constructors of a base class are inherited in the derived class. The constructors of a base class should not be invoked from the constructors of the derived classes to initialize the attributes in the base class explicitly.

d) A derived class constructor always invokes its base class constructor. If a base constructor is not invoked explicitly, the base class default constructor is invoked by default.

e) When constructing an object of a derived class, the derived class constructor first invokes its base class constructor before performing its own tasks. When an object of a derived class is destroyed, the derived class destructor is called. After it finishes its tasks, it invokes its base class destructor.

f) A function defined in the base class may be redefined in the derived class. A redefined function must match the parameter list and return type of the function in the base class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!