Deck 23: Other Topics
Question
Question
Question
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/22
Play
Full screen (f)
Deck 23: Other Topics
1
____________ 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.
B
2
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.
A
3
Which of the following is not true of static local variables?
A) They are accessible outside of the function in which they are defined.
B) They retain their values when the function in which they are defined terminates.
C) They are initialized to zero if not explicitly initialized by the programmer.
D) They can be of type int.
A) They are accessible outside of the function in which they are defined.
B) They retain their values when the function in which they are defined terminates.
C) They are initialized to zero if not explicitly initialized by the programmer.
D) They can be of type int.
A
4
In C++0x, Depending on the circumstances, the compiler may ignore the storage class specifier:
A) auto.
B) register.
C) static.
D) extern.
A) auto.
B) register.
C) static.
D) extern.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
5
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 22 flashcards in this deck.
Unlock Deck
k this deck
6
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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
7
___________ 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 22 flashcards in this deck.
Unlock Deck
k this deck
8
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 22 flashcards in this deck.
Unlock Deck
k this deck
9
An identifier's storage class:
A) Determines whether an identifier is known only in the current source file or in any source file with proper declarations.
B) Determines the period during which that identifier exists in memory.
C) Determines where the identifier can be referenced in a program.
D) All of the above.
A) Determines whether an identifier is known only in the current source file or in any source file with proper declarations.
B) Determines the period during which that identifier exists in memory.
C) Determines where the identifier can be referenced in a program.
D) All of the above.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
10
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 22 flashcards in this deck.
Unlock Deck
k this deck
11
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 22 flashcards in this deck.
Unlock Deck
k this deck
12
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 22 flashcards in this deck.
Unlock Deck
k this deck
13
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 22 flashcards in this deck.
Unlock Deck
k this deck
14
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.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
15
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 22 flashcards in this deck.
Unlock Deck
k this deck
16
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 22 flashcards in this deck.
Unlock Deck
k this deck
17
Which operator corresponds to operator keyword and_eq?
A) &&
B) !=
C) &
D) &=
A) &&
B) !=
C) &
D) &=
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
18
Which symbol is used to access class members via pointers to class members?
A) ->
B) .*
C) .
D) *.
A) ->
B) .*
C) .
D) *.
Unlock Deck
Unlock for access to all 22 flashcards in this deck.
Unlock Deck
k this deck
19
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 22 flashcards in this deck.
Unlock Deck
k this deck
20
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 22 flashcards in this deck.
Unlock Deck
k this deck
21
__________ 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 22 flashcards in this deck.
Unlock Deck
k this deck
22
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 22 flashcards in this deck.
Unlock Deck
k this deck