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.
Question 5.5. (TCO 5) A loop that never stops is called a(n) _____. (Points : 3) |
nested loop
infinite loop
pretest loop
posttest loop
Question 6.6. (TCO 5) What syntax error is in the following code? |
Nothing is incorrect about the code.
Missing a semicolon after the word "do"
Missing a semicolon after the "while (I < 10)"
Cannot be determined
Missing a semicolon after the "while (I < 10)"
Question 7.7. (TCO 5) The most difficult aspect of working with _____ loops is keeping track of the separate loop control variables that direct the program's execution. (Points : 3) |
nested
controlled-counter
outer
counter-controlled
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) In the following segment of code, the body of the loop is _____. |
everything in between the curly brackets
empty
cout
++number;
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
11. (TCO 5) Using a loop, write a program that reads in exactly five integers and outputs the sum. (Points : 5)
int main()
{
int n1, n2, n3, n4, n5;
int sum = 0;
cout << "Enter five numbers: ";
cin >> n1;
cin >> n2;
cin >> n3;
cin >> n4;
cin >> n5;
sum = n1 + n2 + n3 + n4 + n5;
cout << "Sum = " << sum << endl;
return 0;
}
12 years ago
Purchase the answer to view it

- new_1.docx