CRC CISP 400 C++ Quiz 10

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Iterators are similar to pointers because of the: 1. * and ++ operators. 2. -> operator. 3. begin and end functions. 4. & operator.

1. * and ++ operators.

Which file open mode would be used to write data only at the end of an existing file? 1. ios::app 2. ios::in 3. ios::out 4. ios::trunc

1. ios::app

A random access file is organized most like a(n): 1. Array. 2. Object. 3. Class. 4. Pointer.

1. Array.

Select the false statement. The reinterpret_cast operator: 1. Changes the value of the object to which its operand points. 2. Performs its operation at compile time. 3. Is compiler-dependent and can cause programs to behave differently on different platforms. 4. Is easy to use to perform dangerous manipulations that could lead to serious execution-time errors.

1. Changes the value of the object to which its operand points.

Which category of iterators combines the capabilities of input and output iterators into one iterator? 1. Forward iterators. 2. Bidirectional iterators. 3. Random access iterators. 4. Input/output iterators.

1. Forward iterators.

Which of the following is not an Standard Library container type? 1. Second-class containers. 2. Sequence containers. 3. Associative containers. 4. Container adapters.

1. Second-class containers.

Part of the functionality of member function ________ can be performed by member function lower_bound. 1. equal_range 2. find 3. count 4. insert

1. equal_range

Which of the following applications would a deque not be well suited for? 1. Applications that require frequent insertions and deletions at the front of a container. 2. Applications that require frequent insertions and deletions in the middle of a container. 3. Applications that require frequent insertions and deletions at the back of a container. 4. Applications that require frequent insertions and deletions at the front and at the back of a container.

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

Select the false statement. 1. C++ imposes no structure on a file. 2. C++ files include information about their structure. 3. The programmer must impose a structure on a file. 4. C++ files do not understand notions such as "records" and "fields."

2. C++ files include information about their structure.

Which of the following statements is true of a priority_queue? 1. It does not allow insertions in sorted order. 2. Each of its common operations is implemented as an inline function. 3. A bucket sort is usually associated with it. 4. It must be implemented as a deque.

2. Each of its common operations is implemented as an inline function.

The erase member function of class vector cannot: 1. Specify an element to be removed from the vector. 2. Specify a value to be removed from the vector. 3. Specify a range of elements to be removed from the vector. 4. Be called by member function clear.

2. Specify a value to be removed from the vector.

Which of the following is not a sequence container provided by the Standard Library? 1. vector 2. array 3. list 4. deque

2. array

Select the proper object type. ________ file( "file.dat", ios::in | ios::out ); 1. iostream 2. fstream 3. ofstream 4. ifstream

2. fstream

What is not true about this code segment? location = fileObject.tellg(); 1. tellg is a member function of fileObject. 2. location is a pointer. 3. The value of location after the segment executes must be less than or equal to the number of bytes in the file attached to fileObject. 4. fileObject is an istream object.

2. location is a pointer.

Which of the following is not a member function of all sequence containers? 1. front 2. middle 3. back 4. pop_back

2. middle

Which of the following bitset member functions cannot be called with an empty argument list? 1. reset 2. test 3. size 4. none

2. test

A Standard Library algorithm cannot: 1. Return an iterator. 2. Take two iterators as arguments to specify a range. 3. Access Standard Library members directly. 4. Be used with containers that support more powerful iterators than the minimum requirements for the algorithm.

3. Access Standard Library members directly.

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

3. Is not stored in contiguous memory.

When used with ofstream objects, operator! is not: 1. Overloaded. 2. Used to determine if the open operation succeeded. 3. Used to close a file explicitly. 4. Used to return a nonzero value if an error occurs.

3. Used to close a file explicitly.

Which of the following statements is true? 1. When opening a file, you can specify the name of the file only as a pointer-based string. 2. When opening a file, you can specify the name of the file only as a string object. 3. When opening a file, you can specify the name of the file as either a pointer-based string or a string object. 4. None of these.

3. When opening a file, you can specify the name of the file as either a pointer-based string or a string object.

Which bitset function could be used to create the logical not of a bitset object b? 1. b.set() 2. b.reset() 3. b.flip() 4. b.none()

3. b.flip()

Which of the following is not a member function of all sequence containers? 1. front 2. back 3. push_front 4. push_back

3. push_front

In order to perform file processing in C++, which header files must be included? 1. <cstdio> , <iostream> and <fstream>. 2. <cstdio> and <iostream>. 3. <cstdio> and <fstream>. 4. <iostream> and <fstream>.

4. <iostream> and <fstream>.

Which of the following does not have a stream associated with it? 1. cerr. 2. cin. 3. cout. 4. All of these have streams associated with them.

4. All of these have streams associated with them.

Class deque provides: 1. Efficient indexed access to its elements. 2. The ability to add storage at either end of the deque. 3. Efficient insertion and deletion operations at the front and back of a deque. 4. All of these.

4. All of these.

The list sequence container does not: 1. Efficiently implement insert and delete operations anywhere in the list. 2. Use a doubly linked list. 3. Support bidirectional iterators. 4. Automatically sort inserted items.

4. Automatically sort inserted items.

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

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

Select the false statement. Container adapters: 1. Do not provide the actual data structure implementation for elements to be stored. 2. Have their data stored by underlying data structures. 3. Can push and pop elements. 4. Have limited iterator support.

4. Have limited iterator support.

The main difference between set and multiset is: 1. Their interface. 2. That one deals with keys only, and the other deals with key/value pairs. 3. Their efficiency. 4. How they handle duplicate keys.

4. How they handle duplicate keys.

Which of the following is not a disadvantage of trying to modify a sequential access file? 1. Modifying data can potentially destroy other data. 2. It may be necessary to rewrite every record in the file to make a slight change. 3. Things that are stored in the same number of "raw data" bytes internally may not take up the same amount of space in a file. 4. Overwriting a record with another record of the same size is very difficult.

4. Overwriting a record with another record of the same size is very difficult.

Which of the following is not a key component of the Standard Library? 1. Containers. 2. Iterators. 3. Algorithms. 4. Pointers.

4. Pointers.

Which of the following will not change the file-position pointer to the same position as the others? Assume a 10-byte file size and a current position at byte # 1. 1. fileObject.seekg( 2 ); 2. fileObject.seekg( 1, ios::cur ); 3. fileObject.seekg( 2, ios::beg ); 4. fileObject.seekg( 8, ios::end );

4. fileObject.seekg( 8, ios::end );

Which of the following is not true about files? 1. C++ views each file as a sequential stream of bytes. 2. Files are opened by creating objects of stream classes. 3. Member functions of stream objects can be applied to file streams. 4. istream, ostream and iostream are derived from ifstream, ofstream and fstream, respectively.

4. istream, ostream and iostream are derived from ifstream, ofstream and fstream, respectively.


संबंधित स्टडी सेट्स

Chapter 4 - Internet Security (Q&A)

View Set

Chapter 12 The benefit determination process

View Set

Dichotomous key major types of fruits

View Set

Study guide 4 2nd part of psychology final

View Set

Psychology B: What is Psychotherapy? Quiz

View Set

ECON 101: Microeconomics Exam #3

View Set