The while loop is a(n) ________ loop, whereas the do-while loop is a(n) ________ loop.

This is a special value that marks the end of a list of values

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

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

A for statement contains three expressions: initialization, test, and

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

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

This is a control structure that causes a statement or group of statements to repeat

These are operators that add and subtract one from their operands

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

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

This is a dummy function that is called instead of the actual function it represents

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

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

This function causes a program to terminate, regardless of which function or control mechanism is executing

A function ________ contains the statements that make up the function

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

Subscript numbering in C++

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

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

An array with no elements is

A two-dimensional array can have elements of ________ data type(s)

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

Which statement correctly defines a vector object for holding integers?

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

This manipulator causes the field to be left-justified with padding spaces printed to the right

The ________ sort usually performs fewer exchanges than the ________ sort

A ________ algorithm is a method of locating a specific item of information in a larger collection of data

Before you can perform a selection sort, the data must be stored in ascending order

________ algorithms are used to arrange random data into some order

The number of comparisons made by a binary search is expressed in powers of two

In a C++ program, two slash marks ( // ) indicate

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

This statement will pause the screen, until the [Enter] key is pressed

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

What will the following loop display?


int x = 0;

while (x < 5)

{

cout << x << endl;

x++;

}

What will the following code display?


int number = 6

int x = 0;

x = --number;

cout << x << endl;

How many times will the following loop display "Hello"


for (int i = 0; i < 20; i++)

cout << "Hello!" << endl;

How many times will the following loop display "Hello"


for (int i = 20; i > 0; i--)

cout << "Hello!" << endl;

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;

}

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;

}

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 }

A two-dimensional array of characters can contain:




  • uninitialized elements
  • strings of the same length
  • None of these
  • strings of different lengths
  • All of these

How many elements does the following array have?


int bugs[1000];

What will the following code display?


int numbers[ ] = {99, 87, 66, 55, 101 };

cout << numbers[3] << endl;

What is the last legal subscript that can be used with the following array?


int values[5];

What will the following code display?


int numbers[ ] = { 99, 87, 66, 55, 101 };

for (int i = 1; i < 4; i++)

cout << numbers[i] << endl;

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

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

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

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.

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

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;

}

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


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

This is a statement that causes a function to execute.

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

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

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

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

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:

A two-dimensional array can be viewed as ________ and ________

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

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.

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

The individual values contained in array are known as:

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

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

The advantage of a linear search is its

Before you can perform a bubble sort, the data must be stored in descending order

Using a binary search, you are more likely to find an item than if you use a linear search

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

A linear search can only be implemented with integer values

A binary search begins with the ________ element of an array

The bubble sort is an easy way to arrange data into ascending order, but it cannot arrange data into descending order

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

What is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl;

What is a while loop quizlet?

It tells Python to repeat the action while a certain condition is true. Use this loop when you don't know the exact number of times you need your code to run. What is an example of a while loop? x = 0.

Is a variable that controls the number of times a loop iterates?

A variable that controls the number of times a loop repeats is called a control variable . Unless you specify otherwise, the control variable increases by 1 each time the loop repeats. This example results in five lines of Hello!

When a loop is nested inside another loop the outer loop goes through?

16) When a loop is nested inside another loop, the outer loop goes through all its iterations for each iteration of the inner loop.

Which statement causes a loop to terminate early?

The purpose the break statement is to break out of a loop early. For example if the following code asks a use input a integer number x. If x is divisible by 5, the break statement is executed and this causes the exit from the loop.

Toplist

Neuester Beitrag

Stichworte