Final Exam Review

A function __________ eliminates the need to place a function definition before all calls to
the function.
prototype
The value in a(n) _______ variable persists between function calls.
static local
We will write a custom essay sample on
Final Exam Review
or any similar topic only for you
Order now
This is a collection of statements that performs a specific task.
function
A function can have zero to many parameters, and it can return this many values.
only one
This statement causes a function to end.
return
Look at the following function prototype.

int myFunction(double, double, double);

How many parameter variables does this function have?

3
Which line in the following program contains the header for the showDub function?

1 #include
2 using namespace std;
3
4 void showDub(int);
5
6 int main()
7 {
8 int x = 2;
9
10 showDub(x);
11 cout << x << endl; 12 return 0; 13 } 14 15 void showDub(int num) 16 { 17 cout << (num * 2) << endl; 18 }

15
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.
argument, parameter
True/False: A function’s return data type must be the same as the function’s parameter(s).
False
True/False: Assume array1 and array2 are the names of arrays. To assign the contents
of array2 to array1, you would use the following statement.

array1 = array2;

False
A two-dimensional array of characters can contain
All of these
True/False: Each individual element of an array can be accessed by the array name and an
element number, called a subscript.
True
To pass an array as an argument to a function, pass the _________ of the array.
Name
A two-dimensional array can be viewed as ___________ and _____________.
rows, columns
This vector function returns true if the vector has no elements.
empty
This vector function returns the number of elements in a vector.
Size
What does the following statement do?

vector v(10, 2);

It creates a vector object with a
starting size of 10 and all elements
are initialized with the value 2.
An array can easily be stepped through by using a
Loop
True/False: The statement

double money[25.00];

is a valid C++ array definition.

False
When an array is sorted from highest to lowest, it is said to be in _____ order.
Descending
The _________ sort usually performs fewer exchanges than the ________ sort.
selection, bubble
True/False: Before you can perform a bubble sort, the data must be stored in descending
order.
False
A ________ algorithm is a method of locating a specific item of information in a larger
collection of data.
search
True/False: A linear search can only be implemented with integer values.
False
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
Data that is sorted in ascending order is ordered
from lowest to highest value
__________ algorithms are used to arrange random data into some order.
Sorting
True/False: The number of comparisons made by a binary search is expressed in powers of
two.
True
A(n) ________ search is more efficient than a(n) ________ search
binary, linear
What is the output of the following program?

#include
using namespace std;

void showDub(int);

int main()
{
int x = 2;

showDub(x);
cout << x << endl; return 0; } void showDub(int num) { cout << (num * 2) << endl; }

4
2
Here is the header for a function named computeValue:

void computeValue(int value)

Which of the following is a valid call to the function?

computeValue(10);
True/False: A static variable that is defined within a function is initialized only once, the first time the
function is called.
True
This function causes a program to terminate, regardless of which function or control
mechanism is executing.
Exit()
These types of arguments are passed to parameters automatically if no argument is provided
in the function call.
Default
If a function is called more than once in a program, the values stored in the function’s local
variables do not _________ between function calls.
Persist
Unlike regular variables, these can hold multiple values.
Arrays
What will the following code display?

int numbers[] = {99, 87, 66, 55, 101 };
cout << numbers[3] << endl;

55
An array of string objects that will hold 5 names would be declared using which statement?
string names[5];
When writing functions that accept multi-dimensional arrays as arguments,
_______________ must be explicitly stated in the parameter list.
all but the first dimension
Arrays may be ___________ at the time they are __________.
initialized, declared
The name of an array stores the __________ of the first array element.
memory address
True/False: You must furnish an argument with a function call.
False
True/False: Local variables are initialized to zero by default.
False
If a function does not have a prototype, default arguments may be specified in the function
___________.
Header
What is the output for the following code?

#include
using namespace std;

void doSomething(int&);

int main()
{
int x = 2;

cout << x << endl; doSomething(x); cout << x << endl; return 0; } void doSomething(int& num) { num = 0; cout << num << endl; }

2
0
0
True/False:
A parameter is a special-purpose variable that is declared inside the parentheses of a
function definition.
True
True/False: An individual array element can be processed like any other type of C++
variable.
True
The ______________ is automatically appended to a character array when it is initialized
with a string constant
null terminator
Which statement correctly defines a vector object for holding integers?
vectorv;
×

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out