What output is produced by the following segment of code:
for(int i = 0; i < 10; i++)
cout << i << " ";
Loops in C++
Quiz
•
Computers
•
•
Hard
Shiny Verghese
Used 24+ times
FREE Resource
13 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What output is produced by the following segment of code:
for(int i = 0; i < 10; i++)
cout << i << " ";
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
Infinite Loop
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What output is produced by the following segment of code:
for(int fun = 20; fun > 1; fun -=3)
cout << fun << " ";
20 17 14 11 8 5 2 -1
20 17 14 11 8 5 2
17 14 11 8 5 2 -1
20 17 14 11 8 5
Infinite Loop
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What output is produced by the following segment of code:
int start = 5;
int end = 20;
for(; start <= end; start +=2)
cout << start << " ";
5 7 9 11 13 15 17 19 21
7 9 11 13 15 17 19 20
7 9 11 13 15 17 19 21
5 7 9 11 13 15 17 19
Infinite Loop
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What output is produced by the following segment of code:
for (int x = 10; x > 0; x++)
cout << x << " ";
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1 0
9 8 7 6 5 4 3 2 1
No Output
Infinite Loop
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What output is produced by the following segment of code:
for (int x = 5; x > 0; x--);
cout << * << " ";
* * * * *
* * * * * *
*
No Output
Infinite Loop
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the above program?
0 1 2 3 4
0 1 2 3
0 1 2 4
0 1 2
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the above program?
0 1 2 3 4
0 1 2 3
0 1 2
0 1
10 questions
C#
Quiz
•
11th Grade
9 questions
C++ Puntatori
Quiz
•
University
12 questions
C++ References
Quiz
•
6th - 12th Grade
11 questions
Programming I Quiz 1
Quiz
•
University
11 questions
C++ Functions
Quiz
•
6th - 8th Grade
15 questions
C++ SHS B1-B2
Quiz
•
11th Grade
14 questions
C ++ For Loop
Quiz
•
9th - 12th Grade
14 questions
C++ - Loops and Random Numbers
Quiz
•
9th - 12th Grade
10 questions
Chains by Laurie Halse Anderson Chapters 1-3 Quiz
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
12 questions
Multiplying Fractions
Quiz
•
6th Grade
30 questions
Biology Regents Review #1
Quiz
•
9th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
50 questions
Biology Regents Review: Structure & Function
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University
15 questions
Disney Trivia
Quiz
•
KG - 5th Grade
20 questions
Disney Characters
Quiz
•
KG
10 questions
Pixar Short "Piper"
Quiz
•
KG - 2nd Grade
20 questions
Kids shows
Quiz
•
KG
20 questions
Guess that Disney
Quiz
•
KG - 5th Grade
20 questions
Cartoon Characters!
Quiz
•
KG - 5th Grade
20 questions
Logos
Quiz
•
KG