Sunday, June 10, 2018 10:38 PM
1. Which of the following statements is true regarding classes and objects?
a. Member functions of a class must always be public
b. Member data of a class is in scope inside its member function definition
c. Member functions are called by using the format object::function()
d. Member data of a class must be passed into the member functions as
parameters.
2. Which of the following is a conversion constructor for a class called Prisoner?
(Assume that Criminal is another class)
a. Criminal (Prisoner x);
b. explicit Prisoner (int x);
c. Prisoner (Criminal x);
d. Prisoner (int x, Criminal Y)
3. Which would result in a compile stage error?
a. Calling a function before it is declared
b. Passing an int argument to a function that expects a parameter of type double.
c. Having two definitions of a function, each one in a separate code file
d. Doing the division (x/y) , where x and y are integers and y is 0.
4. In a class, the typical purpose of a destructor member function is….
a. To re-initialize the internal data of an object to a default
b. To return the value of some internal data of an object
c. To build another object inside of the existing object
d. To do any final clean-up tasks on an object before it is deallocated
5. Which of the following statements about operator overloading is false?
a. A unary operator overload can be written as a member function of a class
b. Operator overloading can be used to create new operator symbols
c. A binary operator overload can use a built-in type as an operand
d. Operator overloading cannot set a new precedence level for an operator
6. Which of the following describes an implementation of the composition ('has-a')
relationship.
a. Class Cheese is defined inside of class Pizza
b. An object type File is declared as member data of class File
c. An object of type Snow is declared as member data of class Mountain
d. Class Volcano calls the HeatUp() functionof class Lava
This study 7. If Tag
source was is abyclass
downloaded with afrom
100000899606070 default constructor
CourseHero.com on 02-17-2026 and
22:45:50aGMT
one-parameter
-06:00 construtor of (of type-
int) which of the following is a valid declaration of an array of objects of type Tag?
a. Tag list[];
https://www.coursehero.com/file/32181430/Exam1-Reviewpdf/
, This study source was downloaded by 100000899606070 from CourseHero.com on 02-17-2026 22:45:50 GMT -06:00
https://www.coursehero.com/file/32181430/Exam1-Reviewpdf/