COSC 1436 EXAM 3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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

20,000

An array's size declarator must be a ________ with a value greater than ________.

Constant integer expression with a value greater than 0

EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure when the exit() function is called.

EXIT_SUCCESS

Arrays may be ________ at the time they are ________.

Initialized at the time they are declared

True/False: One reason for using functions is to break programs into manageable units, or modules.

True

In a function header, you must furnish:

all of these

A(n) ________ is information that is passed to a function, and a(n) ________ is information that is received by a function.

arguemtn, parameters

Unlike regular variables, these can hold multiple values.

arrays

Subscript numbering in C++

begins with 0

A function ________ contains the statements that make up the function.

body

It is a good programming practice to ________ your functions by writing comments that describe what they do.

document

True/False: A linear search can only be implemented with integer values.

false

True/False: You must furnish an argument with a function call.

false

Data that is sorted in ascending order is ordered ________.

from lowest to highest value

This is a collection of statements that performs a specific task.

function

If a function does not have a prototype, default arguments may be specified in the function ________.

header

Which of the following is a valid C++ array definition?

int scores[10];

A(n) ________ search uses a loop to sequentially step through an array.

linear

The name of an array stores the ________ of the first array element.

memory address

A function can have zero to many parameters, and it can return this many values.

only one

This vector function removes an item from a vector.

pop_back

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

prototype

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

range variable

When used as parameters, these types of variables allow a function to access the parameter's original argument.

reference

A two-dimensional array is like ________ put together.

several identical arrays

The advantage of a linear search is its ________.

simplicity

An array of string objects that will hold 5 names would be declared using which statement?

string names[5];

By using the same ________ you can build relationships between data stored in two or more arrays.

subscript

An element of a two-dimensional array is referred to by ________ followed by ________.

the row subscript of the element, the column subscript of the element

This statement causes a function to end.

to return

True/False: An individual array element can be processed like any other type of C++ variable.

true

True/False: Each individual element of an array can be accessed by the array name and an element number, called a subscript.

true

True/False: If an array is partially initialized, the uninitialized elements will be set to zero.

true

True/False: It is not considered good programming practice to declare all of your variables globally.

true

Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20?

vector <int> n{10,20};

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.

To assign the contents of one array to another, you must use ________.

a loop to assign the elements of one array to the other array

Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.

call

These types of arguments are passed to parameters automatically if no argument is provided in the function call.

default

True/False: A local variable and a global variable may not have the same name within the same program.

false

True/False: A parameter is a special-purpose variable that is declared inside the parentheses of a function definition.

false

True/False: Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.

false

True/False: Before you can perform a bubble sort, the data must be stored in descending order.

false

True/False: Before you can perform a selection sort, the data must be stored in ascending order.

false

True/False: C++ limits the number of array dimensions to two.

false

True/False: Using a binary search, you are more likely to find an item than if you use a linear search.

false

True/False: When a function is called, flow of control moves to the function's prototype.

false

An array can easily be stepped through by using a ________.

for loop

This is a statement that causes a function to execute.

function call

A(n) ________ can be used to specify the starting values of an array.

initalization list

It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].

legal in c++

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

name

Regardless of the algorithm being used, a search through an array is always performed ________.

none of these

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

null terminantor

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

same data type

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

selection bubble

This vector function returns the number of elements in a vector.

size

________ algorithms are used to arrange random data into some order.

sorting

A two-dimensional array of characters can contain ________.

strings of the same lengthstrings of different lengthsuninitialized elements

True/False: It is possible for a function to have some parameters with default arguments and some without.

true

True/False: The amount of memory used by an array depends upon the array's data type and the number of elements in the array.

true

True/False: When you pass an array as an argument to a function, the function can modify the contents of the array.

true

True/False: You may use the exit() function to terminate a program, regardless of which control mechanism is executing.

true


Set pelajaran terkait

Hypothesis Test for a Population Mean

View Set

ATI RN Evidence-Based Practice in Community and Public Health Assessment

View Set

MASTER Brain Facts/Neuroscience: Science of the Brain Glossary

View Set

"A View From the Empire State Building" - Mrs. Clark

View Set

Ch 12 *managing individuals & diversity

View Set

Maternal Child Chap 26 Point Qs: Toddler

View Set