CISP 400 Final Study Guide

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

[C++11] Which of the following statements is false?

C++11 added type char64_t to handle the new double-width Unicode characters.

[C++11]: Which of the following is true?

C++11 allows you to provide a default value for a data member when you declare it in the class declaration.

Which of the following is false?

C++11's long long type supports values in the range -2,147,483,647 to 2,147,483,647 as a minimum.

Using the following function definition, the parameter list is represented by: A B (C) { D }

C.

The operators that cannot be overloaded are _________, __________, ___________ and ___________.

., ?:, .*, and ::

A header file is typically given the filename extension:

.h

A class definition is typically stored in a file with the ________ filename extension.

.h.

The only integer that can be assigned directly to a pointer is _________.

0

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

0

What will be output by the following statements? double x{.0012345}; cout << fixed << x << endl; cout << scientific << x << endl;

0.001234 1.234500e-03

Assume that the function call operator() is overloaded for data type String in the usual sense of selecting a substring from a larger string. For a String object string1 with the character string "ABCDEFGHI", what string does string1(4, 2) return?

"EF"

Assuming that the string object text contains the string "Hello!!! ", the "expression text.substr( 2 , 5 ) would return a string object containing the string:

"ello".

If string s contains "antidisestablishmentarianism", then s.substr(7, 13) would be:

"establishment"

Which of the following preprocessor directives does not constitute part of the preprocessor wrapper?

#include

Assuming that GradeBook.h is found in the current directory and the iostream header file is found in the C++ Standard Library header file directory, which of the following preprocessor directives will fail to find its desired header file?

#include <GradeBook.h>

Any file that uses a class can include the class's header via a(n) ____________ preprocessing directive.

#include.

Assuming that t is an array and tPtr is a pointer to that array, which expression refers to the address of element 3 of the array?

&t[3]

To make numeric literals more readable, C++14 allows you to insert between groups of digits in numeric literals the digit separator ' (a single-quote character).

' (a single quote)

Which of the following is not a bitwise operator?

*

Iterators are similar to pointers because of the:

* and ++ operators.

Three of the following expressions have the same value. Which of the following expressions has a value different from the others'?

*ptr

Inside a function definition for a member function of an object with data member x, which of the following is not equivalent to this->x:

*this.x

Which of the following is not overloaded for strings?

-=

A function that modifies an array by using pointer arithmetic such as ++ptr to process every value of the array should have a parameter that is:

A nonconstant pointer to nonconstant data.

Function mismatch returns:

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

catch blocks are not required to contain:

A parameter name.

Which of the following statement is false?

A pointer-based string is a string object.

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 is false?

A string can be defined to store any data type.

Which of the following is false?

A subscript cannot be an expression.

Which of the following is not true of class template vector?

A vector can store only data of type int.

For an ifstream object A, a class type B and a local variable of type B called C, the proper way to read in one B object from A into C is:

A.read(reinterpret_cast<char*>(&C), sizeof(B));

A Standard Library algorithm cannot:

Access Standard Library members directly.

__________ is not allowed.

Accessing individual bits in a multi-bit bit field.

Which of the following tasks cannot be performed using a range-based for loop?

Accessing the element's subscript.

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.

The line: virtual double earnings() const = 0; appears in a class definition. You cannot deduce that:

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

Select the false statement regarding exceptions.

All exception classes are accessible via <exception>.

Exception handling may allow a program to:

All of the above

[C++11]: Assuming the following constructor is provided for class Time explicit Time( int = 0, int = 0, int = 0 ); which of the following is not a valid way to initialize a Time object?

All of the above are all valid ways to initialize a Time object.

Which of the following is not a category of the Standard Library algorithms?

All of the above are categories of the Standard Library Algorithms.

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?

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

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

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

Which of the following is not a valid runtime description according to Big O notation?

All of the above are valid.

Which of the following does not have a stream associated with it?

All of the above have streams associated with them.

Which of the following does not declare a 2-by-2 array and set all four of its elements to 0?

All of the above initialize all four of the array elements to 0.

Which of the following statements about regular expressions is true?

All of the above statements are true.

[C++14] : Which of the following statements is false?

All of the above statements are true.

Class deque provides:

All of the above.

Random access files are more effective than sequential files for:

All of the above.

Which of the following data types can be used to represent integers?

All of the above.

Which of the following does counter-controlled iteration require?

All of the above.

[C++11]: Which of the following statements initializes the unsigned int variable counter to 10?

All of the above.

string iterators:

All of the above.

Which of the following outputs does not guarantee that the uppercase flag has been set?

All text outputs appear in the form SAMPLE OUTPUT.

Assuming the definition, class BasePlusCommissionEmployee : public CommissionEmployee which of the following is false?

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

Returning references to non-const, private data:

Allows private member variables to be modified, thus "breaking encapsulation."

[C++14]: Which of the following statements is false?

Always use C++11's versions of equal and mismatch - these are preferred because they compare the lengths of the ranges for you, eliminating a potential source of logic errors.

The type of function a client would use to check the balance of a bank account would be:

An access function.

How many times will the following loop print hello? i = 1; while (i <= 10) { cout << "hello"; }

An infinite number of times.

Function template back_inserter returns:

An iterator for a container.

An error occurs if:

An object data member is not initialized in the member initialization list and does not have a default constructor.

Run-time type information can be used to determine:

An object's type.

Using a while loop's counter-control variable in a calculation after the loop ends often causes a common logic error called:

An off-by-one error.

[C++11]—Which of the following statements is false?

An unscoped enum's underlying type is independent of its constants' values but is guaranteed to be large enough to store those values.

Linear search can be used on:

Any of the above.

The good member function will return false if:

Any of the above.

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.

Abstract classes:

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

Base class constructors and assignment operators:

Are not inherited by derived classes.

Utility functions:

Are private member functions that support operations of the class's other member functions.

What is the name of the values the method call passes to the method for the parameters?

Arguments.

Which of the following is not a dynamic data structure?

Array

A random access file is organized most like a(n):

Array.

Exception handling should not be used:

As an alternative for program control.

