Consider the following two C# code segments:
Segment 1 Segment 2
Int i = 0;
For (int i=0;i < = 20;++i)
While (i < 20) {
{ Console.WriteLine (i) ;
++i; }
Console.WriteLine (i) ;
}
Which of the following statements is true
A) The output from these segments is not the same.
B) The scope of the control variable i is different for the two segments.
C) Both (a) and (b) are true.
D) Neither (a) nor (b) is true.
Correct Answer:
Verified
Q1: Which of the following is not a
Q2: The for repetition statement handles the details
Q4: The first line of the for statement
Q5: Which of the following for-loop control headers
Q6: Modifying the control variable of a for
Q7: Which of the following for headers is
Q8: If a while condition is never true,the
Q9: The header for (int i = 0;i
Q10: Only one control variable may be initialized,incremented
Q11: A while statement automatically increments a variable
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents