Deck 24: Other Topics
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/19
Play
Full screen (f)
Deck 24: Other Topics
1
If a derived class inherits from two base classes that both define a certain member function, then an ambiguity problem will arise when:
A) An object of a base class calls that certain member function.
B) An object of the derived class calls that certain member function.
C) A pointer of a base class type pointing to an object of the derived class calls that certain member function.
D) None of the above.
A) An object of a base class calls that certain member function.
B) An object of the derived class calls that certain member function.
C) A pointer of a base class type pointing to an object of the derived class calls that certain member function.
D) None of the above.
B
2
Which symbol is used to access class members via pointers to class members?
A) ->
B) .*
C) .
D) *.
A) ->
B) .*
C) .
D) *.
B
3
Individual namespace members can be accessed without a namespace qualifier:
A) If the using namespace all; directive is included at the beginning of the file.
B) At any time.
C) Only if the namespace is declared inside of main.
D) If the individual member is mentioned in a using namespace::namespacemember declaration.
A) If the using namespace all; directive is included at the beginning of the file.
B) At any time.
C) Only if the namespace is declared inside of main.
D) If the individual member is mentioned in a using namespace::namespacemember declaration.
D
4
____________ namespace members appear to occupy the ___________ namespace and do not have to be qualified with a namespace name.
A) Global, unnamed.
B) Unnamed, global.
C) Named, static.
D) Named, global.
A) Global, unnamed.
B) Unnamed, global.
C) Named, static.
D) Named, global.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
5
Multiple inheritance means that a derived class inherits the members of several:
A) Derived classes.
B) public classes.
C) Direct base classes.
D) Indirect base classes, but exactly one direct base class.
A) Derived classes.
B) public classes.
C) Direct base classes.
D) Indirect base classes, but exactly one direct base class.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
6
Without the statement __________, all __________ statements must be written as std::cout.
A) using namespace std;, cout
B) using std namespace;, cout
C) using std::namespace;, cout
D) using std;, namespace std::cout
A) using namespace std;, cout
B) using std namespace;, cout
C) using std::namespace;, cout
D) using std;, namespace std::cout
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
7
Assuming that ptr is a pointer to a class data member of class Check and obj is a pointer to a Check object, which of the following statements would be used to output that data member?
A) cout << obj.*ptr;
B) cout << *obj ).*ptr;
C) cout << obj->*ptr);
D) cout << *obj )->*ptr;
A) cout << obj.*ptr;
B) cout << *obj ).*ptr;
C) cout << obj->*ptr);
D) cout << *obj )->*ptr;
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
8
__________ inheritance solves the problem of duplicate subobjects.
A) protected
B) virtual
C) const
D) static
A) protected
B) virtual
C) const
D) static
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
9
The const_cast operator can be used to cast away ___________ or ____________ qualifications.
A) const, volatile.
B) The const-ness property, remove.
C) Property, const.
D) enum, #define.
A) const, volatile.
B) The const-ness property, remove.
C) Property, const.
D) enum, #define.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
10
If a certain object's data members need to be frequently modified by const functions, it is best to:
A) Declare the member values non-const.
B) Declare the member values mutable.
C) Use const_cast to make the member values modifiable.
D) Use static_cast to make the member values modifiable.
A) Declare the member values non-const.
B) Declare the member values mutable.
C) Use const_cast to make the member values modifiable.
D) Use static_cast to make the member values modifiable.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
11
Duplicate __________ could result from ___________.
A) subobjects, multiple inheritance.
B) superobjects, multiple inheritance.
C) superclasses, downcasting a pointer.
D) subclasses, upcasting a pointer.
A) subobjects, multiple inheritance.
B) superobjects, multiple inheritance.
C) superclasses, downcasting a pointer.
D) subclasses, upcasting a pointer.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
12
The const_cast operator is needed when __________ data must be treated as ___________ data.
A) const, const
B) Non-const, const
C) const, non-const
D) Non-const, non-const
A) const, const
B) Non-const, const
C) const, non-const
D) Non-const, non-const
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
13
Which operator keyword corresponds to ^?
A) xor
B) xor_eq
C) or
D) or_eq
A) xor
B) xor_eq
C) or
D) or_eq
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
14
Namespace definitions are different from class definitions because:
A) namespace definitions do not end in semicolons.
B) namespace definitions are not delimited by braces {}.
C) namespaces cannot contain functions.
D) namespaces cannot contain variables.
A) namespace definitions do not end in semicolons.
B) namespace definitions are not delimited by braces {}.
C) namespaces cannot contain functions.
D) namespaces cannot contain variables.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
15
Which operator corresponds to operator keyword and_eq?
A) &&
B) !=
C) &
D) &=
A) &&
B) !=
C) &
D) &=
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
16
___________ is/are used to solve the problem of variables with the same name and overlapping scopes.
A) namespaces.
B) Classes.
C) Casts.
D) Dynamic memory allocation.
A) namespaces.
B) Classes.
C) Casts.
D) Dynamic memory allocation.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
17
For multiple inheritance, the ______________ is responsible for initializing the _________ base class.
A) Most derived class, virtual
B) Least derived class, virtual
C) Most derived class, const
D) First derived class, virtual
A) Most derived class, virtual
B) Least derived class, virtual
C) Most derived class, const
D) First derived class, virtual
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
18
Namespaces cannot contain:
A) Any functions.
B) main.
C) Classes.
D) Other namespaces.
A) Any functions.
B) main.
C) Classes.
D) Other namespaces.
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following declares a pointer ptr to a class member function in class Check that takes an int argument and returns a bool?
A) bool: int ) *Check::ptr );
B) Check:: bool *ptr ) int ) );
C) bool Check::*ptr ) int );
D) bool* int ) Check::ptr;
A) bool: int ) *Check::ptr );
B) Check:: bool *ptr ) int ) );
C) bool Check::*ptr ) int );
D) bool* int ) Check::ptr;
Unlock Deck
Unlock for access to all 19 flashcards in this deck.
Unlock Deck
k this deck