float and double variables should be used:

As approximate representations of decimal numbers

Default type parameters are allowed only:

As the rightmost (trailing) parameters in a template's type-parameter list.

Which of the following assignments would be a compilation error?

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

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.

The list sequence container does not:

Automatically sort inserted items.

In order to calculate the __________ of an array of values, the array values must first be summed.

Average.

When an object of a derived class is instantiated, the __________ constructor initializes the _________ members.

Base class, base class.

The line: virtual double functionX() const = 0; in a class definition indicates that the class is probably a:

Base class.

Select the false statement regarding inheritance.

Base classes are usually more specific than derived classes.

Which of the following statement is true?

Base-class constructors are not automatically inherited by derived classes.

Which statement is false?

Based on whether an operator is implemented as a member function or as a non-member function, the operator is used differently in expressions.

virtual functions must:

Be declared virtual in the base class.

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.

For operators overloaded as non-static member functions:

Binary operators can have one argument, and unary operators cannot have any.

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

Bit.

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

Bit1 ^ Bit2

Variables defined inside a member function of a class have:

Block scope.

Which of the following is true?

Both class templates and function templates may specify default type arguments for type parameters.

A default constructor:

Both first and second choice.

To prevent class objects from being copied:

Both first and second choice.

Which of the following is not true about setw and width?

Both of them can perform two tasks, setting the field width and returning the current field width.

To execute multiple statements when an if statement's condition is true, enclose those statements in a pair of:

Braces, { }.

Which of the following statements is false?

Businesses using cloud computing services must still manage the applications, which can be costly.

Which of the following is not a valid way to pass arguments to a function in C++?

By value with pointer arguments

Which of the following statements is not true about C++ input/output (I/O) features?

C++ borrowed its type safe I/O capabilities from C.

Which of the following is false?

C++ ensures that you cannot "walk off" either end of an array.

[C++11]: Which of the following statements is false?

C++11 added the keyword using as another mechanism for creating type aliases. The following declaration is equivalent to the typedef in second choice above: using Card* = CardPtr;

Which is the proper way to create a built-in array of structure variables of type Data?

Data MyArray[10];

Attributes of a class are also known as:

Data members.

There exists a data type Date with member function Increment that increments the current Date object by one. The ++ operator is being overloaded to postincrement an object of type Date. Select the correct implementation:

Date Date::operator++(int) { Date temp{*this}; Increment(); return temp; }

Pseudocode normally does not include:

Declarations.

[C++11]: To prevent class objects from being copied or assigned, you can:

Declare as private the class's copy constructor and overloaded assignment operator or declare the class's copy constructor and overloaded assignment operator with with = delete after the parameter list.

The function prototype double mySqrt(int x);

Declares a function called mySqrt which takes an integer as an argument and returns a double.

Which of the following statements will not produce a syntax error?

Declaring an object to be const.

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

Direct access to any list element.

The algorithms in the Standard Library:

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

When an argument is passed-by-value, changes in the called function __________ affect the original variable's value; when an argument is passed call-by-reference, changes in the called function __________ affect the original variable's value.

Do not, do.

The stream-extraction operator:

Does not normally accept white-space characters.

Every object of the same class:

Gets a copy of every member variable.

Which of the following statements is false?

Global Positioning System (GPS) devices a single satellite to retrieve location-based information.

An abstract class will:

Have at least one zero function pointer in its vtable.

static data members of a certain class:

Have class scope.

Select the false statement. Container adapters:

Have limited iterator support.

Iterators do not:

Have range checking.

The strtol and stroul functions do not:

Have the same return types.

The C++ compiler makes objects take up more space in memory if they:

Have virtual functions.

Each standard library has a corresponding:

Header.

Which is the output of the following statements? std::cout << "Hello "; std::cout << "World";

Hello World

The choice of which sorting algorithm to use does not affect:

How sorted the vector will be

The main difference between set and multiset is:

How they handle duplicate keys.

Which of the following statement is true?

If a base class declares a pure virtual function, a derived class must implement that function to become a concrete class.

Problems using switch logic to deal with many objects of different types do not include:

Not being able to implement separate functions on different objects.

A merge sort operation runs in:

O(n log n) time.

Selection sort has a Big O of:

O(n^2)

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

O(n^2)

Which of the following is not allowed?

Objects of abstract classes

Which of the following statement is true?

One of the most common uses of a deque is to maintain a first-in, first-out queue of elements. In fact, a deque is the default underlying implementation for the queue adaptor.

What does the following statement declare? int *countPtr, count;

One pointer to an int and one int variable.

For a class template, the scope resolution operator (::) is needed:

Only in the definitions of the member functions defined outside the class.

Which forms of inheritance are is-a relationships?

Only public.

A copy constructor must receive its argument by reference because:

Otherwise infinite recursion occurs.

Arrays are:

Passed by reference unless inside a structure.

To reset the format state of the output stream:

Save a copy of the fmtflags value returned by calling member function flags before making any format changes, and then call flags again with that fmtflags value as the argument.

In the source-code file containing a class's member function definitions, each member function definition must be tied to the class definition by preceding the member function name with the class name and ::, which is known as the:

Scope resolution operator.

Which of the following is not an Standard Library container type?

Second-class containers.

All programs can be written in terms of three types of control statements: _____________, ___________ and ___________.

Sequence, selection, iteration

What type of member functions allow a client of a class to assign values to private data members?

Set member functions.

The prototypes of overloaded cast operator functions do not:

Specify a return type.

Which of the following statements about stacks is incorrect?

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

Which of the following statement is false?

Standard Library algorithms are encapsulated as member functions within each container class.

The OR (||) operator:

Stops evaluation upon finding one condition to be true.

Which of the following is not a member function of the C++ ostream class?

Stream-extraction operator (>>).

Which of the following is false for pointer-based strings?

String literals are written inside of single quotes.

The capabilities of inputting and outputting strings in memory are known as:

String stream processing.

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

Strncmp(string1, string2, 5);.

The for_each function applies a general function to each element in the specified range. This general function should:

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

Functions iter_swap and swap_ranges are similar in that both:

