Filters
Question type

Study Flashcards

A move operation transfers resources from a source object to a target object.

Correct Answer

verifed

verified

A(n) __________ informs the compiler that a class will be declared later in the program.


A) static function
B) private data member
C) forward declaration
D) object conversion
E) None of these

Correct Answer

verifed

verified

A good reason to overload an operator is to enable it to


A) outperform its C language counterparts
B) work in its usual way, but with programmer-defined data types
C) operate on more operands than in its standard definition
D) operate on no operands
E) None of these

Correct Answer

verifed

verified

A member function that is declared __________ may not access any non-static data members in the class.


A) private
B) public
C) static
D) inline
E) None of these

Correct Answer

verifed

verified

An ___________ operator can work with programmer-defined data types.


A) inline
B) unconditional
C) overloaded
D) undefined
E) None of these

Correct Answer

verifed

verified

In C++11 an rvalue reference is a reference variable that can refer only to temporary objects.

Correct Answer

verifed

verified

A(n) __________ is a special function that is called whenever a new object is created and initialized with another object's data.


A) static function
B) destructor
C) copy constructor
D) assignment function
E) None of these

Correct Answer

verifed

verified

When a class declares an entire class as its friend, the friendship status is reciprocal. That is, each class's member functions have free access to the other's private members.

Correct Answer

verifed

verified

If you do not furnish a __________, a default one will be provided by the compiler.


A) constructor
B) destructor
C) copy constructor
D) All of these
E) None of these

Correct Answer

verifed

verified

The this pointer is a special built-in pointer that is automatically passed as a hidden argument to all non-static member functions.

Correct Answer

verifed

verified

A non-static member function may not access a static member variable.

Correct Answer

verifed

verified

False

When you redefine the way a standard operator works when it is used with class objects, you have __________ the operator.


A) reassigned
B) reformatted
C) overloaded
D) referenced
E) None of these

Correct Answer

verifed

verified

In C++11 reference variables that can refer only to temporary objects that would otherwise have no name are called __________ and are declared with a __________.


A) rvalues, ampersand (&)
B) lvalues, ampersand (&)
C) lvalues, double ampersand (&&)
D) rvalues, double ampersand (&&)
E) None of these

Correct Answer

verifed

verified

A static member variable can be used when there are no objects of the class in existence.

Correct Answer

verifed

verified

To overload the + operator, you would write a function named


A) overload +
B) operator +
C) function +
D) operator.overload(+)
E) None of these

Correct Answer

verifed

verified

B

A static member function does not need to be called by a specific object of the class.

Correct Answer

verifed

verified

Which type of function is not a member of a class but has access to the private members of the class?


A) static
B) constructor
C) destructor
D) friend
E) None of these

Correct Answer

verifed

verified

A public data member may be declared a friend of a private function.

Correct Answer

verifed

verified

Select all that apply. Given the following code fragment, which of the things shown below happen when the statement on line 8 executes? 1 int square(int a) 2 { 3 \quad return a * a; 4 } 5 int main() 6 { 7 \quad int x = 0; 8 \quad x = square(5) ; 9 \quad cout << x << endl; 10 \quad return 0; 11 }


A) The square function is called and the value 5 is passed as an argument.
B) The square function calculates 5*5 and stores the result, 25, as a temporary value.
C) The temporary value is copied (assigned) to the variable x.
D) The temporary value is discarded by the system.
E) None of these

Correct Answer

verifed

verified

It is possible to declare an entire class as a friend of another class.

Correct Answer

verifed

verified

True

Showing 1 - 20 of 46

Related Exams

Show Answer