C++ chapter 5 and 6

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

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

(argument, parameter)

What will the following loop display? int x = 0; while (x < 5) { cout << x << endl; x++; }

0 1 2 3 4

What is the output of the following code segment? n = 1; for ( ; n <= 5; ) cout << n << ' '; n++;

1 1 1 ... and on forever

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 output of the following program? #include <iostream> 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

What will the following code display? int number = 6; cout << number++ << endl;

6

In a function header you must furnish: Select one: a. data type(s) of the parameters b. data type of the return value c. the name of function d. names of parameter variables e. All of these

All of these

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

Default

_______functions may have the same name, as long as their parameter lists are different.

Two or more

Which of the following statements about about global variables is true?

a global variable can have the same name as a variable that is declared locally within a function.

A loop that is inside another loop is called:

a nested loop

The while loop has 2 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

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

This statement causes a loop to terminate early.

break

A function is executed when it is

called

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);

This statement may be used to stop a loop's current iteration and begin the next one.

continue

This is a variable that is regularly incremented or decremented each time a loop iterates.

counter

Look at the following function prototype. int myFunction(double); What is the data type of the funtion's parameter variable?

double

Something within a while loop must eventually cause the condition to become false, or a(n) ________ results.

infinite loop

Look at the following function prototype. int myFunction(double); What is the data type of the funtion's return value?

int

The while loop contains 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

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

local

If you place a semicolon after the test expression in a while loop, it is assumed to be a(n):

null statement

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

only one

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 while loop is this type of loop.

pre-test loop

This operator increments the value of its operand, then uses the value in context.

prefix increment

A function________eliminates need to place a function definition before all calls to the function. also known as function declarations.

prototype

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

static


Set pelajaran terkait

Parliamentary Procedures Terms Used at a Meeting

View Set

AP Euro Midterm Review(Personalized)

View Set