Which of the following is true for iterators:
Answer
They are similar to pointers..
They are used as pointers to the elements of a container.
They can successively access each element of a container.
All of the above.
Pointers cannot be used to:
Answer
Contain memory addresses.
Reference values directly.
Pass an argument by reference.
Manipulate dynamic data structures.
What does the following declaration declare? int *countPtr, count;
Answer
Two int variables.
One pointer to an int and one int variable.
Two pointers to ints.
The declaration is invalid.
What are the two most common operations on iterators?:
Answer
add and delete.
square root and mod.
increment and dereference.
multiply and divide.
Which is the following is NOT a type of iterator:
Answer
Input.
Output.
Forward.
Circular.
Which is the following is NOT an associative container available in the STL?:
Answer
Groups.
Sets.
Multisets.
Maps.
Which of the following are NOT one of the three predefined sequence containers?:
Answer
vector.
radiant.
deque.
list.
Classes cannot:
Answer
Be derived from other classes.
Initialize data members in the class definition.
Be used to model attributes and behaviors of objects.
Include objects from other classes as members.
If a member of a class is a function, which of the following is true?:
Answer
it cannot directly access any member of the class.
it can only directly access member variables.
it can directly access any member of the class, including both member variables and member functions.
it can only directly access member functions.
A(n) _________ is created each time the control reaches its declaration, and destroyed when the control exits the surrounding block:
Answer
dynamic data item.
constructor.
destructor.
automatic class object.
_________ is the ability to combine data, and the operations on that data, in a single unit:
Answer
polymorphism.
encapsulation.
class definition.
forward iterators.
__________ is the ability to use the same expression to denote different operations:
Answer
polymorphism.
encapsulation.
class construction.
forward iterators.
The value of a pointer variable is always a(n) _______ :
Answer
floating point number.
an even number.
address.
data item
Which of the following operators can be overloaded as a global function?
Answer
().
[].
+=.
==.
A(n) ____________________ function is a nonmember function that has access to all the public and private variables of a class.
Answer
associate.
congruent.
binary.
friend.
Select the false statement regarding inheritance.
Answer
A derived class can contain more attributes and behaviors than its base class.
A derived class can be the base class for other derived classes.
Some derived classes can have multiple base classes.
Base classes are usually more specific than derived classes.
Which of the following is not a good example of a hierarchy that could be modeled by inheritance?
Answer
Airplanes.
Geometric shapes.
Animals.
Prime numbers.
A try block is followed by one or more ____________________ blocks
Answer
throw.
private.
catch.
data.
________ is a process of solving a problem by reducing it to smaller versions of itself.
Answer
class structure.
recursion.
object-oriented design.
structured programming.
What are the two components of a node in a linked list?:
Answer
front and the back.
head and the tail.
The data and a link to the next node in the list.
2 links.
LIFO stands for _______ and is applicable to ______:
Answer
Last In File Operations, queues.
Last In First Out, linked lists.
Left In File Out, stacks.
Last In First Out, stacks.
A __________ is a comparison between the key of the search item and the key of an item in the list.
Answer
sequential search.
key comparison.
search item comparison.
binary search.
The ______search (also called a ____ search) works the same for both array-based and linked lists. In other words, the search always starts at the first element in the list and continues until either the item is found or the entire list is searched.
Answer
random access, linear.
direct, linear.
sequential, linear.
data driven, sequential.
A ______ element can be accessed either at the top or the bottom of the _______:
Answer
queue, queue.
queue, stack.
stack, stack.
linked list, queue.
If the line: friend class A; appears in class B, and the line: friend class B; appears in class C, then:
Answer
Class A is a friend of class C.
Class A can access private variables of class B.
Class C can call class A s private member functions.
Class B can access class A s private variables.
Which of the following is true for iterators
- Technology: Multiple-Choice-Questions
- Code: SHC_MCQ_10018
-
$9.99
Tags: Multiple choice question, MCQ, c++, cpp, object oriented programming, oop