978-1337102087 Chapter 13

subject Type Homework Help
subject Pages 9
subject Words 1391
subject Authors D. S. Malik

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 1
1. In C++, >> is used as a stream extraction operator and as a right shift operator.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
895
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
2. Operator functions typically return void.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
896
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
3. 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.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
896
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
4. In C++, operator is a reserved word.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
896
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
page-pf2
Name:
Class:
Date:
page-pf3
Name:
Class:
Date:
page-pf4
Name:
Class:
Date:
page-pf5
Name:
Class:
Date:
page-pf6
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 6
20. 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&);
ANSWER:
d
POINTS:
1
REFERENCES:
918
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
11/13/2016 8:31 PM
21. 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
ANSWER:
d
POINTS:
1
REFERENCES:
918
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
22. Which of the following is a built-in operation on classes?
a.
increment
b.
assignment
c.
decrement
d.
relational operators
ANSWER:
b
POINTS:
1
REFERENCES:
921
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
23. 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&);
ANSWER:
d
POINTS:
1
page-pf7
Name:
Class:
Date:
page-pf8
Name:
Class:
Date:
page-pf9
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 9
b.
Type operator[](int index);
c.
Type& operator[](int index);
d.
Type [](int index);
ANSWER:
c
POINTS:
1
REFERENCES:
950
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
31. 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;
ANSWER:
b
POINTS:
1
REFERENCES:
950
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
32. Using a class template, you can write a single code segment for a set of related ____.
a.
classes
b.
functions
c.
operators
d.
constructors
ANSWER:
a
POINTS:
1
REFERENCES:
961
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
33. Class templates are called ____ types.
a.
polymorphic
b.
structured
c.
member
d.
parameterized
ANSWER:
d
POINTS:
1
REFERENCES:
961
QUESTION TYPE:
Multiple Choice
page-pfa
Name:
Class:
Date:
page-pfb
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 11
37. Any function that overloads an operator is called a(n) ____________________ function.
ANSWER:
operator
POINTS:
1
REFERENCES:
895
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
38. The operators that cannot be overloaded are ., .*, ::, ?:, and ____________________.
ANSWER:
sizeof
POINTS:
1
REFERENCES:
896
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
11/13/2016 8:35 PM
39. The only built-in operations on classes are assignment (=) and ____________________.
ANSWER:
member selection
POINTS:
1
REFERENCES:
896
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
40. The ____________________ operator causes a member-wise copy of the member variables of the class.
ANSWER:
assignment
POINTS:
1
REFERENCES:
921
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
41. A(n) ____________________ constructor converts its argument to an object of the constructor’s class.
ANSWER:
conversion
POINTS:
1
REFERENCES:
956
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
page-pfc
Name:
Class:
Date:

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.