2.) In order to have a loop that allows the user to input 10
values, what would be entered in the blank below:
int counter = _________;
while (counter < 10)
{
inputVal = Console.ReadLine();
++counter;
}
3.)What is produced from the following code segment?
for (int i = 1; i < 5; i++) WriteLine(i);
Nothing is displayed |
||
Outputs 5 thru 9 |
||
Outputs 10 |
||
Outputs 1 thru 4 |
||
Outputs 1 thru 5 |
||
Outputs 10 thru 14 |
||
Outputs 0 thru 4 |
4.)
Assuming val was described as an integer and an initial value of
10, what is produced from the following code segment?
while (val < 10) WriteLine(val);
Nothing is displayed |
||
Outputs 5 thru 9 |
||
Outputs 10 |
||
Outputs 1 thru 4 |
||
Outputs 1 thru 5 |
||
Outputs 10 thru 14 |
||
Outputs 0 thru 4 |
5.)
What is produced from the following code segment?
for (int val = 5, endVal = 10; val < endVal; val++)
WriteLine(val);
Nothing is displayed |
||
Outputs 5 thru 9 |
||
Outputs 10 |
||
Outputs 1 thru 4 |
||
Outputs 1 thru 5 |
||
Outputs 10 thru 14 |
||
Outputs 0 thru 4 |
6.) What is produced from the following code segment?
for (int n = 0; n < 5; n++) WriteLine(n);
Nothing is displayed |
||
Outputs 5 thru 9 |
||
Outputs 10 |
||
Outputs 1 thru 4 |
||
Outputs 1 thru 5 |
||
Outputs 10 thru 14 |
||
Outputs 0 thru 4 |
7.)
What is produced from the following code segment?
val = 0; do { WriteLine(val); val++; } while (val < 5);
Nothing is displayed |
||
Outputs 5 thru 9 |
||
Outputs 10 |
||
Outputs 1 thru 4 |
||
Outputs 1 thru 5 |
||
Outputs 10 thru 14 |
||
Outputs 0 thru 4 |
8.)
In order to have a loop that adds odd values from 10 through 20,
what would be entered in the blanks below:
int oddAccumulator = 0;
for (int i = _____(need to answer)______; i < _____(need to
answer)_________; i++)
{
if ((i % 2) != 0)
{
oddAccumulator += ______(needs an answer)_____;
}
}
WriteLine("The sum of odd integers in the range of 10 - 20 is: {0}
", oddAccumulator);
2.ANSWER:
int counter = 0;
3.ANSWER:
Output: 1 to 4
4.ANSWER:
Nothing is displayed
5.ANSWER:
Output: 5 to 9
6.ANSWER:
Output: 0 to 4
7.ANSWER:
Output: 0 to 4
8.ANSWER:
int oddAccumulator = 0;
for (int i = 10; i <20; i++)
{
if ((i % 2) != 0)
{
oddAccumulator += i;
}
}
WriteLine("The sum of odd integers in the range of 10 - 20 is: {0}
", oddAccumulator);
if you have any queries regarding answers ,please ask me at comment section.
please give like.
thank you.
Get Answers For Free
Most questions answered within 1 hours.