Take forward iterators as arguments.

The array subscript operator [], when overloaded, cannot:

Take multiple values inside (e.g., [4,8]).

Upon encountering the designated delimiter character, the ignore member function will:

Terminate

An exception:

Terminates the block where the exception occurred.

The main difference between a pure virtual function and a virtual function is:

That a pure virtual function cannot have an implementation.

An example of a unary operator is:

The ! logical operator.

Which of the following statement is true?

The ++ operation on an iterator moves it to the container's next element.

To implicitly overload the += operator:

The += operator cannot be overloaded implicitly.

Which of the following operators cannot be overloaded?

The . operator.

________ is a graphical language that allows people who design software systems to use an industry stan¬dard notation to represent them.

The Unified Modeling Language

To prevent modification of a built-in array's values when you pass the built-in array to a function:

The built-in array parameter can be preceded by the const qualifier.

In the UML, the top compartment of the rectangle modeling a class contains:

The class's name.

Call-by-reference can achieve the security of call-by-value when:

The const qualifier is used.

Which of the following statement is false?

The container member function cbegin returns an iterator that refers to the container's first element.

Calling a member function of an object requires which item?

The dot operator.

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

The duplicate key will be ignored.

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

The end location.

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.

One difference between the three-argument version of the get function and the getline function is that:

The getline function removes the delimiter from the stream.

Which of the following statements is false?

The impressive functions performed by computers involve only the simplest manipulations of 1s and 2s.

Which situation would require the operator to be overloaded as a non-member function?

The left operand is an int.

Which of the following is not included in a function's activation record?

The name of the function.

The argument list of a function call must match, or be consistent with, the parameter list of the called function in all of the following details, except:

The names of arguments/parameters in the list.

Which of the following is not true about bool values and how they're output with the output stream?

The old style of representing true/false values used -1 to indicate false and 1 to indicate true.

Which of the following statements is true?

The ostream member function write can write to standard-output stream cout.

In a typical nested for loop (not a range-based for loop) used to process a two-dimensional array, following the end of each execution of the inner for loop:

The outer for loop increments its counter variable.

hat will be the output after the following C++ statements have been executed? int a{4}; int b{12}; int c{37}; int d{51}; if (a < b) { cout << "a < b" << endl; } if (a > b) { cout << "a > b" << endl; } if (d <= c) { cout << "d <= c" << endl; } if (c != d) { cout << "c != d" << endl; }

a < b c != d

The sequence containers and ____________ containers are collectively referred to as the firstclass containers.

associative

Which of the following provides bounds checking?

at

The size, shape, color and weight of an object are considered __________ of the object's class.

attributes

Which of the following is most likely a base class of the other three?

automobile.

A lambda function can capture local variables ________ and manipulate them inside the lambda's body.

by value or by reference.

Which of the following will not increment c by 1?

c + 1;

Which of the following statement is defining a constant variable arraySize to represent the size of an array and initialize it to 10?

const size_t arraySize{10};

A(n) ________________ should be used to declare the size of an array, because it eliminates magic numbers.

constant variable

When an object of a derived class is instantiated, the base class's _____________ is called implicitly or explicitly to do any necessary initialization of the base-class data members in the derived-class object.

constructor

Given the class definition: class CreateDestroy { public: CreateDestroy() {cout << "constructor called, ";} ~CreateDestroy() {cout << "destructor called, ";} }; What will the following program output? int main() { for (int i = 1; i <= 2; ++i) { CreateDestroy cd; } return 0; }

constructor called, destructor called, constructor called, destructor called,

The three key components of the "STL" portion of the Standard Library are _________, ________ and __________.

containers, iterators and algorithms

Which of the following is false?

continue and break statements may be embedded only within iteration statements.

A(n) _________ constructor initializes the container to be a copy of an existing container of the same type.

copy

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

copy

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 )

Which of the following statement is declaring a pointer nPtr that points to a variable of type double?

double* nPtr;

Which of the following statement is assigning the address of variable number1 to pointer variable doublePtr? Assume that double variables number1 and number2 have been declared and that number1 has been initialized to 7.3.

doublePtr = &number1;

Operator _________ can be used to downcast base-class pointers safely.

dynamic_cast

A nonmember function must be declared by the class as a(n) ___________ of a class to have access to that class's private data members.

friend.

To write fixed-length records, use file open mode:

ios::binary

In a(n) ___________ relationship, an object of a derived class also can be treated as an object of its base class.

is-a or inheritance (for public inheritance)

Input operations are supported by _________ class.

istream

Which of the following is not true about files?

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

Standard Library algorithms operate on container elements indirectly, using __________.

iterators

A tree node that has no children is called a(n) _________ node.

leaf

A(n) ________ begins the body of every function and a(n) _________ ends the body.

left brace ({), right brace (}).

The __________ and ___________ operators are used to shift the bits of a value to the left or to the right, respectively.

left-shift operator (<<), right-shift operator (>>)

The pointer to the next node in a linked list is referred to as a(n) ____________.

link

Which of the following is not included in <cmath>?

ln.

Variables are also known as:

lvalues, but can be used as rvalues.

The & operator can be applied to:

lvalues.

The three types of languages discussed in chapter 1 are ______________, __________________and ____________.

machine languages, assembly languages, high-level languages.

Every C++ program begins execution at the function _________ .

main.

The bitwise AND operator & is often used to ____________ bits (i.e., to select certain bits from a bit string while zeroing others).

mask

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

memmove

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

memset

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

middle

The C++11 ___________ algorithm locates both the smallest and largest elements in a range.

minmax_element

C++ provides for ___________ , which allows a derived class to inherit from many base classes, even if the base classes are unrelated.

multiple inheritance

Which of the following is not a valid C++ identifier?

my Value

Which of the following best describes the array name n in the declaration int n[10];?

n is a constant pointer to nonconstant data.

The operator ______ is used to dynamically allocate memory and construct an object; this operator returns a pointer to the object.

new

The operator ________ dynamically allocates memory for an object of a specified type and returns a(n) ________ to that type.

new, pointer

A member function should be static if it does not access ____________ class members.

