Exam 2 C++

¡Supera tus tareas y exámenes ahora con Quizwiz!

3 Q1: Iterators are similar to pointers because of the: a. * and ++ operators. b. -> operator. c. begin and end functions. d. & operator.

a. * and ++ operators.

9 Q3: Assuming that bitset b1 contains the bits [0 1 1 0] and bitset b2 contains the bits [1 1 1 1], which of the following expressions returns true? a. b1.any() b. b1 == b2 c. b1.test( 3 ) d. b2.none()

: a. b1.any() Section

10 Q1: Function objects have their functions called by using: a. The dot operator (.) b. operator() c. The arrow operator (->) d. The binary scope resolution operator (::)

: b. operator()

9 Q1: Which of the following bitset member functions cannot be called with an empty argument list? a. reset b. test c. size d. none

: b. test

9 Q2: Which bitset function could be used to create the logical not of a bitset object b? a. b.set() b. b.reset() c. b.flip() d. b.none()

: c. b.flip()

10 Q2: Which of the following is not true of a class that will be used to instantiate function objects? a. It must overload the parentheses operator. b. It can have data members. c. It must be a concrete class. d. All of the above are true about a class that will be used to instantiate function objects.

: d. All of the above are true about a class that will be used to instantiate function objects.

8.4 Q1: The order of the arguments passed to function replace_copy_if must be: a. OutputIterator, InputIterator, ReplacementValue, PredicateFunction. b. InputIterator, OutputIterator, PredicateFunction, ReplacementValue. c. OutputIterator, InputIterator, InputIterator, ReplacementValue, PredicateFunction. d. InputIterator, InputIterator, OutputIterator, PredicateFunction, ReplacementValue.

: d. InputIterator, InputIterator, OutputIterator, PredicateFunction, ReplacementValue. Section

4 Q1: Problems using switch logic to deal with many objects of different types do not include: a. Forgetting to include an object in one of the cases. b. Having to update the switch statement whenever a new type of object is added. c. Having to track down every switch statement to do an update of object types. d. Not being able to implement separate functions on different objects.

: d. Not being able to implement separate functions on different objects. Section

6 Q1: Which forms of inheritance are is-a relationships? a. All forms of inheritance are is-a relationships. b. Only public and private. c. Only public and protected. d. Only public.

: d. Only public.

6.1 Q1: The multiset associative container does not: a. Need a header file to be used. b. Use its comparator function object to determine the order of its data. c. Arrange its data in ascending order by default. d. Permit random access to its keys.

: d. Permit random access to its keys.

6.2 Q1: If a program attempts to insert a duplicate key into a set: a. An exception is thrown. b. The set will contain multiple copies of that key. c. A compile error will occur. d. The duplicate key will be ignored.

: d. The duplicate key will be ignored. Section

Q1: Which of the following is not true of pointers to functions? a. They contain the starting address of the function code. b. They are dereferenced in order to call the function. c. They can be stored in arrays. d. They can not be assigned to other function pointers.

: d. They can not be assigned to other function pointers.

7 Q4: Abstract classes do not necessarily have: a. A 0 pointer in their vtable. b. A virtual function prototype with the notation = 0. c. Zero instances of their class. d. Zero references to their class.

: d. Zero references to their class. Section

2 Q1: Which of the following would not be a member function that derived classes Fish, Frog and Bird should inherit from base class Animal and then provide their own definitions for, so that the function call can be performed polymorphically? a. eat b. sleep c. move d. flapWings

: d. flapWings Section

8.3 Q1: Suppose you have a shopping list stored in a vector. What function would you use to remove all items in that vector that are under 10 dollars and place them in another container? a. remove b. remove_copy c. remove_if d. remove_copy_if

: d. remove_copy_if Section

8.10 Q2: The __________ function would produce a sequence containing three elements when passed the sequences 1, 2 and 1, 2, 3, 4, 5 as first/second and third/fourth arguments, respectively. a. set_intersection b. set_difference c. set_union d. set_symmetric_difference

: d. set_symmetric_difference Section

8.13 Q1: Which of the following function calls would not return the value that is its first argument? a. std::min( 3, 23 ) b. std::min( 'N', 'P' ) c. std::max( 17, 16 ) d. std::max( 'd', 'k' )

: d. std::max( 'd', 'k' ) Section

3 Q3: Which category of iterators combines the capabilities of input and output iterators into one iterator? a. Forward iterators. b. Bidirectional iterators. c. Random access iterators. d. Input/output iterators.

a. Forward iterators. Section

3 Q2: protected base class members cannot be accessed by: a. Functions that are neither friends of the base class, derived-class member functions nor friends of a derived class. b. friends of the base class. c. Functions that are not derived-class member functions. d. friends of derived classes.

a. Functions that are neither friends of the base class, derived-class member functions nor friends of a derived class. Section

4 Q2: Assuming the following is the beginning of the constructor definition for class BasePlus-CommissionEmployee which inherits from class Point, BasePlusCommissionEmployee::BasePlusCommissionEmployee( string first, string last, string ssn, double sales, double rate, double salary ) : CommissionEmployee( first, last, ssn, sales, rate ) The second line: a. Invokes the CommissionEmployee constructor with arguments. b. Causes a compiler error. c. Is unnecessary because the CommissionEmployee constructor is called automatically. d. Indicates inheritance.

a. Invokes the CommissionEmployee constructor with arguments.

2 Q1: Which of the following is not an STL container type? a. Second-class containers. b. Sequence containers. c. Associative containers. d. Container adapters.

a. Second-class containers.

2 Q1: Which of the following is most likely a base class of the other three? a. automobile. b. convertible. c. miniVan. d. sedan.

a. automobile.

2 Q3: To declare class subClass a privately derived class of superClass one would write: a. class subclass : private superClass b. class subclass :: private superClass c. class subclass < private superClass > d. class subclass inherits private superClass

a. class subclass : private superClass Section

1 Q3: The is-a relationship represents. a. Composition. b. Inheritance. c. Information Hiding. d. A friend.

b. Inheritance. Section

5 Q1: Which of the following is not a sequence container provided by the STL? a. vector b. array c. list d. deque

b. array

3 Q1: From most restrictive to least restrictive, the access modifiers are: a. protected, private, public b. private, protected, public c. private, public, protected d. protected, public, private

b. private, protected, public

2 Q2: Which of the following containers is not considered a near container? a. C-like arrays b. vectors c. strings d. bitsets

b. vectors Section

4 Q1: An STL algorithm cannot: a. Return an iterator. b. Take two iterators as arguments to specify a range. c. Access STL members directly. d. Be used with containers that support more powerful iterators than the minimum requirements for the algorithm.

c. Access STL members directly.

4 Q4: When should base class members be declared protected? a. When all clients should be able to access these members. b. When these members are used only by member functions of this base class. c. When these members should be available only to derived classes (and friends), but not to other clients. d. The protected access specified should never be used.

c. When these members should be available only to derived classes (and friends), not to other clients. Section

1 Q2: Which of the following is not a kind of inheritance in C++? a. public. b. private. c. static. d. protected.

c. static.

4 Q3: Which of the following is not one of the disadvantages of using the "copy-and-paste" approach to duplicating code from one class into another class? a. Errors are prone to be spread around. b. It is time consuming. c. It forces the system to store many physical copies of the code, creating a code-maintenance nightmare. d. All of the above are disadvantages of the "copy-and-paste" approach.

d. All of the above are disadvantages of the "copy-and-paste" approach.

1 Q1: Select the false statement regarding inheritance. a. A derived class can contain more attributes and behaviors than its base class. b. A derived class can be the base class for other derived classes. c. Some derived classes can have multiple base classes. d. Base classes are usually more specific than derived classes.

d. Base classes are usually more specific than derived classes.

4 Q2: Which of the following are mutating-sequence algorithms defined in the STL? a. copy b. remove_if c. find d. Both (a) and (b).

d. Both (a) and (b). Section

1 Q1: Which of the following is not a key component of the STL? a. Containers. b. Iterators. c. Algorithms. d. Pointers.

d. Pointers. Section

2 Q2: Which of the following is not a good example of a hierarchy likely to be modeled by inheritance? a. Airplanes. b. Geometric shapes. c. Animals. d. Prime numbers.

d. Prime numbers.

8 Q1: The line: virtual double functionX() const = 0; in a class definition indicates that the class is probably a: a. Base class. b. Derived class. c. Protected class. d. Library class.

: a. Base class.

8.11 Q1: Functions lower_bound, upper_bound and equal_range are different in their: a. Return types. b. First argument types. c. Second argument types. d. Third argument types.

: a. Return types. Section

3.1 Q1: Employee is a base class and HourlyWorker is a derived class, with a redefined non-virtual print function. Given the following statements, will the output of the two print function calls be identical? HourlyWorker h; Employee *ePtr = &h; ePtr->print(); ePtr->Employee::print(); a. Yes. b. Yes, if print is a static function. c. No. d. It would depend on the implementation of the print function.

: a. Yes. Section

8.6 Q2: Which algorithm cannot take a predicate function as an argument? a. find b. find_if c. sort d. binary_search

: a. find Section

8 Q3: The __________ operator returns a reference to a __________ object: a. typeid, type_info b. typeinfo, type_id c. typeid, data_type d. typeinfo, type

: a. typeid, type_info

3.4 Q1: If objects of all the classes derived from the same base class all need to draw themselves, the draw function would most likely be declared: a. private b. virtual c. protected d. friend

: b. virtual

8.12 Q2: Sorting a preexisting sequence of n elements can be accomplished with the heapsort algorithm by: a. Calling make_heap on the entire sequence and then calling pop_heap on the entire sequence n times. b. Calling push_heap on the entire sequence n times and then calling pop_heap on the entire sequence n times. c. Calling make_heap on the entire sequence and then calling sort_heap on the entire sequence. d. Calling push_heap on the entire sequence n times and then calling sort_heap on the entire sequence.

: c. Calling make_heap on the entire sequence and then calling sort_heap on the entire sequence. Section

5 Q1: The algorithms in the STL: a. Use virtual function calls. b. Are implemented as member functions of the container classes. c. Do not depend on the implementation details of the containers on which they operate. d. Are not as efficient as the algorithms presented in most textbooks.

: c. Do not depend on the implementation details of the containers on which they operate. Section

3 Q2: Which of the following is the correct hierarchy of iterator categories (weakest at the left)? a. Input/output, forward, bidirectional, random access. b. Random access, forward, bidirectional, input/output. c. Bidirectional, forward, random access, input/output. d. Input/output, bidirectional, forward, random access.

a. Input/output, forward, bidirectional, random access.

8.2 Q1: Given that v1 and v2 are vectors, the function call std::equal( v1.begin(), v1.end(), v2.begin() ) returns: a. A bool indicating whether v1 and v2 are equal. b. A bool indicating whether the first element of v1, the last element of v1 and the first element of v2 are all equal. c. An iterator pointing to the first location where v1 and v2 are equal. d. An iterator pointing to the first location where v1 and v2 are not equal.

: a. A bool indicating whether v1 and v2 are equal.

5 Q1: The line: virtual double earnings() const = 0; appears in a class definition. You cannot deduce that: a. All classes that directly inherit from this class will override this method. b. This class is an abstract class. c. Any concrete class derived from this class will have an earnings function. d. This class will probably be used as a base class for other classes.

: a. All classes that directly inherit from this class will override this method.

5 Q2: Base class constructors and assignment operators: a. Are not inherited by derived classes. b. Should not be called by derived class constructors and assignment operators. c. Can be inherited by derived classes, but generally are not. d. Can call derived-class constructors and assignment operators.

: a. Are not inherited by derived classes.

6.4 Q1: If pairs is a map containing int keys and double associated values, the expression pairs[ 5 ] = 10: a. Associates the value 10.0 to the key 5 in pairs. b. Associates the value 5.0 to the key 10 in pairs. c. Associates the value associated with key 10 to key 5 in pairs. d. Associates the value associated with key 5 to key 10 in pairs.

: a. Associates the value 10.0 to the key 5 in pairs. Section

5 Q3: Suppose class A inherits from base class B. What is the order in which their constructors and destructors will be called when an object of class A is instantiated and then destroyed? a. B constructor, A constructor, A destructor, B destructor. b. B constructor, A constructor, B destructor, A destructor. c. A constructor, B constructor, A destructor, B destructor. d. A constructor, B constructor, B destructor, A destructor.

: a. B constructor, A constructor, A destructor, B destructor. Section

5 Q1: When an object of a derived class is instantiated, the __________ constructor initializes the _________ members. a. Base class, base class. b. Derived class, base class. c. Base class, derived class. d. Derived class, public.

: a. Base class, base class.

7 Q2: Which of the following is true about using inheritance in software engineering? a. Common attributes and behaviors should be factored out of closely related classes and placed into a base class from which the original classes can now inherit. b. It is best to create a huge class library to make it easy for a client to find the most appropriate class for his or her needs. c. A class produced through inheritance should be as large as possible to fully encompass all of the functionality it should offer. d. The standard C++ libraries that are shipped with C++ compilers are usually enough to accomplish anything an application might need to do.

: a. Common attributes and behaviors should be factored out of closely related classes and placed into a base class from which those original classes can inherit.

5 Q4: Which of the following is not allowed? a. Objects of abstract classes. b. Multiple pure virtual functions in a single abstract class. c. References to abstract classes. d. Arrays of pointers to abstract classes.

: a. Objects of abstract classes. Section

8.5 Q2: The for_each function applies a general function to each element in the specified range. This general function should: a. Take an argument of the elements' type and return nothing. b. Take an argument of the elements' type and return a value of the elements' type. c. Take an argument of a non-const reference to the elements' type and return nothing. d. Take an argument of a non-const reference to the elements' type and return a value of the elements' type.

: a. Take an argument of the elements' type and return nothing. Section

6 Q1: What mistake prevents the following class declaration from functioning properly as an abstract class? class Shape { public: virtual double print() const; double area() const { return base * height; } private: double base; double height; }; a. There are no pure virtual functions. b. There is a non-virtual function. c. private variables are being accessed by a public function. d. Nothing, it functions fine as an abstract class.

: a. There are no pure virtual functions. Section

7.2 Q1: Which of the following is a not a member function of queue? a. enqueue b. pop c. empty d. size

: a. enqueue Section

6.1 Q2: Part of the functionality of member function _________ can be performed by member function lower_bound. a. equal_range b. find c. count d. insert

: a. equal_range Section

8.1 Q1: The easiest way to set all the values of a vector to zero is to use function: a. fill b. fill_n c. generate d. generate_n

: a. fill

8.1 Q2: Which of the following function calls is a valid way to place elements into vector< char > chars? a. std::fill( chars.begin(), chars.end(), '5' ); b. std::fill_n( chars.begin(), chars.end(), '5' ); c. std::generate( chars.begin(), 10, '5' ); d. std::generate_n( 10, chars.end(), '5' );

: a. std::fill( chars.begin(), chars.end(), '5' );

8.8 Q2: Function template back_inserter returns: a. A container. b. An iterator for a container. c. An element in a container. d. A reference to an element in a container.

: b. An iterator for a container. Section

5 Q2: Which of the following applications would a deque not be well suited for? a. Applications that require frequent insertions and deletions at the front of a container. b. Applications that require frequent insertions and deletions in the middle of a container. c. Applications that require frequent insertions and deletions at the back of a container. d. Applications that require frequent insertions and deletions at the front and at the back of a container.

: b. Applications that require frequent insertions and deletions in the middle of a container.

3.2 Q1: Which of the following assignments would be a compilation error? a. Assigning the address of a base-class object to a base-class pointer. b. Assigning the address of a base-class object to a derived-class pointer. c. Assigning the address of a derived-class object to a base-class pointer. d. Assigning the address of a derived-class object to a derived-class pointer.

: b. Assigning the address of a base-class object to a derived-class pointer. Section

7.3 Q1: Which of the following statements is true of a priority_queue? a. It does not allow insertions in sorted order. b. Each of its common operations is implemented as an inline function. c. A bucket sort is usually associated with it. d. It must be implemented as a deque.

: b. Each of its common operations is implemented as an inline function. Section

7 Q1: An abstract class will: a. Have all zeros in its vtable. b. Have at least one 0 in its vtable. c. Share a vtable with a derived class. d. Have fewer 0's in its vtable than concrete classes have.

: b. Have at least one 0 in its vtable.

7 Q3: The C++ compiler makes objects take up more space in memory if they: a. Are derived from base classes. b. Have virtual functions. c. Have only protected members. d. Are referenced by pointers.

: b. Have virtual functions.

Q2: ( *max )( num1, num2, num3 );: a. Is the header for function max. b. Is a call to the function pointed to by max. c. Is the prototype for function max. d. Is a declaration of a pointer to a function called max.

: b. Is a call to the function pointed to by max.

7 Q1: Theoretically, clients do not need to see the _________ of classes from which they derive other classes. a. Header files. b. Source code. c. Object code. d. Interface.

: b. Source code.

5.1 Q2: The erase member function of class vector cannot: a. Specify an element to be removed from the vector. b. Specify a value to be removed from the vector. c. Specify a range of elements to be removed from the vector. d. Be called by member function clear.

: b. Specify a value to be removed from the vector. Section

8.9 Q1: If v1 is a vector< int > containing some number of int elements sorted in ascending order, after these statements execute: std::vector< int > results1; std::vector< int > results2; std::unique_copy( v1.begin(), v1.end(), std::back_inserter( results1 ) ); std::reverse_copy( v1.begin(), v1.end(), std::back_inserter( results2 ) ); which of the following could be true? a. results1 contains more elements than results2. b. The first element in results1 matches the last element in results2. c. results1 is empty but results2 is not. d. None of the above.

: b. The first element in results1 matches the last element in results2. Section

8.1 Q3: Which of the following is a valid generator function prototype for use with generate or generate_n on a vector< char >? a. void nextLetter(); b. char nextLetter(); c. char nextLetter( char ); d. char nextLetter( int );

: b. char nextLetter(); Section

8.5 Q1: Which of the following is not a mathematical algorithm included in the STL? a. min_element b. copy c. transform d. accumulate

: b. copy

9 Q1: virtual destructors must be used when: a. The constructor in the base class is virtual. b. delete is used on a base-class pointer to a derived-class object. c. delete is used on a derived-class object. d. A constructor in either the base class or derived class is virtual.

: b. delete is used on a base-class pointer to a derived-class object.

8.6 Q1: The easiest way to search through a list of names and output the first one that begins with a vowel would be to use function: a. find b. find_if c. sort d. binary_search

: b. find_if

5 Q3: Which of the following is not a member function of all sequence containers? a. front b. middle c. back d. pop_back

: b. middle Section

8.10 Q1: The __________ function would produce the sequence 1, 5, 6 when passed the sequences 1, 2, 3, 4, 5, 6 and 2, 3, 4, 7 as first/second and third/fourth arguments, respectively. a. set_intersection b. set_difference c. set_union d. set_symmetric_difference

: b. set_difference

1 Q1: Polymorphism is implemented via: a. Member functions. b. virtual functions and dynamic binding. c. inline functions. d. Non-virtual functions.

: b. virtual functions and dynamic binding. Section

8.2 Q2: Function mismatch returns: a. The position number where the two specified sequences do not match. b. A pair containing the two elements in the specified sequences that do not match. c. A pair containing two iterators pointing to the two locations in the specified sequences that do not match. d. A bool indicating whether the two specified sequences do not match.

: c. A pair containing two iterators pointing to the two locations in the specified sequences that do not match. Section

4 Q1: Assuming the definition, class BasePlusCommissionEmployee : public CommissionEmployee which of the following is false? a. The colon ( : ) in the header of the class definition indicates inheritance. b. The keyword public indicates the type of inheritance. c. All the public and protected members of class BasePlusCommissionEmployee are inherited as public and protected members, respectively, into class CommissionEmployee. d. CommissionEmployee is the base class and BasePlusCommissionEmployee is the derived class.

: c. All the public and protected members of class BasePlusCommissionEmployee are inherited as public and protected members, respectively, into class CommissionEmployee.

8 Q2: Run-time type information can be used to determine: a. A function's return type. b. A function's argument type. c. An object's type. d. The number of arguments a function takes.

: c. An object's type.

3.4 Q2: virtual functions must: a. Be overridden in every derived class. b. Be declared virtual in every derived class. c. Be declared virtual in the base class. d. Have the same implementation in every derived class.

: c. Be declared virtual in the base class.

8.14 Q2: Functions partial_sum and partial_sort are similar in that: a. Both perform their tasks on only part of a sequence and never the whole sequence. b. Both take two iterators as arguments. c. Both are overloaded to take a binary function as an extra argument. d. None of the above.

: c. Both are overloaded to take a binary function as an extra argument. Section

5.3 Q2: Unlike a vector, a deque: a. Provides efficient insertion and deletion only at its front. b. Does not provide indexed access with the subscript operator. c. Is not stored in contiguous memory. d. Cannot store as many different data types.

: c. Is not stored in contiguous memory. Section

3.3 Q1: Downcasting enables: a. A derived-class object to be treated as a base-class object. b. A base-class object to be treated as a derived-class object. c. Making a base-class pointer into a derived-class pointer. d. Making a derived-class pointer into a base -class pointer.

: c. Making a base-class pointer into a derived-class pointer. Section

2 Q1: Which of the following statements about polymorphism is false? a. With polymorphism, you can direct a variety of objects to behave in manners appropriate to those objects without even knowing their types. b. With polymorphism, new types of objects that can respond to existing messages can easily be incorporated into a system without modifying the base system. c. Polymorphism enables you to deal in specifics and let the execution-time environment concern itself with the generalities. d. To get polymorphic behavior among existing objects, those objects must be instantiated from classes in the same inheritance hierarchy.

: c. Polymorphism enables you to deal in specifics and let the execution-time environment concern itself with the generalities. Actually, the reverse is true. Section

7 Q2: Concrete classes that inherit virtual functions but do not override their implementations: a. Have vtables which are the same as those of their base classes. b. Receive their own copies of the virtual functions. c. Receive pointers to their base classes' virtual functions. d. Receive pointers to pure virtual functions.

: c. Receive pointers to their base classes' virtual functions.

8.7 Q1: Functions iter_swap and swap_ranges are similar in that both: a. Swap a range of elements. b. Take two arguments. c. Take forward iterators as arguments. d. Can only swap elements within the same array or container.

: c. Take forward iterators as arguments. Section

5 Q3: The main difference between a pure virtual function and a virtual function is: a. The return type. b. The member access specifier. c. That a pure virtual function cannot have an implementation. d. The location in the class.

: c. That a pure virtual function cannot have an implementation.

5.1 Q1: Which of the following is a difference between vectors and arrays? a. Access to any element using the [] operator. b. Stored in contiguous blocks of memory. c. The ability to change size dynamically. d. Efficient direct access to any element.

: c. The ability to change size dynamically.

3.4 Q3: Which of the following statements about virtual functions is false? a. They allow the program to select the correct implementation at execution time. b. They can use either static or dynamic binding, depending on the handles on which the functions are called. c. They do not remain virtual down the inheritance hierarchy. d. They can be called using the dot operator.

: c. They do not remain virtual down the inheritance hierarchy. Section

7.1 Q1: To pop an element off the top of a stack for processing: a. Use member function top. b. Use member function pop. c. Use member function top and then member function pop. d. Use member function pop and then member function top.

: c. Use member function top and then member function pop. Section

6 Q2: Data loss could occur if the contents of a __________ were placed into any of the other three associative container types. a. multiset. b. set. c. multimap. d. map.

: c. multimap. Section

6 Q2: When deriving a class from a protected base class, the public members of the base class become _________ and the protected members of the base class become __________? a. protected, private b. public, private c. protected, protected d. public, protected

: c. protected, protected Section

5.2 Q2: Which of the following is not a member function of all sequence containers? a. front b. back c. push_front d. push_back

: c. push_front Section

8.14 Q1: The difference between functions partition and stable_partition is that: a. partition may throw an exception while stable_partition will not. b. partition can only be called on a sequence that is already sorted. c. stable_partition maintains the original order for the elements in each of the two resulting partitions with respect to the other elements in that same partition. d. stable_partition allows an element to be duplicated and placed into both partitions.

: c. stable_partition maintains the original order for the elements in each of the two resulting partitions with respect to the other elements in that same partition.

8.8 Q1: Which of the following statements produces the same results as the statement: std::copy( v1.begin(), v1.end(), v2.begin() ); if v1 and v2 are both 10-element vectors? a. std::copy_backward( v1.begin(), v1.end(), v2.begin() ); b. std::copy_backward( v2.begin(), v2.end(), v1.begin() ); c. std::copy_backward( v1.begin(), v1.end(), v2.end() ); d. std::copy_backward( v2.begin(), v2.end(), v1.end() );

: c. std::copy_backward( v1.begin(), v1.end(), v2.end() );

8.12 Q1: Attributes of a heap do not include: a. Having the largest element at the top of the heap. b. Having a binary-tree structure. c. The children of a given node are less than or equal to the parent node's value. d. A preference to pop, rather than push, elements in the heap.

: d. A preference to pop, rather than push, elements in the heap.

5.3 Q1: Class deque provides: a. Efficient indexed access to its elements. b. The ability to add storage at either end of the deque. c. Efficient insertion and deletion operations at the front and back of a deque. d. All of the above.

: d. All of the above.

5 Q2: Abstract classes: a. Contain at most one pure virtual function. b. Can have objects instantiated from them if the proper permissions are set. c. Cannot have abstract derived classes. d. Are defined, but the programmer never intends to instantiate any objects from them.

: d. Are defined, but the programmer never intends to instantiate any objects from them.

5.2 Q1: The list sequence container does not: a. Efficiently implement insert and delete operations anywhere in the list. b. Use a doubly linked list. c. Support bidirectional iterators. d. Automatically sort inserted items.

: d. Automatically sort inserted items.

6.3 Q1: The expression std::multimap< int, double, std::less< int > >::value_type( 15, 2.7 ): a. Creates an empty multimap object. b. Creates a multimap object containing one key/value pair. c. Returns the number of times the key/value pair ( 15, 2.7 ) appears in the multimap. d. Creates a pair object in which first is 15 (type int) and second is 2.7 (type double).

: d. Creates a pair object in which first is 15 (type int) and second is 2.7 (type double). Section

8 Q4: dynamic_cast is often used to: a. Perform type checking for objects. b. Convert pointers to strings. c. Upcast pointers. d. Downcast pointers.

: d. Downcast pointers. Section

7 Q1: Select the false statement. Container adapters: a. Do not provide the actual data structure implementation for elements to be stored. b. Have their data stored by underlying data structures. c. Can push and pop elements. d. Have limited iterator support.

: d. Have limited iterator support. Section

6 Q1: The main difference between set and multiset is: a. Their interface. b. That one deals with keys only, and the other deals with key/value pairs. c. Their efficiency. d. How they handle duplicate keys.

: d. How they handle duplicate keys.


Conjuntos de estudio relacionados

comp sci Unit 6 plus review questions (REVIEW THIS ONE BEFORE TESTS)

View Set

Psychology of death and loss (456) Chapter 2 quiz

View Set

Chemistry but it's getting hot in here

View Set

Part 2 Quiz: Condominium Ownership

View Set

PEDIATRIC SUCCESS GASTROINTESTINAL DISORDERS CHAPTER 8

View Set

COMM 169 Quiz 3 (stem questions)

View Set