[Solved] 1 Loop Check Condition Beginning Loop Loop Loop Loop Loop Using Boolean Value 2 Following Q37225492
1.Which loop does not check a condition at the beginning of theloop?
The do-while loop
The while loop
The for loop
Any loop using a Boolean value
2.In the following code snippet, when does the execution of theprogram switch from the inner loop to the outer loop?
int i;int j;for (i = 0; i <= 9; i++){ for (j = 1; j < 5; j++) { cout << “Hello” << endl; }}
When the inner loop is completed
When the program executes completely
When the condition for the outer loop is met
None of the listed items
3.What does the following code segment do to the array a[],given that the current_size variable holds the number of validelements currently in the array?
a[pos] = a[current_size-1];current_size–;
It shrinks the size by 1.
It changes the ordering of elements in the array.
It removes the element at index pos.
It does all of these things.
4.Consider the following code snippet:
vector<int> series1(10);vector<int> series2(10);for (int i = 0; i < series1.size(); i++){ series1[i] = i + 1; series2[i] = series1[i] + 1;}
What values are stored in the 0th element of the series1 andseries2 vectors?
In the code snippet, series1 has 0 and series2 has 1.
In the code snippet, series1 has 1 and series2 has 0.
In the code snippet, series1 has 1 and series2 has 2.
In the code snippet, series1 has 1 and series2 has 1.
5.Which one of the following is the correct code snippet forcalculating the largest value in an integer vector of size 6?
int max = 0; for (int cnt = 1; cnt < vect.size(); cnt++){ if (vect[cnt] > max) { max = vect[cnt]; }}int max = vect[0]; for (int cnt = 1; cnt < vect.size(); cnt++){ if (vect[cnt] > max) { max = vect[cnt]; }}int max = vect[1]; for (int cnt = 1; cnt < vect.size(); cnt++){ if (vect[cnt] > max) { max = vect[cnt]; }}int max = vect[0]; for (int cnt = 1; cnt > vect.size(); cnt++){ if (vect[cnt] >= max) { max = vect[cnt]; }}
Expert Answer
Answer to 1.Which loop does not check a condition at the beginning of the loop? The do-while loop The while loop The for loop Any … . . .
OR