non-static.

Pointers may be assigned which of the following values?

nullptr.

Member function _________ of the file streams fstream, ifstream and ofstream opens a file.

open

[C++11]:Which of the following is not a keyword that was added to C++ in the new C++11 standard?

operator

[C++11]: Overloaded operators can be used to test a stream's state in conditions. The operator! member function, inherited into the stream classes from class basic_ios, returns true if the badbit, the failbit or both are true. The ________ member function (added in C++11) returns false if the badbit is true, the failbit is true or both are true.

operator bool

Suppose a and b are integer variables and we form the sum a + b. Now suppose c and d are floating-point variables and we form the sum c + d. The two + operators here are clearly being used for different purposes. This is an example of __________________.

operator overloading

Function objects have their functions called by using:

operator()

The correct function name for overloading the addition (+) operator is:

operator+

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

push_front

Which of the following C++ statement is calculating the remainder after q is divided by divisor and assign the result to q?

q %= divisor;

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

swap

Polymorphism helps eliminate ___________ logic.

switch

Assume that t is an object of class Test, which has member functions a(), b(), c() and d(). If the functions a(), b() and c() all return references to an object of class Test (using the dereferenced this pointer) and function d() returns void, which of the following statements will not produce a syntax error:

t.a().b().d();

Which of the following functions would not be used to write data randomly to a random access file?

tellg

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

test

An object's non-static member functions have access to a "self pointer" to the object called the _________ pointer.

this

A(n) ___________ is a nonlinear, two-dimensional data structure that contains nodes with two or more links.

tree

When using exception handling, place any code that might throw an exception in a __________.

try statement.

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

try, throw, catch

An array that uses two subscripts is referred to as a(n) ________________ array.

two-dimensional

Keyword _______________ is used to create a synonym for a previously defined data type.

typedef

The __________ operator returns a reference to a __________ object:

typeid, type_info

If dynamic memory has been allocated for an object and an exception occurs, then:

A memory leak could result.

Which of the following statement is assigning the value 1.667 to array, fractions, element 9?

fractions[9] = 1.667;

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

ints

A class's functions can throw exceptions, such as __________to indicate invalid data.

invalid_argument

Which file open mode would be used to write data only at the end of an existing file?

ios::app

If string s1 is lexicographically greater than string s2, then the value returned by s2.compare(0, s2.size(), s1) must be?

A negative number.

What will be output by the following statements? double x{1.23456789}; cout << fixed; cout << setprecision(5) << x << endl; cout.precision(3); cout << x << endl; cout << x << endl;

1.23457 1.235 1.235

At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary search algorithm?

10

A stack is initially empty, then the following commands are performed: push 5 push 7 pop push 10 push 5 pop Which of the following is the correct stack after those commands (assume the top of the stack is on the left)?

10 5

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

10.

What will be output by the following statement? cout << showpoint << setprecision(4) << 11.0 << endl;

11.00

Evaluate (00001000 & 11000101) ^ (11110000).

11110000

A double subscripted array declared as array<array<int, 5>, 3> values; has how many elements?

15

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

2 n + 1

Given that k is an integer array starting at location 2000, kPtr is a pointer to k and each integer is stored in 4 bytes of memory, what location does kPtr + 3 point to?

2012

What value does function mystery return when called with a value of 4? int mystery (int number) { if (number <= 1) { return 1; } else { return number * mystery(number - 1); } }

24.

A queue performs the following commands (in pseudo-code): enqueue 4, 6, 8, 3, 1 dequeue three elements enqueue 3, 1, 5, 6 dequeue two elements What number is now at the front of the queue?

3

Assuming the following pseudocode for the Fibonacci series, what is the value of the 5th Fibonacci number (fibonacci (5))? fibonacci(0) = 0 fibonacci(1) = 1 fibonacci(n) = fibonacci(n - 1) + fibonacci(n - 2)

5.

C++11's unsigned long long int type (which can be abbreviated as unsigned long long) enables you to store values in at least ________, which can hold numbers as large as 18,446,744,073,709,551,615.

8 bytes (64 bits)

What is the final value of x after performing the following operations? int x{21}; double y{6}; double z{14}; y = x / z; x = 5.5 * y;

8.

A function that prints a string by using pointer arithmetic such as ++ptr to output each character should have a parameter that is:

A nonconstant pointer to constant data.

A class-scope variable hidden by a block-scope variable can be accessed by preceding the variable name with the class name followed by:

::

When a member function is defined outside the class definition, the function header must include the class name and the ________________, followed by the function name to "tie" the member function to the class definition.

:: scope resolution operator

Most C++ programs that do I/O should include the ___________header that contains the declarations required for all stream-I/O operations.

<iostream>

In order to perform file processing in C++, which header files must be included?

<iostream> and <fstream>.

Header ________ must be included for class string.

<string>

Which of the following is not an arithmetic operator?

=

[C++11] In C++11, you can tell the compiler to explicitly generate the default version of a default constructor, copy constructor, move constructor, copy assignment operator, move assignment operator or destructor by following the special member function's prototype with ________.

= default

Which of the following operators can be overloaded as a non-member function?

==

An operator that associates from right to left is:

?:

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

A bool indicating whether v1 and v2 are equal.

Which of the following statements about friend functions and friend classes is false?

A class can either grant friendship to or take friendship from another class using the friend keyword.

Which statement is false?

A class is an instance of its object.

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

A colon as in bitfield : 4

What method should be used to pass an array to a function that does not modify the array and only looks at it using array subscript notation:

A constant pointer to constant data.

A constructor can specify the return type:

A constructor cannot specify a return type.

Select the false statement. Depending on the compiler:

A failed new operation can automatically be caught at compile time.

A function prototype can always be omitted when:

A function is defined before it is first invoked.

The putback member function returns to the input stream the previous character obtained by:

A get from the input stream.

If a member function of a class already provides all or part of the functionality required by a constructor or another member function then:

Call that member function from this constructor or member function.

A recursive function is a function that:

Calls itself, directly or indirectly.

static member functions:

Can access only other static member functions and static data members.

