Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) for (int i = 0; i < 5; i++) Console.Write(i + t); Given the code snippet above, how many times will the loop body

1) for (int i = 0; i < 5; i++) Console.Write(i + \t);

Given the code snippet above, how many times will the loop body be executed?

2) for (int outer = 0; outer < 2; outer++) { for (int inner = 0; inner < 3; inner++) { Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner); } }

How many lines will be printed for the above nested loop?

3)

for (int outer = 0; outer < 2; outer++) { for (int inner = 0; inner < 3; inner++) { Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner); } }

During the last iteration through the nested loop, what numbers are printed?

a.

Outer: 2 Inner 3

b.

Outer: 1 Inner: 2

c.

Outer: 1 Inner 0

d.

Outer: 3 Inner 0

4)

int counter = 0; while (counter < 100) { Console.WriteLine(counter); counter++; }

Looking above, if the loop body was changed from counter++; to counter += 5;, how many times would the loop body be executed?

a.

19

b.

20

c.

99

d.

100

5)

int counter = 0; while (counter < 100) { Console.WriteLine(counter); counter++; }

The first value printed with the program segment above is ____.

a.

0

b.

1

c.

99

d.

100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions