Deck 13: Overloading and Templates

ملء الشاشة (f)
exit full mode
سؤال
Every object of a class maintains a (hidden) pointer to itself, and the name of this pointer is ____.

A) self
B) object
C) it
D) this
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The function that overloads the ____ operator for a class must be declared as a member of the class.

A) ::
B) *
C) ->
D) +
سؤال
Which of the following function prototypes overloads the != operator for the class rectangleType?

A) bool operator!=(rectangle&) const;
B) bool operator!=(const rectangleType&) const;
C) int operator!=(const rectangleType) const;
D) int operator!=(rectangle&) const;
سؤال
The declaration of a friend function cannot be placed within the private part of the class.
سؤال
The return type of the function operator == is ____.

A) int
B) bool
C) char
D) void
سؤال
A friend function does not have access to the private data members of the class.
سؤال
The general form of the functions to overload the binary operators as member functions of a class is returnType operator#(____ className&) const;.

A) class
B) const
C) *
D) &
سؤال
Both parameters of the function to overload the operator << are reference parameters.
سؤال
The associativity of the operator = is from right to left.
سؤال
The general syntax to overload the stream extraction operator >> for a class is ____.

A) istream& operator>>(istream&, className&);
B) const istream& operator>>(istream&, className&);
C) friend operator>>(istream&, className&);
D) friend istream& operator>>(istream&, className&);
سؤال
The name of the function to overload the operator <= is ____.

A) overload<=
B) <=new
C) operator<=
D) <=operator
سؤال
In C++, operator is a reserved word.
سؤال
Operator functions typically return void.
سؤال
When an object invokes a member function, the member function references the pointer ____ of the object.

A) object
B) it
C) this
D) address
سؤال
To include the operator function operator+ as a nonmember function of the class rectangleType, its prototype in the definition of rectangleType is: ____ rectangleType operator+(const rectangleType&, const rectangleType&);

A) bool
B) int
C) double
D) friend
سؤال
When writing the definition of a friend function, the name of the class and the scope resolution operator precede the name of the friend function in the function heading.
سؤال
Operators can be overloaded either for objects of the user-defined types, or for a combination of objects of the user-defined type and objects of the built-in type.
سؤال
A(n) ____ function is a nonmember function that has access to all members of the class.

A) access
B) protected
C) friend
D) void
سؤال
In C++, >> is used as a stream extraction operator and as a right shift operator.
سؤال
Most operator functions can either be member functions or nonmember functions of a class.
سؤال
Suppose cType is a class template, which can take int as a parameter. The statement: ____ declares x to be an object of type cType, and the type passed to the class cType is int.

A) cType x;
B) cType int x;
C) cType int = x;
D) cType int :: x;
سؤال
If you overload the binary arithmetic operator + as a member function, how many objects must be passed as parameters?

A) none
B) one
C) two
D) three
سؤال
Class templates are called ____ types.

A) polymorphic
B) structured
C) member
D) parameterized
سؤال
With the exception of the ____________________ operator and the member selection operator, operators must be overloaded to be used on class objects.
سؤال
Which of the following is a built-in operation on classes?

A) increment
B) assignment
C) decrement
D) relational
سؤال
When the post-increment operator is overloaded as a nonmember function of the class, the operator function has ____ parameter(s).

A) no
B) one
C) two
D) three
سؤال
Which of the following is the general syntax of the function prototype to overload the pre-increment operator as a nonmember function?

A) className operator++();
B) friend className operator++();
C) className operator++(int);
D) friend className operator++(className&);
سؤال
Using a class template, you can write a single code segment for a set of related ____.

A) classes
B) functions
C) operators
D) constructors
سؤال
Suppose cType is a class template, and func is a member function of cType. The heading of the function definition of func is: ____.

A) template
FuncType cType == func(parameters)
B) template
FuncType cType
C) template
FuncType cType::func(parameters)
D) template
FuncType cTypefunc(parameters;
سؤال
The operators that cannot be overloaded are ., .*, ::, ?:, and ____________________.
سؤال
Which of the following is the syntax to declare the operator function operator[] as a member function of a class for nonconstant arrays?

A) Type& []operator(int index);
B) Type operator[](int index);
C) Type& operator[](int index);
D) Type [](int index);
سؤال
The return type of the function to overload the operator >> must be a reference to a(n) ____ object.

A) iostream
B) ostream
C) stream
D) istream
سؤال
The only built-in operations on classes are assignment (=) and ____________________.
سؤال
To overload the pre-increment (++) operator for a class, if the operator function is a member of that class, it must have ____ parameter(s).

A) no
B) one
C) two
D) three
سؤال
Which of the following is the general syntax of the function prototype to overload the pre-increment operator ++ as a member function?

A) className operator++();
B) className operator++(int);
C) friend className operator++();
D) friend className operator++(int);
سؤال
Any function that overloads an operator is called a(n) ____________________ function.
سؤال
The ____________________ operator function as a member of a class has only one parameter; as a nonmember of a class, it has two parameters.
سؤال
The general syntax for the function prototype to overload the assignment operator = for a class is ____.

A) friend className& operator=(const className&);
B) className& operator=(className&);
C) string className& operator=(className&);
D) const className& operator=(const className&);
سؤال
Which of the following is the syntax to declare the operator function operator[] as a member function of a class for constant arrays?

A) const Type& []operator(int index) const;
B) const Type& operator[](int index) const;
C) const Type& operator[](int index);
D) const Type [](int index) const;
سؤال
Which of the following is the general syntax of the function prototype to overload the post-increment operator as a member function?

A) className operator++();
B) friend className operator++();
C) className operator++(int);
D) friend className operator++(int);
سؤال
The ____________________ operator causes a member-wise copy of the member variables of the class.
سؤال
To overload a(n) ____________________ operator for a class, if the operator function is a nonmember, it has one parameter.
سؤال
The operator function that overloads the insertion operator, <<, or the extraction operator, >>, for a class must be a(n) ____________________ function of that class.
سؤال
Passing a parameter to a class template has an effect at ____________________ time.
سؤال
A(n) ____________________ constructor converts its argument to an object of the constructor's class.
سؤال
In C++, a function ____________________ can be overloaded.
سؤال
A class template is called a(n) ____________________ type because it specifies how a generic class template is to be customized to form a specific template class.
سؤال
The ____________________ members of a class are local to the class and, therefore, cannot be accessed outside of the class.
سؤال
Classes with pointer member variables must include the ____________________ constructor.
سؤال
A conversion constructor is a(n) ____________________-parameter function.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 13: Overloading and Templates
1
Every object of a class maintains a (hidden) pointer to itself, and the name of this pointer is ____.

A) self
B) object
C) it
D) this
D
2
The function that overloads the ____ operator for a class must be declared as a member of the class.

A) ::
B) *
C) ->
D) +
C
3
Which of the following function prototypes overloads the != operator for the class rectangleType?

A) bool operator!=(rectangle&) const;
B) bool operator!=(const rectangleType&) const;
C) int operator!=(const rectangleType) const;
D) int operator!=(rectangle&) const;
B
4
The declaration of a friend function cannot be placed within the private part of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
The return type of the function operator == is ____.

A) int
B) bool
C) char
D) void
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
A friend function does not have access to the private data members of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
The general form of the functions to overload the binary operators as member functions of a class is returnType operator#(____ className&) const;.

A) class
B) const
C) *
D) &
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Both parameters of the function to overload the operator << are reference parameters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
The associativity of the operator = is from right to left.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
The general syntax to overload the stream extraction operator >> for a class is ____.

A) istream& operator>>(istream&, className&);
B) const istream& operator>>(istream&, className&);
C) friend operator>>(istream&, className&);
D) friend istream& operator>>(istream&, className&);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
The name of the function to overload the operator <= is ____.

A) overload<=
B) <=new
C) operator<=
D) <=operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
In C++, operator is a reserved word.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
Operator functions typically return void.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
When an object invokes a member function, the member function references the pointer ____ of the object.

A) object
B) it
C) this
D) address
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
To include the operator function operator+ as a nonmember function of the class rectangleType, its prototype in the definition of rectangleType is: ____ rectangleType operator+(const rectangleType&, const rectangleType&);

