Question: Question 1 A constructor is a special kind of member function. It isautomatically called when an object of that class is declared. True False Question

Question 1

A constructor is a special kind of member function. It isautomatically called when an object of that class is declared.

True

False

Question 2

A constructor is always named construct with the class nameattached. If the class is Foo, then the constructor's name isconstructFoo.

True

False

Question 3

A constructor is like a function. It can return any type ofvalue needed.

True

False

Question 4

You can write a class that is useful with all its constructorsin the private section.

True

False

Question 5

A class may not have another class type object as a member.

True

False

Question 6

A class member that is to be shared among all objects of a classis called

A const member

A reference member

A static member.

A value member

A function member

Question 7

Please select all the correct answers.

Which of the following are accurate comparisons betweencall-by-value and const call-by-reference?

Both protect against changing the caller’s argument.

Both are very fast for all sizes of objects.

Call-by-value copies the argument whereas constcall-by-reference does not

Call by value uses more memory than const call-by-reference inmaking the copy.

Question 8

Please select all the correct answers.

In a vector, which of the following statements is true?

Indexing vector access is range checked.

The range of legal index values for a vector is 0 to the valueof v.size()-1

To add a value use the member function v.push_front( )

To manage size of reserve use v.reserve(newReserve)

To increase or decrease a vector’s size v.new_size(newSize);

Question 9

Which of the following is correct?

A constructor must be declared for each class.

A constructor must be declared with a return type

A default constructor can only be provided by the compiler.

A class can have only one default constructor.

A class can have only one constructor.

Question 10

Please select all the correct answers.

A constructor...

can only be used to initialize

must initialize all member variables

can do anything any other method can do.

usually initializes all, or most, member variables

Question 11

Overloading a binary operator as a stand-alone function requirestwo arguments.

True

False

Question 12

One can guarantee left to right evaluation of the arguments to acomma expression overloading.

True

False

Question 13

A class can have friends that are functions as well as friendclasses.

True

False

Question 14

When overloading an operator, you can create a new operatordifferent from the more usual operators.

True

False

Question 15

Overloaded operator <<, when used as an output, returns anostream& to allow chains of output statements, and similarlythe overloaded operator >> returns an istream&

True

False

Question 16

Please select all the correct answers.

The rules for using operator are different from other operators.Which of the following statements are correct? Explain.

Operator [] may be overloaded only as a static memberfunction.

The index may not be a char.ation

When writing an overloading function for operator [], the []follows the keyword operator, followed by one index parameterdeclaration between parentheses.erence

The index value must be an integer type.

The index may not be an enum.

Question 17

Please select all the correct answers.

I want to have a nonmember function to have access to theprivate members of a class. The class must declare that function asa:

friend

inline

static

None of the above

Question 18

Basic operation overloading is similar to taking a simplealgebraic statement with two operands like y + 8and converting to a function, like:

+ (y , 8)

++ (y, 8)

= (y +8)

Question 19

A friend function of a class is:

Not a member function of the class.

Does not have access to private member variables

Does have access to private member variables, but not public

Step by Step Solution

3.46 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below Answer 1 True A constructor is a special kind of member function that is automatically called when an object of that class is declared A co... View full answer

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 Programming Questions!