Conversion constructors:

Can convert between user-defined types.

The delete [] operator:

Can delete an entire array of objects declared using new.

Function templates:

Can include objects of template classes as parameters.

Referencing elements outside the array bounds with the [] operator:

Can result in changes to the value of an unrelated variable.

strings:

Can use the subscript operator to access individual characters.

The total number of elements that can be stored in a string without increasing its current amount of allocated memory is called its:

Capacity

Select the false statement. The reinterpret_cast operator:

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

What kind of linked list begins with a pointer to the first node, and each node contains a pointer to the next node, and the pointer in the last node points back to the first node?

Circular, singly-linked list.

If the line: friend class A; appears in class B, and the line: friend class B; appears in class C, then:

Class A can access private variables of class B.

A string array is commonly used for:

Command-line arguments.

The first step performed by the binary search algorithm at each iteration is to:

Compare the search key with the middle element in the current subvector.

The ___________ creates object code and stores it on disk.

Compiler.

Which of the following statements is false (assume we're referring to class Time)?

Compilers and IDEs typically doesn't invoke the linker for you after compiling your code.

strtok does not:

Completely tokenize the string the first time it is called.

Nontype parameters are:

Constants.

typedef is used to:

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

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).

[C++11]: Which of the following statements is false?

Each C++11 function that converts a string to an integral type receives two parameters—a string containing the characters to convert and a pointer to a size_t variable where the function stores the index of the first character that was not converted (a null pointer, by default).

Which of the following statements about C++11's functions for converting string objects to numeric values is false?

Each function attempts to convert its entire string argument to a numeric value.

Which of the following statements is true of a priority_queue?

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

The try block cannot:

Enclose its own catch blocks.

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 does not cause a syntax error to be reported by the C++ compiler?

Extra blank lines.

Recursion is to the base case as iteration is to what:

Failure of the loop continuation test.

Which of the following is not a key organization in the open-source community?

Firefox

[C++11]: Which of the following is false?

First and third choice.

Select the false statement. If an exception is thrown from a constructor:

For an array, destructors for all array elements are called, even if those array elements have not yet been constructed.

Which of the following is true of function templates?

Formal type parameters act as placeholders for built-in types or user-defined types and are used to specify the types of arguments to the function, to specify the return type of the function, and to declare variables within the body of the function definition.

Which of the following languages is used primarily for scientific and engineering applications?

Fortran.

Which category of iterators combines the capabilities of input and output iterators into one iterator?

Forward iterators.

Labels are the only identifiers with:

Function scope.

Which of the following statements is false?

Functions rbegin and rend return iterators that can be used to modify data, and rcbegin and rcend return const iterators that cannot be used to modify data.

[C++11]: Which of the following statements about inheriting base class constructors is false?

If an inherited base-class constructor has default arguments, the line of code in Part (a) causes the compiler to generate a derived-class constructor with the same default arguments.

[C++11]: Which of the following is true?

If you define any constructors with arguments, the compiler will not define a default constructor.

[C++11]: Which of the following statements is true?

In C++11, only classes that are not declared as final can be used as base classes.

Which of the following statements about nested if...else statements is true?

In an if body, an inner if...else executes only if the outer if statement's condition is true.

Member access specifiers (public and private) can appear:

In any order and multiple times.

Which of the following statements about pointer initialization and values is false?

In the new standard, you should use the constant null_ptr to initialize a pointer instead of 0 or NULL.

Which of the following statements is false?

In use today are more than a trillion general-purpose computers and trillions more cellphones, smartphones and other handheld devices.

The advantages of using typedef do not include:

Increasing the efficiency of accessing struct member variables.

Which of the following statements is false?

Information in the memory unit is persistent—it is retained when the computer's power is turned off.

______________ enables new classes to absorb the data and behaviors of existing classes and embellish these classes with new capabilities.

Inheritance

The is-a relationship represents.

Inheritance.

Which of the following statements is true?

Input with the stream extraction operator >> always skips leading white-space characters in the input stream, by default.

Which of the following is the correct hierarchy of iterator categories (weakest at the left)?

Input/output, forward, bidirectional, random access.

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

InputIterator, InputIterator, OutputIterator, PredicateFunction, ReplacementValue.

In general, linked lists allow:

Insertions and removals anywhere.

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 line beginning with a colon(:)

Invokes the CommissionEmployee constructor with arguments.

(*max)(num1, num2, num3);:

Is a call to the function pointed to by max.

A copy constructor:

Is a constructor that initializes a newly declared object to the value of an existing object of the same class.

A string array:

Is actually an array of pointers.

Unlike a vector, a deque:

Is not stored in contiguous memory.

The conditional operator (?:):

Is the only ternary operator in C++.

Which of the following is false about a function to which a built-in array is being passed?

It always knows the size of the built-in array that is being passed.

Which of the following is false about the new operator and the object for which it allocates memory?

It automatically destroys the object after main is exited.

Which of the following is true of pseudocode?

It helps the programmer "think out" a program.

An overloaded + operator takes a class object and a double as operands. For it to be commutative (i.e., a + b and b + a both work):

It must be overloaded twice; the operator+ function that takes the object as the left operand must be a member function, and the other operator+ function must be a global function.

Which of the following is not true of a destructor?

It releases the object's memory.

Which of the following statement is false?

Keywords typename and class as used with a template type parameter specifically mean "any user-defined class type."

When a client code programmer uses a class whose implementation is in a separate file from its interface, that implementation code is merged with the client's code during the:

Linking phase.

__________ is usually faster than __________.

Low-level I/O, high-level I/O.

An array is not:

Made up of different data types.

Which of the following is not a goal stated by the creator of C++ for the new C++ standard?

Make C++ an open source programming language.

Downcasting enables:

Making a base-class pointer into a derived-class pointer.

Enumeration constants:

Must have unique identifiers.

Class templates:

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

An explicit constructor:

Must take exactly one argument.

Having a loop within a loop is known as:

Nesting.

Select the false statement. Outputs are:

Never automatically tied to inputs.

