Filters
Question type

Study Flashcards

When an object or structure variable is passed to a function as a constant reference


A) the function accesses the original object, rather than a copy of it.
B) the function cannot make any changes to the member variables.
C) it is more efficient than passing it by value.
D) all of the above are True.
E) A and B are True, but not C.

F) C) and D)
G) A) and E)

Correct Answer

verifed

verified

Public members of a class object can be accessed from outside the class by using the


A) dot operator.
B) get function.
C) extraction operator.
D) member access operator.
E) class name.

F) D) and E)
G) C) and E)

Correct Answer

verifed

verified

A constructor is a public class function that gets called whenever you want to re-initialize an object's member data.

A) True
B) False

Correct Answer

verifed

verified

A C++ member function that sets or changes the value stored in a member variable is called


A) an accessor.
B) a mutator.
C) a user.
D) a get function.
E) an updater.

F) B) and C)
G) B) and D)

Correct Answer

verifed

verified

A constructor is a public class function that is automatically invoked (i.e., called) whenever a class object is created.

A) True
B) False

Correct Answer

verifed

verified

A structure variable is similar to a class object in which of the following ways?


A) It has member data that is usually private and accessed through public member functions.
B) Its data can be initialized with a constructor.
C) It can be passed to a function or returned from a function.
D) All of the above.
E) B and C, but not A.

F) B) and E)
G) C) and D)

Correct Answer

verifed

verified

An Abstract data type (AD T) is a programmer-defined data type that specifies the values the type can hold, the operations that can be performed on them, and how the operations will be implemented.

A) True
B) False

Correct Answer

verifed

verified

False

If setSide is a Square class function and box is a Square object, which of the following statements would set the length of box's side to 5?


A) setSide(5) ;
B) box.setSide(5) ;
C) Square.setSide(5) ;
D) Square.setSide = 5;
E) None of the above

F) None of the above
G) A) and E)

Correct Answer

verifed

verified

The bundling of an object's data and functions together is called


A) OOP.
B) encapsulation.
C) data hiding.
D) structuring.
E) private access.

F) A) and E)
G) A) and B)

Correct Answer

verifed

verified

When three different objects of a class are created, they are said to be separate ________ of the class.


A) members
B) ADTs
C) instances
D) children
E) None of the above

F) All of the above
G) A) and B)

Correct Answer

verifed

verified

C

A structure has member variables, like an object, but they are usually all public and accessed directly with the dot operator, instead of by calling member functions.

A) True
B) False

Correct Answer

verifed

verified

An object typically hides its data, but allows outside code to access it through its


A) private member functions.
B) public member functions.
C) public data members.
D) access specifiers.
E) None of the above

F) B) and C)
G) A) and E)

Correct Answer

verifed

verified

A constructor that does not require that any arguments be passed to it is called a(n) ________ constructor.


A) empty
B) default
C) stand-alone
D) zero-element
E) useless

F) C) and E)
G) B) and D)

Correct Answer

verifed

verified

A destructor is a member function that


A) is used to remove old unneeded objects.
B) causes the program to end.
C) is automatically called when an object is destroyed.
D) can only be called by the main function of a program.
E) None of the above.

F) C) and D)
G) A) and C)

Correct Answer

verifed

verified

The ________ is used to protect important data.


A) default constructor
B) class protection operator
C) protect() member function
D) public access specifier
E) private access specifier

F) A) and B)
G) B) and E)

Correct Answer

verifed

verified

A(n) ________ member function may be called by a statement in a function that is outside of the class.


A) inline
B) public
C) private
D) declared
E) constructor

F) None of the above
G) A) and C)

Correct Answer

verifed

verified

What will the following code segment display? Enum Season {Spring, Summer, Fall, Winter} favoriteSeason; FavoriteSeason = Summer; Cout << favoriteSeason;


A) 1
B) 2
C) Summer
D) "Summer"
E) None of these.

F) C) and E)
G) D) and E)

Correct Answer

verifed

verified

When the body of a member function is defined inside a class declaration, it is called a(n) ________ function.


A) static
B) global
C) inline
D) conditional
E) constructor

F) A) and E)
G) A) and D)

Correct Answer

verifed

verified

C

Accessors are sometimes called ________ functions and mutators are sometimes called ________ functions.


A) set, get
B) get, set
C) public, private
D) private, public
E) regular, inline

F) B) and C)
G) B) and D)

Correct Answer

verifed

verified

An object is a(n) ________ of a class.


A) example
B) copy
C) instance
D) attribute
E) member

F) D) and E)
G) C) and D)

Correct Answer

verifed

verified

Showing 1 - 20 of 40

Related Exams

Show Answer