A) bool
B) int
C) double
D) friend
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
When writing the definition of a friend function, the name of the class and the scope resolution operator precede the name of the friend function in the function heading.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
Operators can be overloaded either for objects of the user-defined types, or for a combination of objects of the user-defined type and objects of the built-in type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
A(n) ____ function is a nonmember function that has access to all members of the class.

A) access
B) protected
C) friend
D) void
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
In C++, >> is used as a stream extraction operator and as a right shift operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
Most operator functions can either be member functions or nonmember functions of a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
Suppose cType is a class template, which can take int as a parameter. The statement: ____ declares x to be an object of type cType, and the type passed to the class cType is int.

A) cType x;
B) cType int x;
C) cType int = x;
D) cType int :: x;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
If you overload the binary arithmetic operator + as a member function, how many objects must be passed as parameters?

A) none
B) one
C) two
D) three
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Class templates are called ____ types.

A) polymorphic
B) structured
C) member
D) parameterized
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
With the exception of the ____________________ operator and the member selection operator, operators must be overloaded to be used on class objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following is a built-in operation on classes?

A) increment
B) assignment
C) decrement
D) relational
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
When the post-increment operator is overloaded as a nonmember function of the class, the operator function has ____ parameter(s).

A) no
B) one
C) two
D) three
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following is the general syntax of the function prototype to overload the pre-increment operator as a nonmember function?

A) className operator++();
B) friend className operator++();
C) className operator++(int);
D) friend className operator++(className&);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
Using a class template, you can write a single code segment for a set of related ____.

A) classes
B) functions
C) operators
D) constructors
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Suppose cType is a class template, and func is a member function of cType. The heading of the function definition of func is: ____.

A) template
FuncType cType == func(parameters)
B) template
FuncType cType
C) template
FuncType cType::func(parameters)
D) template
FuncType cTypefunc(parameters;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The operators that cannot be overloaded are ., .*, ::, ?:, and ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following is the syntax to declare the operator function operator[] as a member function of a class for nonconstant arrays?

A) Type& []operator(int index);
B) Type operator[](int index);
C) Type& operator[](int index);
D) Type [](int index);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
The return type of the function to overload the operator >> must be a reference to a(n) ____ object.

A) iostream
B) ostream
C) stream
D) istream
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
The only built-in operations on classes are assignment (=) and ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
To overload the pre-increment (++) operator for a class, if the operator function is a member of that class, it must have ____ parameter(s).

A) no
B) one
C) two
D) three
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following is the general syntax of the function prototype to overload the pre-increment operator ++ as a member function?

A) className operator++();
B) className operator++(int);
C) friend className operator++();
D) friend className operator++(int);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
Any function that overloads an operator is called a(n) ____________________ function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
The ____________________ operator function as a member of a class has only one parameter; as a nonmember of a class, it has two parameters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
The general syntax for the function prototype to overload the assignment operator = for a class is ____.

A) friend className& operator=(const className&);
B) className& operator=(className&);
C) string className& operator=(className&);
D) const className& operator=(const className&);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following is the syntax to declare the operator function operator[] as a member function of a class for constant arrays?

A) const Type& []operator(int index) const;
B) const Type& operator[](int index) const;
C) const Type& operator[](int index);
D) const Type [](int index) const;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following is the general syntax of the function prototype to overload the post-increment operator as a member function?

A) className operator++();
B) friend className operator++();
C) className operator++(int);
D) friend className operator++(int);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
The ____________________ operator causes a member-wise copy of the member variables of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
To overload a(n) ____________________ operator for a class, if the operator function is a nonmember, it has one parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
The operator function that overloads the insertion operator, <<, or the extraction operator, >>, for a class must be a(n) ____________________ function of that class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Passing a parameter to a class template has an effect at ____________________ time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
A(n) ____________________ constructor converts its argument to an object of the constructor's class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
In C++, a function ____________________ can be overloaded.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
A class template is called a(n) ____________________ type because it specifies how a generic class template is to be customized to form a specific template class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
The ____________________ members of a class are local to the class and, therefore, cannot be accessed outside of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
Classes with pointer member variables must include the ____________________ constructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
A conversion constructor is a(n) ____________________-parameter function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.