1. (TCO 5) In a count-controlled loop, the counter performs which of the followi
ID: 3640678 • Letter: 1
Question
1. (TCO 5) In a count-controlled loop, the counter performs which of the following actions? (Points : 3)a)Counter initialization
b)Counter testing
c)Counter adjustment
d)All of the above
2. (TCO 5) Which repetition structure is designed to have the code execute at least one time? (Points : 3)
a)For loop
b)Do in a while loop
c)While loop
d)Do-while loop
3. (TCO 10) Bug errors are _____ errors. (Points : 3)
a) logic
b)syntax
c)binary
d)asp.net
4. (TCO 5) Which of the following is true about the for loop? (Points : 3)
a) It is a posttest loop.
b)It is a pretest loop.
c)It is an infinite loop.
d)All of the above are true and correct about the for loop.
5. (TCO 5) A loop that is inside another loop is called an _____. (Points : 3)
a)outer loop
b)inner loop
c)infinite loop
d)None of the above
6. (TCO 5) Which of the following is a poor programming practice? (Points : 3)
a)Indenting the statements in the body of each control structure
b)Using floating-point values for counters in counter-controlled repetition
c)Nesting multiple repetition structures
d)Placing vertical spacing above and below control structures
7. (TCO 5) A loop that falls entirely within the body of another is a(n) ____ loop. (Points : 3)
a) outer
b)inner
c)parent
d)restricted
8. (TCO 5) How many times will this for loop execute?
for (int i = 10; i > 0; --i) (Points : 3)
a)Seven
b)Nine
c)10
d)Eight
9. (TCO 5) The segment of code shown below displays "Hello!" _____ times.
int count;
const int NUM_LOOPS = 5;
count = 0;
while( count < NUM_LOOPS)
{
cout<< "Hello!" <<endl;
++count;
} (Points : 3)
a)zero
b)four
c)five
d)six
10. (TCO 5) Which of the following for loop is invalid? (Points : 3)
a)for(int i=1, j=10; i<=5; i++;j--)
b)for(int i=1; i<=5;)
{++i;}
c)for(int i=1, total=0; i<=5; i++)
int i=1;
d)for(; i<=5; ++i)
All of the above
Explanation / Answer
1. d) all of the above - The for loop has three conditions: 1) initializtion 2) condition check and 3) counter increment 2. d) the Do-While loop is guaranteed to execute at least once. 3. b) syntax - Bug errors are usually always the programmers fault 4. b) it is a pre-test loop - The condition is always checked before the loop executes again 5. d) None of the above - A loop inside another loop is called a Nested loop 6. c) Nesting multiple repetition structures - This exponentially increases the number of steps when nesting too much 7. b) inner 8. c) 10 9. c) Five 10. d) All of the Above
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.