Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (TCO 4) C++ supports _____. (Points : 4) both single and multiple inheritance

ID: 3672040 • Letter: 1

Question

1. (TCO 4) C++ supports _____. (Points : 4)        both single and multiple inheritance
       only single inheritance
       only multiple inheritance
       neither single nor multiple inheritance Question 2.2. (TCO 4) The constructors of a derived class _____. (Points : 4)        cannot directly initialize private members that are inherited from the base class
       can directly initialize any members that are inherited from the base class
       cannot directly initialize public members that are inherited from the base class
       can directly initialize private member functions that are inherited from the base class Question 3.3. (TCO 4) The existing classes, from which you create new classes, are called the ____ classes. (Points : 4)        child
       base
       sibling
       derived Question 4.4. (TCO 5) Given the following definitions, select the statement that is illegal.

int * iptr;
double * dptr;
int j = 10;
double d = 10.0; (Points : 4)        iptr = &j;
       dptr = &d;
       iptr = 0;
       dptr = &j; Question 5.5. (TCO 5) Consider the following definitions and statements.

void myFunction( double * dptr );
double data[10];

Which statement correctly passes the entire array to myFunction( )? (Points : 4)        myFunction(data);
       myFunction(&data);
       myFunction(*data);
       myFunction(data[0]); Question 6.6. (TCO 5) Given a pointer variable called myData, which points to an instance of the following structure, which of the following statements assigns the value 123.45 to the dval field of the structure?

struct Data
      {
      int ival;
      double dval;
      char cval;
      }; (Points : 4)        dval = 123.45;
       *mydata = 123.45;
       mydata->dval = 123.45;
       mydata.dval = 123.45; Question 7.7. (TCO 5) What term is used to describe the condition where dynamically allocated memory is not formally returned using the delete operator and the operating system does not reclaim the allocated memory area? (Points : 4)        Stack leak
       Heap leak
       Garbage collection
       Memory leak Question 8.8. (TCO 6) The general syntax to overload the assignment operator (=) for a class is ____. (Points : 4)        friend className& operator=(const className&);
       className& operator=(className&);
       string className& operator=(className&);
       const className& operator=(const className&); Question 9.9. (TCO 6) What is the difference between a friend function and a member function of the class? (Points : 4)        A friend function is a nonmember function of the class, whereas a member function is a member of the class.
       All the member functions of a class are also friend functions.
       The prototype for a friend function is not included in the class definition.
       The definition of a friend function must be preceded by the class name and the scope resolution operator. Question 10.10. (TCO 6) The name of the function that overloads the + symbol is the ____ function. (Points : 4)        +operator()
       operator+()
       op+()
       +() Question 11.11. (TCO 6) Which of the following operators can be overloaded? (Points : 4)        .
       .*
       ::
       ++ Question 12.12. (TCO 7) Static binding is a process that is _____. (Points : 4)        performed during the run-time operation of the program
       performed during the linking operation of the program
       performed during the compilation of the program
       performed only when the static option is set in the compile options Question 13.13. (TCO 7) With virtual functions and polymorphism, the programmer can _____. (Points : 4)        have all the object definitions defined during compilation
       have all the object definitions defined during linking
       have the object definitions defined during run time
       explicitly define all the class relationships in the program code Question 14.14. (TCO 7) Which statement is true of a class object whose class is derived public from a base class? (Points : 4)        The derived class object is also a base class object.
       The base class object is also a derived class object.
       The derived class object has no relation to an object of its base class.
       It must have the same scope resolution of any and all the objects of its base class. Question 15.15. (TCO 7) If a class has a pure virtual function, then _____. (Points : 4)        that class is an abstract class
       it is a derived class with multiple base classes
       any class derived from it cannot redefine or override that function
       it automatically has a virtual destructor Question 16.16. (TCO 7) Which term designates the ability to use the same expression to denote different operations? (Points : 4)        Inheritance
       Encapsulation
       Polymorphism
       Composition. Question 17.17. (TCO 8) What is the namespace commonly used with <iostream>? (Points : 4)        std
       standard
       .h
       cin and cout Question 18.18. (TCO 8) If a Class A has an object of Class B as a data member, what type of function must be used for an object of Class A to obtain a copy of a private data member of Class B? (Points : 4)        Class B copy constructor
       Class B accessor function
       Class A accessor function
       It is not possible for an object of Class A to do this action. Question 19.19. (TCO 8) Class header files are usually designated by what indicators? (Points : 4)        < >
       ( )
       " "
       ' ' Question 20.20. (TCO 8) In a multifile, object-oriented, C++ project, which file contains the class definition? (Points : 4)        classname.cpp
       classname.h
       classname.def
       classname.hdr 1. (TCO 4) C++ supports _____. (Points : 4)        both single and multiple inheritance
       only single inheritance
       only multiple inheritance
       neither single nor multiple inheritance

Explanation / Answer

1.C++ supports __both single and multiple inheritance

2. The constructors of a derived class

         can directly initialize any members that are inherited from the base class

3.   The existing classes, from which you create new classes, are called the __child classes.  

4. Given the following definitions, select the statement that is illegal.
     int * iptr;
    double * dptr;
    int j = 10;
   double d = 10.0; (Points : 4)

illegal is dptr = &j;

5. Consider the following definitions and statements.

void myFunction( double * dptr );
double data[10];

Which statement correctly passes the entire array to myFunction( )?

              myFunction(&data);


6. Given a pointer variable called myData, which points to an instance of the following structure, which of the following statements assigns the value 123.45 to the dval field of the structure?

struct Data
      {
      int ival;
      double dval;
      char cval;
      };

      
       
       mydata->dval = 123.45;

7. What term is used to describe the condition where dynamically allocated memory is not formally returned using the delete operator and the operating system does not reclaim the allocated memory area?     Garbage collection
       

8. The general syntax to overload the assignment operator (=) for a class is ____

              const className& operator=(const className&);

9. What is the difference between a friend function and a member function of the class?

       A friend function is a nonmember function of the class, whereas a member function is a member of the class.

10. The name of the function that overloads the + symbol is the ____ function.

        operator+()

11. Which of the following operators can be overloaded?   * operator

       

12. Static binding is a process that is _____

             performed during the compilation of the program

13. With virtual functions and polymorphism, the programmer can _____.

              have the object definitions defined during run time

14. Which statement is true of a class object whose class is derived public from a base class?

       The derived class object is also a base class object.

15. If a class has a pure virtual function, then ___

       that class is an abstract class

16. Which term designates the ability to use the same expression to denote different operations?

              Polymorphism

17. What is the namespace commonly used with <iostream>?   .h

18. If a Class A has an object of Class B as a data member, what type of function must be used for an object of Class A to obtain a copy of a private data member of Class B?

       Class B copy constructor

19. Class header files are usually designated by what indicators? < >

20. In a multifile, object-oriented, C++ project, which file contains the class definition?

       classname.cpp