Question: Question 1 (1 point) int x = 0; while (x x++; cout } What is the first thing printed by the above code? Question 1
Question 1 (1 point)

int x = 0; while (x x++; cout } What is the first thing printed by the above code?
Question 1 options:
| -1 | |
| 0 | |
| 1 | |
| 2 | |
| Nothing is printed |
Save
Question 2 (1 point)

int x; for (x = 0; x } cout What is the last thing printed by the above code?
Question 2 options:
| 0 | |
| 1 | |
| 2 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 3 (1 point)

int x = 0; while (x cout x++; } What is the last thing printed by the above code?
Question 3 options:
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 4 (1 point)

int x = 0; while (x > 10) { cout x++; } What is the last thing printed by the above code?
Question 4 options:
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 5 (1 point)

Which of the following symbols has the highest precedence?
Question 5 options:
| ++ | |
| || | |
| && | |
| - |
Save
Question 6 (1 point)

Which of the following code segments will count from 1 to 100 (including 1 and 100)?
Question 6 options:
| for (int i=1; i | |
| for (int i=1; i | |
| for (int i=0; i | |
| for (int i=0; i | |
| for (int i=1; i |
Save
Question 7 (1 point)

int x = 0; while (x > 10) { x++; cout } What is the first thing printed by the above code?
Question 7 options:
| -1 | |
| 0 | |
| 1 | |
| 2 | |
| Nothing is printed |
Save
Question 8 (1 point)

If you need to write a do-while loop that will ask the user to enter a number between 2 and 5 inclusive, and will keep asking until the user enters a correct number, what is the loop condition?
Question 8 options:
| (2 | |
| (2 | |
| (2 | |
| (2 > number || number > 5) | |
| (2 > number && number > 5) | |
| (2 | |
| (2 | |
| (2 |
Save
Question 9 (1 point)

int x; for(x = 0;x > 0;x++) { } cout What is the last thing printed by the above code?
Question 9 options:
| 0 | |
| 1 | |
| 2 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 10 (1 point)

int x = 0; while (x > 10) { x++; cout } What is the last thing printed by the above code?
Question 10 options:
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 11 (1 point)

int x = 0; while (x x++; cout } What is the last thing printed by the above code?
Question 11 options:
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 12 (1 point)

What is the value of x after the following code executes? int x=10; if ( ++x > 10 ) { x=13; }
Question 12 options:
| 10 | |
| 9 | |
| 13 | |
| 11 |
Save
Question 13 (1 point)

If you want a loop to quit iterating if x 3, what would be the proper loop condition test?
Question 13 options:
| (x 3) | |
| (x >10 || y | |
| (x >=10 && y | |
| (x >=10 || y |
Save
Question 14 (1 point)

int x; for (x = 0; x cout } What is the output of the above code?
Question 14 options:
| 0 1 2 3 4 5 6 7 8 9 | |
| 0 1 2 3 4 5 6 7 8 9 10 | |
| 1 2 3 4 5 6 7 8 9 | |
| 1 2 3 4 5 6 7 8 9 10 | |
| 0 2 4 6 8 | |
| 0 2 4 6 8 10 | |
| 0 2 4 6 8 10 12 | |
| 2 4 6 8 | |
| 2 4 6 8 10 | |
| 2 4 6 8 10 12 | |
| 1 3 5 7 9 | |
| 1 3 5 7 9 11 | |
| Nothing is printed | |
| The code never ends |
Save
Question 15 (1 point)

What is wrong with the following for loop? for(int i=0;i cout }
Question 15 options:
| can not use a for-loop for this | |
| i is not initialized | |
| infinite loop | |
| off-by-one error |
Save
Question 16 (1 point)

Which loop structure always executes at least once?
Question 16 options:
| do-while | |
| for | |
| while | |
| sentinel |
Save
Question 17 (1 point)

Which of the following is not a good reason for choosing a certain loop control?
Question 17 options:
| What the loop does | |
| The minimum number of iterations of the loop | |
| The condition for ending the loop | |
| If the loop is in a function |
Save
Question 18 (1 point)

int x; for (x = 0; x ++x; cout } What is the first thing printed by the above code?
Question 18 options:
| -1 | |
| 0 | |
| 1 | |
| 2 | |
| Nothing is printed |
Save
Question 19 (1 point)

Question 19 options:
Complete the following code segment // count from 1 to 100 // 1 is the first number printed // 100 is the last number printed int i=0; while (i cout }
Save
Question 20 (1 point)

int x = 0; while (x x++; } cout What is the last thing printed by the above code?
Question 20 options:
| 0 | |
| 1 | |
| 2 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| Nothing is printed | |
| The code never ends |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
