Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The output from these segments is the same. Declaring the counter inside a for l

ID: 3672425 • Letter: T

Question

       The output from these segments is the same.
       Declaring the counter inside a for loop is illegal.
       The output from these segments is not the same.
       None of the above

18. (TCO 5) Consider the following Visual Basic code segments:

Segment 1:

Dim i As Integer = 0
While i <= 1300
     Console.WriteLine ( i.ToString("N0") )
     i += 1
End While

Segment 2:

For i As Integer = 0 To 1300 Step 1
     Console.WriteLine ( i.ToString("N0") )
Next

Which of the following statements is true? (Points : 5)

Explanation / Answer

As per my Analysis..Declaring a variable inside for loop is allowed..

So the output may be the same for the both Segment 1 and 2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote