CSIS 112 Final

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

operator

catch blocks are not required to contain:

A parameter name.

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

memset

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

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

Which of the following is not a disadvantage of trying to modify a sequential access file?

...

The compiler will implicitly create a default constructor if:

The class does not define any constructors.

________ is a communications protocol used to send information over the web.

HyperText Markup Language (HTML).

Function templates:

Can include objects of template classes as parameters.

The OR (||) operator:

Stops evaluation upon finding one condition to be true.

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

.001234
1.234500e-03

sizeof:

Returns the total number of bytes in a variable

You can initialize fundamental-type data members in their declarations. This is known as a(n) ________ initializer and was introduced in C++11.

in-class initializer

An explicit constructor:

Must take exactly one argument

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

array<int, 12> c;

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

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

The isxdigit function would return false on:

g

Which of the following is not true about files?

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

For operators overloaded as non-static member functions:

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

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)

Functions that are not members of a class are called ________ functions.

global

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

try statement

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

In what order would the following operators be evaluated
-, *, /, +, %
Assume that if two operations have the same precedence, the one listed first will be evaluated first.

*, /, %, -, +

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.

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.

Given the class definition:
class CreateDestroy
{
public:
CreateDestroy() {cout << "constructor called, ";}
~CreateDestroy() {cout << "destructor called, ";}
};
What will the following program output?
int main()
{
CreateDestroy c1;
CreateDestroy c2;
retur

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

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

Bit1 ^ Bit2

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

Invokes the CommissionEmployee constructor with arguments.

Each class you create becomes a new ________ you can use to declare variables and create objects.

type

__________ is not allowed.

Accessing individual bits in a multi-bit bit field.

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

Prime numbers

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

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

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

One pointer to an int and one int variable.

strtok does not:

Completely tokenize the string the first time it is called.

In a linear search, it is just as likely that the value being searched will be found in the first element as the last.

True

Which of the following statements is true?

All of the above are true

Which of the following statements is false?

Windows is an open source operating system

Exception handling may allow a program to:

All of the above

A copy constructor:

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

Variables defined inside a member function of a class have:

Block scope

Which forms of inheritance are is-a relationships?

Only public

Which of the following is not one of the C++ control structures?

break

Using square brackets ([]) to retrieve vector elements __________ perform bounds checking; using member function at to retrieve vector elements __________ perform bounds checking.

Does no, does.

A header file is typically given the filename extension:

.h

The rand function generates a data value of the type:

unsigned int

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

an access function

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

wchar_t

You can sort an array with the Standard Library's:

sort function

What is not true about this code segment?
location = fileObject.tellg();

location is a pointer

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

0

What will the following program segment do?
int counter{1};
do
{
cout << counter << " ";
} while (++counter <= 10);

Print the numbers 1-10

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

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

A get from the input stream

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

It added several bugs sfrom C++11

Member access specifiers (public and private) can appear:

In any order and multiple times

Which of the following best describes the first iteration of an insertion sort?

a.
It takes the second element, and if it's less than the first element, it swaps it with the first element.

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

They both are able to have default arguments.

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!()

Which of the following is true of pseudocode?

It helps the programmer "think out" a program

Select the false statement. The reinterpret_cast operator:

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

A bit field must be declared as a:

int or unsigned

Run-time type information can be used to determine:

An object's type

[C++14] : Which of the statements a), b) and c) is false?

All of the above statements are true.

The advantages of using typedef do not include:

Increasing the efficiency of accessing struct member variables.

[C++11]: The Boost Libraries ________ pointers help you avoid some key errors associated with traditional pointers.

smart

Select the false statement. Outputs are:

Never automatically tied to inputs

To implicitly overload the += operator:

The += operator cannot be overloaded implicitly

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

bits, characters, fields, records, files.

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

strncmp(string1, string2, 5);.

An advantage of using inheritance with exceptions is:

The ability to catch related errors easily

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

int c[10]

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

Firefox.

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

invalid_argument

[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 part b): using Card* = CardPtr;