19. How many times will the following loop display “Hello”?________ for (int i =
ID: 3715832 • Letter: 1
Question
19. How many times will the following loop display “Hello”?________
for (int i = 0; i <= 19; i++)
cout << "Hello!" << endl;
a. 20 c. 21
b. 19 d. An infinite number of times
20. How many times will the following loop display “Hello”?________
for (int i = 20; i => 0; i--)
cout << "Hello!" << endl;
a. 20 c. 21
b. 19 d. An infinite number of times
21. What is the output of the following segment of code if 7 is input by the user when asked to enter a number?____________
int num;
int total = 0;
cout << "Enter a number from 1 to 10: ";
cin >> num;
switch (num)
{
case 1:
case 2: total = 5;
case 3: total = 10;
case 7: total = total + 3;
case 8: total = total + 6;
default: total = total + 4;
}
cout << total << endl;
22. What will the following segment of code output?______________
score = 40;
if (score < 95)
{
cout << "Congratulations! ";
cout << "That's a high score! ";
cout << "This is a test question!" << endl;
}
a. This is a test question!
b. Congratulations!
That's a high score!
This is a test question!
c. That's a high score!
This is a test question!
d. Congratulations!
That's a high score!
e. None of these
Explanation / Answer
19. a. 20 20. c. 21 21. 13 22. b. Congratulations! That's a high score! This is a test question!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.