• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/114

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

114 Cards in this Set

  • Front
  • Back

A bit field must be declared as a:

int or unsigned

Which of the following correctly copies the contents of string2 into string1? Assume that string2 is equal to "goodbye" and string1is equal to "good morning"?

strcpy( string1, string2 );

The main difference between structures and classes is:

A colon as in bitfield : 4

Structure variable declarations can be incorporated into a structure definition by placing a comma-separated list of variable names:

After the right brace and before the semicolon.

Assuming that string1 = "hello" and string2 = "hello world", which of the following returns 0?

Strncmp( string1, string2, 5 );

To change the string "ABCDEFGHI" to "aaaaaFGHI" you would use the ________ function.

memset

The strtol and stroul functions do not:

Have the same return types.

________ is not allowed.

Accessing individual bits in a multi-bit bit field

typedef is used to:

Create a type name that is an alias for another type name.

A merge sort operation runs in:

O(n log n) time.

Which of the following statements about searching algorithms and their efficiency is false?

Big O notation is one way to describe how likely it is that a searching algorithm will find its target.

Which of the following represents the efficiency of the insertion sort?

O(n2)

Selection sort has a Big O of:

O(n2)

An algorithm that requires ________ operations to complete its task on n data elements is said to have linear runtime.

2 n + 1

The function call string1.erase( 5 ) will:

Erase all characters starting from and including the character in position 5 to the end of string1

Which of the following cannot be used to concatenate strings?

assign

Which of the following is not an argument of the assign member function?

The end location.

Which of the following searches through a string object from right-to-left?

find_last_of

Which function changes the actual string stored in the string object (i.e., is not a const member function)?

resize

What is the code for a loop that iterates from the end of a string toward the beginning?

srend


i--

Which of the following is false?

c_str returns a character array of the same length as the string object it is called on.

What type of value is returned by the overloaded equality and relational operators for strings?

bool

Class string has member function ________ to interchange the data stored in two string objects.

swap

All of the following are true of an ostringstream object except that:

A stream insertion operation cannot be used to append additional data to it.

Which of the following does not apply to an istringstream object?

Data in a string can be appended to it.

Which of the following is not overloaded for strings?

-=

Which of the following returns a bool?

empty

The arguments passed to replace do not include:

The subscript of the element where the replace operation ends.

Class templates:

Must put template< typename Type > before the class definition.

A function template can be overloaded by:

Using non-template functions with the same name and different parameters.

Assuming that all four of the following functions are defined, which one will be called by the function call square( 23.4 )?

double square( double num )

Nontype parameters are:

Constants.

If you have a 1000-element balanced binary search tree, what is the maximum number of comparisons that may be needed to find an element in the tree?

10

For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtr is a pointer to the new node to be added and lastPtr is a pointer to the current last node. Each node contains a pointer nextPtr.

lastPtr->nextPtr = newPtr; lastPtr = newPtr

A linked list has the functions insertAtFront, removeFromFront, insertAtBack and removeFromBack, which perform operations on nodes exactly as their names describe. Which two functions would most naturally model the enqueue and dequeue operations, respectively, of aqueue?

insertAtBack and removeFromFront

Which of the following statements about stacks is incorrect?

Stacks are first-in, first-out (FIFO) data structures.

Which of the following tasks would a binary search tree not be well suited for?

Reversing an unsorted sequence.

________ is not an advantage of linked lists when compared to arrays.

Direct access to any list element.

Which of the following is not a mathematical algorithm included in the Standard Library?

copy

The algorithms in the Standard Library:

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

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.

set_symmetric_difference

Which algorithm cannot take a predicate function as an argument?

find

The easiest way to set all the values of a vector to zero is to use function:

fill

Functions lower_bound, upper_bound and equal_range are different in their:

Return types.

Which of the following is not true of a class that will be used to instantiate function objects?

All of these are true about a class that will be used to instantiate function objects.

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

set_difference

Lambdas begin with the lambda introducer ________, followed by a parameter and function body.

[]

Sorting a preexisting sequence of n elements can be accomplished with the heapsort algorithm by:

Calling make_heap on the entire sequence and then calling sort_heap on the entire sequence.

Attributes of a heap do not include:

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

Given that v1 and v2 are vectors, what is returned by the function callstd::equal( v1.begin(), v1.end(), v2.begin() )

A bool indicating whether v1 and v2 are equal.

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?

The first element in results1 matches the last element in results2.

The purpose of stack unwinding is to:

Attempt to catch exceptions that are not caught in their scope.

Select the false statement regarding exceptions.

All exception classes are accessible via .

Select the false statement. A rethrown exception:

Must have been fully processed at the time it was rethrown.

The correct order in which an exception is detected and handled is:

try, throw, catch

An exception:

Terminates the block where the exception occurred.

catch blocks are not required to contain:

A parameter name.

Once an exception is thrown, when can control return to the throw point?

Never.

Which of the following is not an STL container type?

Second-class containers.

Iterators are similar to pointers because of the:

* and ++ operators.

An STL algorithm cannot:

Access STL members directly.

Which of the following is not a sequence container provided by the STL?

array.

Which of the following applications would a deque not be well suited for?

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

The erase member function of class vector cannot:

Specify a value to be removed from the vector.

The list sequence container does not:

Automatically sort inserted items.

Which of the following is not a member function of all sequence containers?

push_front

Class deque provides:

All of the above.

The main difference between set and multiset is:

How they handle duplicate keys.

Data loss could occur if the contents of a __________ were placed into any of the other three associative container types.

multimap.

The multiset associative container does not:

Permit random access to its keys.

If a program attempts to insert a duplicate key into a set

The duplicate key will be ignored.

The expression std::multimap< int, double, std::less< int > >::value_type( 15, 2.7 ):

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

If pairs is a map containing int keys and double associated values, the expression pairs[ 5 ] = 10:

Associates the value 10.0 to the key 5 in pairs.

Select the false statement. Container adapters:

Have limited iterator support.

To pop an element off the top of a stack for processing:

Use member function top and then member function pop.

Which of the following is a not a member function of queue?

enqueue.

Which of the following statements is true of a priority_queue?

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

The algorithms in the STL:

Are implemented as member functions of the container classes.

The easiest way to set all the values of a vector to zero is to use function:

fill.

Given that v1 and v2 are vectors, the function call std::equal( v1.begin(), v1.end(), v2.begin() ) returns:

A bool indicating whether v1 and v2 are equal.

Mr. Smith has a shopping list stored in a vector. Today, Mrs. Smith decides that she will go get the items that cost less than 10 dollars. If Mr. Smith wants to give his wife a list of her own, he should use the function:

remove_copy_if.

The order of the arguments passed to function replace_copy_if must be:

InputIterator, InputIterator, OutputIterator, PredicateFunction, ReplacementValue

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:

find_if.

Functions iter_swap and swap_ranges are similar in that both:

Take forward iterators as arguments.

Which of the following statements produces identical results as the statement: std::copy( v1.begin(), v1.end(), v2.begin() );if v1 and v2 are both 10-element vectors?

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

Functions lower_bound, upper_bound and equal_range are different in their:

Return types.

Attributes of a heap do not include:

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

Which of the following bitset member functions cannot be called with an empty argument list?

test.

Function objects have their functions called by using:

operator().

Structure variable declarations can be incorporated into a structure definition by placing a comma-separated list of variable names:

After the right brace and before the semicolon

Two structure variables of the same type with the same member values, when compared will:

Result in a compile error.

Arrays are:

Passed by reference unless inside a structure.

typedef is used to:

Create a type name that is an alias for another type name.

The advantages of using typedef do not include:

Increasing the efficiency of accessing struct member variables.

Which is the proper way to create an array of structure variables of type Data?

Data MyArray[ 10 ];.

The most basic unit of data on a computer is the:

Bit.

Which of the following is not a bitwise operator?

*.

Let Bit1 = Bit2 = 1. Which of the following does not have the same result as the others?

Bit1 ^ Bit2.

Evaluate ( 00001000 & 11000101 ) ^ ( 11110000 )

11110000.

Let x be an unsigned int on a machine with 4-byte unsigned ints. What effect does x>>=1; x<<=1;have?

The rightmost bit of x is set to 0.

For any 8-bit x, which of the following does not result in zero?

x |= x.

A bit field must be declared as a:

int or unsigned.

The number of bits in a bit field is specified with:

A colon as in bitfield : 4.

__________ is not allowed.

Accessing individual bits in a multi-bit bit field

The number 4 typically takes up _________ bit(s) when stored as a character on most of today’s computers.

Eight.

The functions of the character-handling library typically manipulates characters as:

ints

The isxdigit function would return false on:

g

The strtol and stroul functions do not:

Have the same return types

The main difference between the functions atof, atoi and atol is:

Their return types.

Which function would be the most useful for determining if a certain word is contained in a string representing a sentence?

strstr.

What is the output of the following statement? cout << strspn("Cows like to moo.", "Ceik losw");

10.

The ___________ function allows characters of one part of a string to be copied into another, overlapping part of the same string.

memmove.

memcmp would return ___________ for the call memcmp("Hi, how are you?", "Hi, how are things?", 6).

0.

To change the string "ABCDEFGHI" to "aaaaaFGHI" you would use the _________ function.

memset.