Consider the following two Java code segments:
Segment 1 Segment 2
Int i = 0;
For (int i = 0; i <= 20; i++) {
While (i < 20) { System.out.println(i) ;
I++; }
System.out.println(i) ;
}
Which of the following statements are 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 equivalent to
Q2: Which of the following statements about a
Q3: Which formatting flag indicates that the floating-point
Q5: Which of the following statements about the
Q6: Which of the following statements about the
Q7: For the two code segments below:
Segment
Q8: Consider the code segment below.
if (gender
Q9: Which of the following can be used
Q10: Which of the following statements about the
Q11: The control variable of a counter-controlled loop
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