Consider the following function: void reverse(char *string1, const char *string2) { int stringsize{sizeof(string1)/sizeof(char)}; *(string1 + stringsize - 1) = '\0'; string1 = string1 + stringsize - 2; for (; *string2 != '\0'; string1--, string2++) { *string1 = *string2; } } What technique does the function use to refer to array elements?

Pointer/offset notation.

Which of the following is not a key component of the Standard Library?

Pointers.

A client changing the values of private data members is:

Possible using public functions and references.

Which of the following operations has the highest precedence?

Postincrement.

Recursion is memory-intensive because:

Previous function calls are still open when the function calls itself and the activation records of these previous calls still occupy space on the call stack.

Which of the following is not a good example of a hierarchy likely to be modeled by inheritance?

Prime numbers.

Which of the following is not one of the six logical units of a computer?

Printer.

Select the correct statement regarding C++ I/O streams:

Programmers generally prefer high-level I/O to low-level I/O.

Concrete classes that inherit virtual functions but do not override their implementations:

Receive pointers to their base classes' virtual functions.

Pointers cannot be used to:

Reference values directly.

Which software product release category is "generally feature complete and supposedly bug free, and ready for use by the community?"

Release candidate.

Member function definitions:

Require the scope resolution operator only when being defined outside of the definition of their class.

Which of the following is not a disadvantage of default memberwise copy with objects containing pointers?

Requiring the explicit overloading of the assignment operator.

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

Result in a compile error.

Functions lower_bound, upper_bound and equal_range are different in their:

Return types.

sizeof:

Returns the total number of bytes in a variable.

If the function int volume(int x = 1, int y = 1, int z = 1); is called by the expression volume(3), how many default arguments are used?

Two.

Because the postfix increment operator returns objects by value and the prefix increment operator returns objects by reference:

The postfix increment operator typically returns a temporary object that contains the original value of the object before the increment occurred.

Which of the following does the C++ compiler not examine in order to select the proper overloaded function to call?

The return type of the function.

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.

If a variable is declared in the initialization expression of a for statement, then:

The scope of the variable is restricted to that for loop.

The arguments passed to replace do not include:

The subscript of the element where the replace operation ends.

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

Their return types.

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; };

There are no pure virtual functions.

The difference between the operator! member function and the operator void* member function is that:

They always return opposite boolean values.

Which of the following statements about the Boost Libraries is false?

They are automatically included in the latest C++ Standard Library.

Which of the following is not true of a constructor and destructor of the same class?

They both are able to have default arguments.

Which of the following is not true of pointers to functions? .

They can not be assigned to other function pointers

Which of the following statements about virtual functions is false?

They do not remain virtual down the inheritance hierarchy.

Comparing pointers and performing pointer arithmetic on them is meaningless unless:

They point to elements of the same array.

Select the false statement. The new operator:

Throws a bad_alloc exception regardless of what function is registered with set_new_handler.

Which of the following lines would be the prototype for an overloaded cast operator function that converts an object of user-defined type Time into a double?

Time::operator double() const;

The conventional way to distinguish between the overloaded preincrement and postincrement operators (++) is:

To make the argument list of postincrement include an int.

[C++11] Which of the following statements about scoped enumerations is false?

To reference a scoped enum constant, you must qualify the constant with the scoped enum's type name and the scope-resolution operator (:), as in MaritalStatus:SINGLE.

End-of-line comments that should be ignored by the compiler are denoted using:

Two forward slashes (//).

Which of the following statement is true?

Two pointers that point to different built-in arrays cannot be compared meaningfully.

Parameterized stream manipulator setfill specifies the fill character that's displayed when an output is displayed in a field wider than the number of characters or digits in the output. The effect of setfill applies:

Until explicitly set to a different setting.

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

Use member function top and then member function pop.

To rethrow an exception, the exception handler must:

Use the throw; statement.

Of the following, which is not a logic error?

Using commas instead of the two required semicolons in a for header.

A function template can be overloaded by:

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

If unexpected data is processed in an I/O operation:

Various error bits will be set.

Which language was developed by Microsoft in the early 1990s to simplify the development of Windows applications?

Visual Basic.

[C++11]: Which of the following statements is true?

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

When should base class members be declared protected?

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

C++ functions other than main are executed:

When they are explicitly called by another function.

Which of the following statements is false?

Windows is an open source operating system.

The merge sort algorithm:

Works by merging two sorted vectors into one larger sorted vector.

Select the false statement. The write function:

Writes to files in hexadecimal format.

Which statement about operator overloading is false?

You can overload all C++ operators to be used with class objects.

Which of the following is false?

You should always try to write the fastest, smallest code possible before attempting to make it simple and correct.

Abstract classes do not necessarily have:

Zero references to their class.

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

[]

Which of the following is the escape character?

\

A pointer is a variable that contains as its value the ____________ of another variable.

address

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

array

An array's elements are related by the fact that they have the same ____________ and ______________.

array name, type.

Which of the following statement is declaring an array, fractions, with arraySize elements of type double, and initialize the elements to 0?

array<double, arraySize> fractions{0.0};

Which of the following is not a correct way to initialize the array named n?

array<int, 5> n{0, 7, 0, 3, 8, 2};

Lists and tables of values can be stored in _________ or __________ .

arrays, vectors

Which of the following cannot be used to concatenate strings?

assign

To use operators on class objects, they must be overloaded, with the exception of operators ________, __________ and __________.

assignment (=), address (&), comma (,)

Which bitset function could be used to create the logical not of a bitset object b?

b.flip()

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?

b1.any()

Which of the following classes is deepest in the inheritance hierarchy?

basic_fstream

Which of the following classes is a base class of the other three?

basic_ios

The nodes of a(n) _________ tree contain two link members.

binary

Which of the following data items are arranged from the smallest to the largest in the data hierarchy.

bits, characters, fields, records, files.

The bits in the result of an expression using the operator are set to one if the ___________ corresponding bits in each operand are set to one. Otherwise, the bits are set to zero.

bitwise AND (&)

Each bit in the result of an expression using the ______________ operator is set to one if exactly one of the corresponding bits in either operand is set to one.

bitwise exclusive-Or (^)

The bits in the result of an expression using the ___________ operator are set to one if at least one of the corresponding bits in either operand is set to one. Otherwise, the bits are set to zero.

bitwise inclusive OR (|)

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

bool

Which of the following is false?

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

Lambdas return types ________.

can be inferred automatically if the body is a single statement of the form return expression; otherwise, the return type is void by default.

Question 6 5 / 5 pts Which of the following is correct when labeling cases in a switch structure?

case 1:

Standard error stream outputs are directed to the stream objects ________ or _________.

cerr or clog

Which of the following is a valid generator function prototype for use with generate or generate_n on a vector<char>?

char nextLetter();

Each link in a tree node points to a(n) ________or __________of that node.

child or subtree

Which of the following is not an object of the ostream class?

cin

cin.getline(superstring, 30); is equivalent to which of the following?

cin.getline(superstring, 30, '\n');

Every class definition contains the keyword ________ followed immediately by the class's name.

class

To declare class subClass a privately derived class of superClass one would write:

class subclass : private superClass

Member function __________ of the file streams fstream, ifstream and ofstream closes a file.

close

The process of instructing the computer to solve a problem is called_______________.

computer programming

Classes from which objects can be instantiated are called __________ classes.

concrete

Which of the following statement is using a for statement to display the elements of built-in array numbers using array subscript notation. Display each number with one digit to the right of the decimal point?

cout << fixed << showpoint << setprecision(1); for (size_t i{0}; i < size; ++i) { cout << numbers[i] << ' '; }

Which of the following prints the address of character string string given the following declaration? char* string{"test"};

cout << static_cast<void*>(string)

Which of the following statements restores the default fill character?

cout.fill(' ');

Which of the following is an illegal use of function put?

cout.put("A");

When each object of a class maintains its own version of an attribute, the variable that represents the attribute is also known as a(n) ______________.

data member.

If a member initializer is not provided for a member object of a class, the object's ________________ is called.

default constructor

The operator ___________ reclaims memory previously allocated by new.

delete

virtual destructors must be used when:

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

Which of the following is a repetition structure?

do...while.

Class members are accessed via the __________ operator in conjunction with the name of an object (or reference to an object) of the class or via the ___________ operator in conjunction with a pointer to an object of the class.

dot (.), arrow (->)

Which of the following statement is declaring a built-in array of type double called numbers with 10 elements, and initialize the elements to the values 0.0, 1.1, 2.2, ..., 9.9? Assume that the constant size has been defined as 10.

double numbers[size]{0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9};

C++ programs normally go through six phases— _____, _________, __________, _______, _______, and _______________.

edit, preprocess, compile, link, load, execute

Which of the following returns a bool?

empty

Which of the following is not a valid enumeration?

enum class Person {ME, YOU, ME};.

The __________ algorithm compares two sequences of values for equality.

equal

Function _________ deletes characters from a string.

erase

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.

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

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

fill

Algorithms _______ and ________ set every element in a range of container elements to a specific value.

fill, fill_n

Which algorithm cannot take a predicate function as an argument?

find

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

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

find_last_of

A queue is referred to as a(n) ______________ data structure, because the first nodes inserted are the first nodes removed.

first-in, first-out (FIFO)

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?

flapWings

Assume that the array named items contains the integer values 0, 2, 4, 6 and 8. Which of the following set of statements uses the range-based for loop to display each value in items?

for (int item : items) { cout <<item <<endl; }

Which of the following for headers produces the values from 27 through 3, decrementing by 3?

for (unsigned int i{27}; i >= 3; i -= 3)

Which of the following statement is naming the fourth element of the array, fractions?

fractions[3]

Any algorithm that can receive a function pointer can also receive an object of a class that overloads the parentheses operator with a function named operator(), provided that the overloaded operator meets the requirements of the algorithm. An object of such a class is known as a(n) _________ and can be used syntactically and semantically like a function or function pointer.

function object

Templates enable us to specify, with a single code segment, an entire range of related functions called _______________ , or an entire range of related classes called ______________.

function-template specializations, class-template specializations

The isxdigit function would return false on:

g

Function _____________ from the <string> library reads characters until a newline character is encountered, then copies those characters into the specified string.

getline

In a(n) ______________ relationship, a class object has one or more objects of other classes as members.

has-a or composition or aggregation

As of C++14, the argument to find (and other similar functions) can be of any type, provided that there are overloaded comparison operators that can compare values of the argument's type to values of the container's key type. If there are, no temporary objects will be created. This is known as ________ lookup.

heterogenous

In single inheritance, a class exists in a(n) __________ relationship with its derived classes.

hierarchical

The ________ statement is used to make decisions.

if.

A constant object must be ___________; it cannot be modified after it's created.

initialized

The four traversal algorithms we mentioned in the text for binary search trees are__________, _________, _____________ and _____________.

inorder, preorder, postorder, level order

Untying an input stream, inputStream, from an output stream, outputStream, is done with the function call:

inputStream.tie(0).

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 a queue?

insertAtBack and removeFromFront.

When a compiler encounters a function parameter for a single-subscripted array of the form int a[], it converts the parameter to:

int *a

Which of the following statements does not overwrite a preexisting value stored in a memory location?

int a;

Which statement would be used to declare a 10-element integer array c?

int c[10];

switch can be used to test:

int constants.

Which of the following is not a correct way to initialize a built-in array?

int n[5]{0, 7, 0, 3, 8, 2};

A bit field must be declared as a:

int or unsigned.

Converting from type ________ to type ________ will result in the loss of data.

int, char.

Which of the following stream manipulators causes an outputted number's sign to be left justified, its magnitude to be right justified and the center space to be filled with fill characters?

internal

Suppose you have a programmer-defined data type Data and want to overload the << operator to output your data type to the screen in the form cout << dataToPrint; and allow cascaded function calls. The first line of the function definition would be:

ostream& operator<<(ostream& output, const Data& dataToPrint)

Which of the following is a valid user-defined output stream manipulator header?

ostream& tab(ostream& output)

The std::endl stream manipulator________.

outputs a newline and flushes the output buffer.

Which class indicates that an error occurred in which an arithmetic result was larger than the largest number that can be stored in the computer?

overflow_error.

The related functions generated from a function template all have the same name, so the compiler uses _________ resolution to invoke the proper function.

overload

[C++11]: To help prevent errors, apply C++11's ________ keyword to the prototype of every derived-class function that overrides a base-class virtual function.

override

The __________, __________ and _________ of an operator cannot be changed by overloading the operator.

precedence, associativity, "arity"

A function that does not alter a linked list, but looks at the list to determine whether it's empty, is an example of a(n) ______________ function.

predicate

From most restrictive to least restrictive, the access modifiers are:

private, protected, public

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 __________?

protected, protected

When deriving from a class with protected inheritance, public members of the base class become ___________ members of the derived class, and protected members of the base class become ___________ members of the derived class.

protected, protected

A base class's ____________ members are accessible within that base class and anywhere that the program has a handle to an object of that class or one of its derived classes.

public

____________ class members are accessible anywhere an object of the class is in scope.

public

A base class's _________ and _____________ members can be accessed in the base-class definition, in derived-class definitions and in friends of the base class and derived classes.

public, protected

When deriving a class with public inheritance, public members of the base class become ___________ members of the derived class, and protected members of the base class become _____________ members of the derived class.

public, protected

A back_inserter calls the container's default _______ function to insert an element at the end of the container. If an element is inserted into a container that has no more space available, the container grows in size.

push_back

What is wrong with the following while loop? while (sum <= 1000) { sum = sum - 30; }

sum = sum - 30 should be sum = sum + 30 or else the loop may never end.

5 / 5 pts The new C++14 stream manipulator ________ enables a program to read quoted text from a stream, including any white space characters in the quoted text, and discards the double quote delimiters. For example, if we read 100 "Janie Jones" 24.98 using inClientFile>> account>> quoted(name)>> balance; the first stream extraction reads 100 into the int variable account, the second reads Janie Jones as one string and stores it in the string variable name without the double-quote delimiters, and the third stream extraction reads 24.98 into the double variable balance.

quoted

The sort algorithm requires a(n) _________ iterator.

random-access

The istream member function _______ is normally used when reading data from a file in random-access applications.

read

A self- ___________ class is used to form dynamic data structures that can grow and shrink at execution time

referential

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?

remove_copy_if

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

resize

Suppose the unary ! operator is an overloaded member function of class String. For a String object s, which function call is generated by the compiler when it finds the expression !s?

s.operator!()

Given the strings defined below, which statement will not return 0? string s1{"Mighty Mouse"}; string s2{"Mickey Mouse"};

s1.compare(0, 3, s2, 0, 3);

If string s1 has the value "computer" and string s2 has the value "promise", which call to insert will produce the string "compromise"?

s2.insert(0, s1, 0, 3);

The process of determining if an array contains a particular key value is called ______________ the array.

searching

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

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

The _____________ stream manipulator causes positive numbers to display with a plus sign.

showpos

As of C++11, you can ask a vector or deque to return unneeded memory to the system by calling member function shrink_to_fit. This requests that the container reduce its capacity to the number of elements in the container. According to the C++ standard, implementations can ignore this request so that they can perform implementation-specific optimizations.

shrink_to_fit

Which of the following gives the number of elements in the array int r[10]?

sizeof r / sizeof (int)

The process of placing the elements of an array in order is called _______________ the array.

sorting.

The Standard Library container adapter most closely associated with the last-in, firstout (LIFO) insertion-and-removal discipline is the _________.

stack

Which of the following is not a kind of inheritance in C++?

static.

Class string belongs to the ________ namespace.

std

Which of the following statements could potentially change the value of number2?

std::cin >> number2;

The ________ object enables a program to read data from the user.

std::cin.

Which of the following is not a syntax error?

std::cout << "Hello world! ";

Which of the following statements would display the phrase C++ is fun?

std::cout << "Thisis fun\rC++ ";

Which of the following function calls is a valid way to place elements into vector<char> chars?

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

Which of the following function calls would not return the value that is its first argument?

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

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

strcpy(string1, string2);.

Input/output in C++ occurs as ______________ .

streams of bytes

Which of the following is an invalid definition?

string sc{'c'};

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

string::reverse_iterator i{s.rbegin()}; while (i != s.rend()) { cout << *i; --i; }

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

strstr.

Keyword ____________ introduces a structure declaration.

struct

The number used to refer to a particular element of an array is called its ______________

subscript

The rand function generates a data value of the type:

unsigned int.

Overridable functions are declared using keyword _______________.

virtual

to draw themselves, the draw function would most likely be declared:

virtual

Polymorphism is implemented via:

virtual functions and dynamic binding.

Which C++ data type was designed to store Unicode characters?

wchar_t

The ostream member function ___________ is used to perform unformatted output.

write

If x initially contains the value 3, which of the following sets x to 7?

x += 4;

Which of the following C++ statement is not adding 1 to integer variable x.?

x =+ 1;

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

x |= x

Assuming that x and y are equal to 3 and 2, respectively, after the statement x -= y executes, the values of x and y will be:

x: 1; y: 2

Assuming that x is equal to 4, which of the following statements will not result in y containing the value 5 after execution?

y = x++;

y and z are user-defined objects and the += operator is an overloaded member function. The operator is overloaded such that y += z adds z and y, then stores the result in y. Which of the following expressions is always equivalent to y += z?

y.operator+=(z)

Which of the following C++ statement is assigning the sum of the current value of x and y to z and postincrement the value of x?

z = x++ + y;


Conjuntos de estudio relacionados

Intro to Education Chapter 6 Quiz

View Set

Chapter 7: The Geography of the Arabian Peninsula

View Set

Sales Management - SMS Simulation Quiz

View Set

Chapter 10: Mechanisms of cell injury and Aging

View Set

The Constitution (Chapter 3 review)

View Set

NUR 320: Exam #3 Review Questions

View Set

ART-1030 Section Test 3 - Chapters 3.1 - 3.9

View Set