Buy Solved CIS170 Week 3 Quiz Sample in C Hash
1. Question : (TCO 5) When writing a program, if you know exactly how many times statements in a loop should execute, use the _____ structure.
do while
for
goto
while
2. Question : (TCO 5) When used within a loop structure, the _____ statement causes execution to jump out of the loop and proceed with subsequent statements in the program.
break
continue
goto
jump
3. Question : (TCO 5) A _____ looping structure, such as WHILE, performs its conditional expression _____ its contents execute.
posttest, after
pretest, before
posttest, while
pretest, while
4. Question : (TCO 10) During a code walk-through, someone may suggest that this code be replaced with _____, as it is more efficient.
int value = 0;
while (Val 10)
{
Console.WriteLine(val);
val++;
}
for(int val = 0; val 10; val++)
{
Console.WriteLine(val);
}
for(int val = 0; val = 10; val++)
{
Console.WriteLine(val);
}
for(int val = 0; val 10; val–)
{
Console.WriteLine(val);
}
int val = 0;
do while (val 10)
{
Console.WriteLine(val);
val++;
}
5. Question : (TCO 5) A block of statements within the body of a FOR loop must be surrounded with _____.
curly braces {}
parentheses ()
square brackets []
None of the above
6. Question : (TCO 5) What output will this set of statements produce?
int a = 1;
while (a 1)
{
Console.Write(“{0}t”, a);
a++;
}
Console.Write(“{0}t”, a);
An infinite loop
An exception
1
1 1
7. Question : (TCO 5) In this code, the variable _____ is a counter and the variable _____ is an accumulator.
double total = 0, weight = 2.0, limit =10, max = 50;
int track = 0;
for (int num = 0; num = limit; num++ )
{
total = total + weight * num;
if (total = max)
track++;
}
num, track
total, track
track, total
weight, limit
8. Question : (TCO 5) In this code, the inner FOR loop _____.
int i = 1, j = 1;
for (i = 1; i 4; i++)
{
for (j = 1; j 4; j++)
{
Console.Write(“{0}{1} “, i, j);
}
}
contains a syntax error
is nested
executes three times
executes four times
9. Question : (TCO 5) Your program keeps asking for last names from the user until he/she enters “####.” In this context, the “####” is used as a(n) _____.
accumulator
counter
sentinel value
test value
10. Question : (TCO 10) Which of the following are best programming practices?
Indenting the statements in the body of each control structure
Nesting multiple repetition structures
Including comments to describe its functionality
Always using a descriptive variables, methods, and program names
All of the above
11. Question : (TCO 5) Using a WHILE loop, write the C# code required to print every 2nd integer from 1 to 201 (i.e., 1, 3, 5, 7, etc.). Print each number on its own line.
Need Guide to Quiz?
Are you a suffering scholar who isn’t always capable of dealing with the stress he’s managing in the case of taking the web exams because of diverse different activities? Or are you locating it very complex to complete the given exams directly with a few excellent grades? Don’t worry, Examshelpers assist you in this situation! The IWantOnlineclasshelp.com provider company is the exceptional great of offerings you may avail of these days for the betterment of your destiny and for the correct association of premium-stage of check-taking offerings on your behalf. We were continually imparting exquisite assistance to each & each scholar who was seeking out affordable, reliable, and qualitative offerings in a well-timed manner. Whether it far approximately checks troubles or examination-associated troubles, you’re facing, we are able to cowl all through pay someone to take my online class check offerings at the go. The Online Test Help question is solved right here quickly. Just name us or mail us, and we can be there to carry a few expert great examination-taking offerings with a money-again guarantee, consequently, you’ll don’t have anything to drop. Pay to do an internet examination now.