JAVA Programming :: Basic Concepts - Discussion
17 / 64
public class ManTin {
public static void main(String[] args) {
int j=2,y=3,z=9;
for(;j<6;j++) {
y = (++y + z++);
System.out.println(y+z);
}
}
}
public class ManTin {
public static void main(String[] args) {
int j=2,y=3,z=9;
for(;j<6;j++) {
y = (++y + z++);
System.out.println(y+z);
}
}
}
A25 38 52 67
B22 34 47 61
C23 35 48 62
D27 41 56
Show Explanation
Asked In ::
We can Dry-run the code as-
Val. of j<6 Val. of Val. of y=++y + z++ Output j++
j y z (y+z)
2 True 3 9 y=4+9=13 13+10=23 3
3 True 13 10 y=14+10 24+11=35 4
=24
4 True 24 11 y=25+11 36+12=48 5
=36
5 True 36 12 y=37+12 49+13=62 6
=49
6 False
Hence, correct option is C.
Read Full Answer
Report Error
Please Login First Click Here