C++ chapters 5-7
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
A function is executed when it is
called
linux command cd means
change directory
This is a variable that is regularly incremented or decremented each time a loop iterates
counter
A function____ contains the statements that make up the function
definition
linux command ls-l (thats LS-L) means
detailed list (long list)
The individual values contained in array are known as ____
elements
An array can easily be stepped through by using a ____
for loop
The name of an array stores the ____ of the first array element
memory address
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
An array can store a group of values, but the values must be
the same data type
If you leave out the size declarator in an array definition
you must furnish an initialization list
in a function header, you must furnish:
All data type of the return value the name of the function names of the parameter variables data type(s) of the parameters
A loop that is inside another loop is called:
a nested loop
A_____ is information that is passed to a function, and a(n)_____ is information that is received by a function.
argument, parameter
This statement may be used to stop a loop's current iteration and begin the next one.
continue
The statement: int grades [ ] = { 100,90,99,80}; shows an example of what
implicit array sizing
Which of the following is a valid C++ array definition
int array[10];
This type of variable is defined inside a function and is not accessible outside the function
local
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
a Function_____ eliminates the need to place a function definition before all calls to the function
prototype
This statement causes a function to end
return
A two-dimensional array can be viewed as ___ and ____
rows, columns
Given the following declaration, where is the value 77 stored in the scores array? int scores [ ] = {83, 62, 77, 97};
scores [2]
linux command less means
scroll up or down the page
linux command ls (thats LS) means
short list
The value in this type of local variable persists between function calls
static
A for statement contains three expressions: initialization, test, and:
update
You may define a _____ in the initialization expression of a for loop.
variable
What is the output of the following code segment? n = 1; while (n <= 5) cout << n << ' '; n++;
1 1 1 ...... and on forever
What is the last legal subscript that can be used with the following array? int values [5];
4
Look at the following statement While (x++ < 10) which operator is used first?
<
#include <iostream> using namespace std; void largest(int, int, int, int &); void larger (int, int, int &); int main(int argc, const char * argv[]) { int largest_Number; int num1; int num2; int num3; cout <<"Enter a number; "; cin >> num1; cout <<"Enter a number; "; cin >> num2; cout <<"Enter a number; "; cin >> num3; largest(num1, num2, num3, largest_Number); cout << "The largest number is: "<< largest_Number; return 0: } void larger(int X, int Y, int & E) { if(X>Y) { ____________ } else { ____________ } } void largest(int A, int B, int C, int & D) { larger(A, B, D); int largest1=D; larger(largest1, C, D); }
E=X; E=Y;
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
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
subscript numbering in C++
begins with 0
This statement causes a loop to terminate early
break
The ____ is automatically appended to a character array when it is initialized with a string constant
null terminator
A function can have zero to many parameters, and it can return this many values.
only one
The while loop is this type of loop
pre-test
When the increment operator precedes its operand, as in ++num1, the expression is in this mode.
prefix
This operator increments the value of its operand, then uses the value in context.
prefix increment
linux command pwd means
print working directory
An array of string objects that will hold 5 names would be declared using which statement
string names[5];
This is a dummy function that is called instead if the actual function it represents
stub
to access an array element, use the array name and the element's _____
subscript