c++ exam 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

How many elements does the following array have?int values[1000];

1000

Using a linear search to find a value that is stored in the last element of an array that contains 20,000 elements, ________ elements must be compared.

20,000

In the following function prototype, how many parameter variables does this function have?int myFunction(double, double, double);

3

What will the following C++11 code display? vector numbers {3, 5};for (int val : numbers)cout << val << endl;

3, 5

The ________ sort usually performs fewer exchanges than the ________ sort.

binary, linear

The individual values contained in an array are known as

elements

This vector function returns true if the vector has no elements.

empty

A ________ variable is declared outside all functions.

global

An array with no elements is

illegal in C++

This following statement shows an example of ________.int grades][ ] = {100, 90, 99, 80};

implicit array sizing

Arrays must be ________ at the time they are ________.

initialized, declared

What is the data type of the following function prototype's return value?

int

Assume you have two integer variables, num1 and num2. Which of the following is the correct way to swap the values in these two variables?

int temp = num2; num2 = num1; num1 = temp;

This type of variable is defined inside a function and is NOT accessible outside the function.

local

To pass an array as an argument to a function, pass the ________ of the array.

name

The ________ is automatically appended to a character array when it is initialized with a string constant.

null terminator

A function can have no parameters, one parameter, or many parameters and can return ________ value(s).

only one

A function ________ eliminates the need to place a function definition before all calls to the function.

prototype

Array elements must ________ before a binary search can be performed.

set to zero

Algorithms used to arrange random data in some order are ________ algorithms.

sorting

The value in this type of variable persists between function calls.

static

The value in a ________ variable persists between function calls.

static local

This is a dummy function that is called instead of the actual function it represents:

stub

The range-based for loop in C++11 is designed to work with a built-in variable known as

the range variable

An array can store a group of values, but the values must be

the same data type

The following function should swap the values contained in two integer variables, num1 and num2. What, if anything, is wrong with this function? void swap(int num1, int num2) { int temp = num2; num2 = num1; num1 = temp; }

the swap function must use reference parameters

Which statement correctly defines a vector object for holding integers?

vector<int>v;

If you leave out the size declarator in an array definition

you must furnish an initialization list


Kaugnay na mga set ng pag-aaral

Chapter 36: Corporate Formation and Financing

View Set

List the ten processes of life that occur while an organism is alive but cease when it is dead.

View Set

Geography - Canada Provinces and Territories

View Set

Types of Energy Transfer: Conduction, Convection & Radiation

View Set

legal studies chapters 15 and 16

View Set

Health: Exercise and Physical fitness

View Set

On Women's Right to Suffrage Review

View Set