Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
85 Cards in this Set
- Front
- Back
This is a special value that marks the end of a list of values
|
SENTINEL |
|
If you place a semicolon after the test expression in a while loop, it is assumed to be a(n)
|
NULL STATEMENT |
|
The statements in the body of a while loop may never be executed, whereas the statements in the body of a do-while loop will be executed |
AT LEAST ONCE |
|
A for statement contains three expressions: initialization, test, and
|
UPDATE |
|
Something within a while loop must eventually cause the condition to become false, or a(n) ________ results
|
INFINITE LOOP |
|
This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning
|
WHILE |
|
This is a control structure that causes a statement or group of statements to repeat
|
LOOP |
|
These are operators that add and subtract one from their operands
|
++ and -- |
|
This is a variable that is regularly incremented or decremented each time a loop iterates
|
COUNTER |
|
Which of the following statements about global variables is true?
|
A global variable can have the same name as a variable that is declared locally within a function.
|
|
A function ________ eliminates the need to place a function definition before all calls to the function |
PROTOTYPE |
|
This is a dummy function that is called instead of the actual function it represents
|
STUB |
|
EXIT_FAILURE and ________ are named constants that may be used to indicate success or failure when the exit( ) function is called
|
EXIT_SUCCESS |
|
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 |
|
This function causes a program to terminate, regardless of which function or control mechanism is executing
|
EXIT() |
|
A function ________ contains the statements that make up the function
|
DEFINITION |
|
It is a good programming practice to ________ your functions by writing comments that describe what they do
|
DOCUMENT |
|
Subscript numbering in C++
|
BEGINS WITH ZERO |
|
By using the same ________ you can build relationships between data stored in two or more arrays
|
SUBSCRIPT |
|
It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3]
|
LEGAL IN C++ |
|
An array with no elements is
|
ILLEGAL IN C++ |
|
A two-dimensional array can have elements of ________ data type(s)
|
ONE |
|
A(n) ________ can be used to specify the starting values of an array
|
INITIALIZATION LIST |
|
Which statement correctly defines a vector object for holding integers?
|
vector v |
|
When this operator is used with string operands it concatenates them, or joins them together
|
+ |
|
A variable whose value can be either true or false is of this data type
|
BOOL |
|
This manipulator causes the field to be left-justified with padding spaces printed to the right
|
LEFT |
|
The ________ sort usually performs fewer exchanges than the ________ sort
|
SELECTION BUBBLE |
|
A ________ algorithm is a method of locating a specific item of information in a larger collection of data
|
SEARCH |
|
Before you can perform a selection sort, the data must be stored in ascending order
|
FALSE |
|
________ algorithms are used to arrange random data into some order
|
SORTING |
|
The number of comparisons made by a binary search is expressed in powers of two
|
TRUE |
|
In a C++ program, two slash marks ( // ) indicate
|
COMMENT |
|
A(n) ________ search uses a loop to sequentially step through an array
|
LINEAR |
|
This statement will pause the screen, until the [Enter] key is pressed
|
cin.get() |
|
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 |
|
What will the following loop display? int x = 0; while (x < 5) { cout << x << endl; x++; } |
0 1 2 3 4 |
|
What will the following code display? int number = 6 int x = 0; x = --number; cout << x << endl; |
5 |
|
How many times will the following loop display "Hello" for (int i = 0; i < 20; i++) cout << "Hello!" << endl; |
20 |
|
How many times will the following loop display "Hello" for (int i = 20; i > 0; i--) cout << "Hello!" << endl; |
20 |
|
What is the output of the following program? # include using namespace std; int getValue(int); int main( ) { int x = 2; cout << getValue(x) << endl; return 0; } int getValue(int num) { return num + 5; } |
7 |
|
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 |
|
Which line in the following program contains a call to 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 } |
10. showDub(x); |
|
A two-dimensional array of characters can contain:
|
ALL OF THESE |
|
How many elements does the following array have? int bugs[1000]; |
1,000 |
|
What will the following code display? int numbers[ ] = {99, 87, 66, 55, 101 }; cout << numbers[3] << endl; |
55 |
|
What is the last legal subscript that can be used with the following array? int values[5]; |
4 |
|
What will the following code display? int numbers[ ] = { 99, 87, 66, 55, 101 }; for (int i = 1; i < 4; i++) cout << numbers[i] << endl; |
87 66 55 |
|
What does the following statement do?
vector v(10, 2); |
vector object = size 10 and 2 elements |
|
Assuming dataFile is a file stream object, the statement dataFile.close(); |
Closes a file |
|
This statement may be used to stop a loop's current iteration and begin the next one. |
Continue |
|
This statement may be used to stop a loop's current iteration and begin the next one. |
post-test |
|
Look at the following statement. while (x++ < 10) Which operator is used first? |
< |
|
This may be used to write information to a file. |
stream insertion operator |
|
In a for statement, this expression is executed only once. |
Initialization |
|
The while loop has two important parts: an expression that is tested for a true or false value, and: |
a statement or block that is repeated as long as the expression is true |
|
What is the output of the following code segment? n = 1; for (n <= 5; ) cout << n << ' '; n++; |
1 1 1....and forever |
|
What is the output of the following program?
#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 2 |
|
What is the output of the following program?# 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 2 |
|
This type of variable is defined inside a function and is not accessible outside the function. |
Local |
|
This is a statement that causes a function to execute. |
function call |
|
A function can have zero to many parameters, and it can return this many values. |
only one |
|
These types of arguments are passed to parameters automatically if no argument is provided in the function call |
default |
|
A(n) ________ is information that is passed to a function, and a(n) ________ is information that is received by a function. |
argument parameter |
|
If a function does not have a prototype, default arguments may be specified in the function_______ |
header |
|
An array's size declarator must be a(n)________ with a value greater than ________ |
constant integer expression zero |
|
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 |
|
To access an array element, use the array name and the element's: |
subscript |
|
A two-dimensional array can be viewed as ________ and ________ |
rows, columns |
|
Which of the following is a valid C++ array definition? |
int scores [10]; |
|
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 vector function returns the number of elements in a vector. |
size |
|
The ________ is automatically appended to a character array when it is initialized with a string constant |
null terminator |
|
The individual values contained in array are known as: |
elements |
|
An array can store a group of values, but the values must be: |
the same data type |
|
To pass an array as an argument to a function, pass the ________ of the array |
name |
|
The advantage of a linear search is its |
simplicity |
|
Before you can perform a bubble sort, the data must be stored in descending order |
False |
|
Using a binary search, you are more likely to find an item than if you use a linear search |
False |
|
Regardless of the algorithm being used, a search through an array is always performed |
None of These |
|
A linear search can only be implemented with integer values |
False |
|
A binary search begins with the ________ element of an array |
middle |
|
The bubble sort is an easy way to arrange data into ascending order, but it cannot arrange data into descending order |
False |
|
What will the following code display?int number = 6;number++;cout << number << endl; |
7 |
|
What is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl; |
12 |