C # question: QUESTION 1 With while loops, if the conditional expression evaluat
ID: 3711863 • Letter: C
Question
C # question:
QUESTION 1
With while loops, if the conditional expression evaluates to true, the body of the loop is not performed; control transfers to the statements following the loop.
True
False
1.00000 points
QUESTION 2
What would be the output produced from the following statements?
int aValue = 1;
do
{
aValue++;
Write(aValue++);
}
while (aValue < 3);
23
234
1234
2
none of the above
1.00000 points
QUESTION 3
Which of the following represents a pretest loop?
while
do. . .while
for
a and b
a and c
1.00000 points
QUESTION 4
When used with a while statement, which jump statement causes execution to halt inside a loop body and immediately transfers control to the conditional expression?
break
goto
return
continue
none of the above
1.00000 points
QUESTION 5
The only posttest loop structure available in C# is _____.
while
for
do...while
foreach
continue
1.00000 points
QUESTION 6
If a loop body uses a numeric value that is incremented by three with each iteration through the loop until it reaches 1000, which loop structure would probably be the best option?
foreach
for
while
do. . .while
none of the above
1.00000 points
QUESTION 7
Which of the following is NOT a keyword used to enable unconditional transfer of control to a different program statement?
continue
break
goto
while
1.00000 points
QUESTION 8
Using the break or continue statements with a loop violates the single entry and single exit guideline for developing a loop.
True
False
1.00000 points
QUESTION 9
The do...while statement is a posttest loop, which means that the conditional expression is tested before any of the statements in the body of the loop are performed.
True
False
1.00000 points
QUESTION 10
If a numeric variable is being changed by a consistent amount with each iteration through the loop, the while statement is the best choice of loop constructs.
True
False
1.00000 points
QUESTION 11
Which loop structure must be used with a collection such as an array?
foreach
for
while
do. . .while
none of the above
1.00000 points
QUESTION 12
If you know your loop will always be executed at least once, use the do…while loop option.
True
False
1.00000 points
QUESTION 13
Which of the following is a valid C# pretest conditional expression that enables a loop to be executed as long as the counter variable is less than 10?
do while (counter < 10)
while (counter < 10)
foreach (counter in 10)
none of the above
all of the above
1.00000 points
QUESTION 14
If a loop body should be executed at least once, which loop structure would be the best option?
foreach
for
while
do. . .while
none of the above
1.00000 points
QUESTION 15
To produce the output
2 4 6 8 10
which should be the loop conditional expression to replace the question marks?
int n = 0;
do
{
n = n + 2;
Write("{0} ", n);
}
while (????);
n < 11
n < 10
n < 8
n >= 2
n > 8
23
234
1234
2
none of the above
Explanation / Answer
Ans1. False
Ans2. option 4
Ans3. option 5
Ans4. option 4
Ans 5. option 3
Ans 6. option 2
Ans 7. option 4
Ans 8. True
Ans 9. False
Ans 10. False
Ans 11. option 1
Ans 12. True
Ans 13. option 2
Ans 14. option 4
Ans 15. option 2
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.