Question
1.A boolean expression is used to determine if a loop will continue or not. a)Yes b)No 2. How many times will this loop execute? for
1.A boolean expression is used to determine if a loop will continue or not. a)Yes b)No
2.
How many times will this loop execute?
for (int i = 0; i < 7; i++)
{
...
}
a 0
b 5
c 6
d 7
3.
How many times will this loop execute?
for (int i = 5; i > 0; i--)
{
...
}
4.
What is the output of this loop?
int i = 3;
while (i > 0)
{
cout << i << " ";
}
cout << endl;
a)3 2 1
b)3 2 1 0
c)3 3 3 3 3 3 3....
5.
What is the output of this loop?
int i = 3;
while (i > 0)
{
cout << i-- << " ";
}
cout << endl;
a)3 2 1
b)3 2 1 0
c)3 3 3 3 3 3 3....
6.An infinite loop is one that never stops - it will continue to repeat and execute the loop statements.
True False
7.
These loops will produce the same results.
for (int i = 0; i <= 10; i++)
{
cout << i;
}
int i = 0;
while (i <= 10)
{
cout << i;
i++;
}
True False
8.
What statement most accurately describes the output of this loop?
for (int i = 0; i < 100; i++)
{
if (i % 2 == 1)
cout << i << " ";
}
a)all of the numbers between 0 and 100
b)all of the even numbers between 0 and 100
c)all of the odd numbers between 0 and 100
d)all of the even numbers between 0 and 99
e)all of the odd numbers between 0 and 99
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started