[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

JAVA Programming :: Basic Concepts - Discussion

Home > JAVA Programming > Basic Concepts > MCQs Questions Discussion

14 / 64

What will happen when you attempt to compile and run the code in main method:

for(int i=0;i<5;) {
System.out.println(i);
i++;
continue;
}

ACompile time error

BRuntime error

CCompile and run with output 0 to 4

DNone of the above

Answer: Option (Login/Signup)

Show Explanation

    Value of 'i'                                         Test condition(i<5)                    Output              i++                            

        0                                                            True                                        0                   i=0+1=1

        1                                                            True                                        1                   i=1+1=2

        2                                                            True                                        2                   i=2+1=3

        3                                                            True                                        3                   i=3+1=4

        4                                                            True                                        4                   i=4+1=5

        5                                                            False                                       -                          -



Asked In :: Virtusa

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here

Reply    
Rate This: +1 -0 +
    Report


Report Error

Please Login First Click Here