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

Question 1. Which of the following relationships is not a correct example of inh

ID: 3558673 • Letter: Q

Question

Question 1. Which of the following relationships is not a correct example of inheritance?

       Parent to Children
       Aunt to Uncle
       Grandparent to Grandchild
       Father and Mother to Children

Question 2. Single inheritance means _____.

       that the derived class is derived from a single base class
       that only multiple classes can be derived from the given base class
       that only one base class can be derived
       Single inheritance is not possible in C++.

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

       child
       base
       sibling
       derived

Question 4. What is the data type of pDist?

Distance * pDist;

       Distance
       Const pointer to Distance
       Pointer to Distance
       Pointer to MAX

Question 5. Consider a class called Employee and the following definitions and statements.

void myFunction( Employee eptr );
Employee *emp = new Employee;

Which statement correctly passes by value the newly created Employee object?

       myFunction(emp);
       myFunction(&emp);
       myFunction(*emp);
       None of the above

Question 6. What is wrong with the following C++ statements?

int* iptr;
double d = 123.321;
iptr = & d;
cout << *iptr;

       The cout statement does not contain an endl.
       The space following the ampersand should not be there.
       The iptr variable cannot be given an address of a double.
       All of the above

Question 7. For the code fragment below, if the address of foo is bff00fa10 hex and the address of foo2 is bff00a14 hex, what is the output?

#include <iostream>
using namespace std;
int main ()
{
      int foo;
      int *foo2;
      foo2 = &foo;
      foo = 1234;
      cout << *foo2 << end1;
      return 0;
}

       1234
       0xbff00a10
       0xbff00a14
       0xbff01424

Question 8. Which overloaded operator should use the following line for its last statement?

return *this;

       Overloaded multiplication
       Overloaded assignment
       Overloaded addition
       Overloaded division
       All of the above

Question 9. What is a friend function?

       An overloaded operator
       A function in a derived class that overrides a base class function of the same name
       A nonmember function of a class that has access to all the members of the class
       A function called by member function of a class

Question 10. Which of the following is not a C++ reserved word?

       This
       Operator
       Friend
       Binary

Question 11. Which of the following operators can be overloaded?

       .
       .*
       ::
       ++

Question 12. Virtual functions are first declared in what class?

       The base class
       The derived class
       Both the base and the derived classes
       Neither the base nor the derived class

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

       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. Consider the following class definitions.

class Employee { };
class Boss : public Employee { };
class Worker : public Employee { };

If the function double CalculateEarnings(); is declared as a virtual in class Employee, _____.

       then both the Boss and Worker classes must use an identical function implementation of double CalculateEarnings()
       then Employee provides both the Boss and the Worker classes with the implementation code for the function
       then the Boss and the Worker classes may override the function with implementation specific for that class
       then the Boss and the Worker versions of the function must call the base class version defined in Employee

Question 15. Virtual functions are reserved using what C++ keyword?

       Polymorphic
       Static
       Dynamic
       Virtual

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

       Inheritance
       Encapsulation
       Polymorphism
       Composition.

Question 17. In a multifile, object-oriented, C++ project, which file contains the class implementation?

       classname.hdr
       classname.h
       classname.def
       classname.cpp

Question 18. When creating a macro, which preprocessor directive is used?

       ifndef
       define
       ifdef
       endif

Question 19. Which is a correct preprocessor directive statement?

       define PI = 3.141593
       define PI = 3.141593;
       #define PI 3.141593
       #define PI = 3.141593

Question 20. In a multifile, object-oriented, C++ project, which is the correct statement for the constructor implementation, given that the constructor is correctly defined in the class definition file?

       Classname:Classname{ }
       Classname { }
       Classname::Classname { }
       Classname { }

Question 1. Which of the following relationships is not a correct example of inheritance?

       Parent to Children
       Aunt to Uncle
       Grandparent to Grandchild
       Father and Mother to Children

Explanation / Answer

1)Aunt to Uncle
2)that the derived class is derived from a single base class
3)base
4)Pointer to Distance
5)myFunction(*emp);
6)The iptr variable cannot be given an address of a double
7)1234
8)All of the above
9)A nonmember function of a class that has access to all the members of the class
10)Binary
11)++
12)Base class
13)have the object definitions defined during run time
14)then the Boss and the Worker classes may override the function with implementation specific for that class
15)Virtual
16)Polymorphism
17)classname.cpp
18)define
19)#define PI 3.141593
20)none it should be like this
Classname::Classname() { }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote