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

1. When an \"&\" appears at the left of a variable (e.g., &num), it (Points : 5)

ID: 659692 • Letter: 1

Question

1. When an "&" appears at the left of a variable (e.g., &num), it (Points : 5)        indicates the beginning of a conditional operator expression
       indicates the end of a conditional operator expression
       evaluates to the address of the variable
       evaluates to the underlying ASCII value of the variable . Pointer arithmetic is when (Points : 5)        two pointers variables are multiplied together
       overloaded operators are used to implement arithmetic operations
       an integer is added to a pointer variable Question 3.3. The strcmp function compares the values of two strings. What does strcmp return if the two strings are equal? (Points : 5)        0
       true
       null
       "Yippee 1. When an "&" appears at the left of a variable (e.g., &num), it (Points : 5)        indicates the beginning of a conditional operator expression
       indicates the end of a conditional operator expression
       evaluates to the address of the variable
       evaluates to the underlying ASCII value of the variable . Pointer arithmetic is when (Points : 5)        two pointers variables are multiplied together
       overloaded operators are used to implement arithmetic operations
       an integer is added to a pointer variable Question 3.3. The strcmp function compares the values of two strings. What does strcmp return if the two strings are equal? (Points : 5)        0
       true
       null
       "Yippee

Explanation / Answer

1. When an "&" appears at the left of a variable (e.g., &num)

evaluates to the address of the variable

2.Pointer arithmetic is when

an integer is added to a pointer variable

3. The strcmp function compares the values of two strings. What does strcmp return if the two strings are equal?

0, when the contents of both strings are equal.

4. Inheritance is beneficial because

it allows base class code to be shared among different derived classes.

5. If a base class and a derived class include a member function with the same name, which member function will be called by an object of the derived class (assuming the scope resolution operator is not used)?

the derived class's member function

6. An example of multiple inheritance is:

An Employee class that is derived from two base classes - Person and Asset.

7. Describe the relationship between a Cow class and a Mammal class in an animal organizer program.

8. In a UML class diagram

The + symbol indicates public access and the - symbol indicates private access.

9.If you'd like to use an object with cin or cout, why must you implement the << and >> operators as friends rather than implement the << and >> operators as members of a class?

For << and >> to be implemented as members of a class, it would require editing the cout and cin source code, and that's not practical.

10. When an argument is passed by value, a duplicate copy of it is created, and this copy is passed to the function heading's corresponding parameter.

True

11. Programmer-defined header files will typically contain multiple-line member function definitions.

True

12. Operator overloading is when a normal C++ operator (+, *, <, etc.) is given an additional meaning when it is applied to an object.

True

13. If a derived class's constructor heading doesn't have a call to one of its base class's constructors, then, by default, the base class's 0-parameter constructor is called.

True

14. A Car class has an "is a" relationship with its SteeringWheel and Brakes classes

False,Because it is has a relationship

15.Given the following code fragment. Is ball considered to be an anonymous object?

Ball ball();
return ball;

yes

16. Usually, you should use a friend function rather than a member function whenever possible.

True

17.What is the name of the string function that appends/concatenates one string onto the end of another string?

18. Assume that you have written a large elevator simulation program that includes these three classes

       It's an inheritance relationship, such that Mammal would be a base class for the Cow class.