What is the result?

Given the code fragment:


What is the result?
A. 10 8 6 4 2 0
B. 10 8 6 4 2
C. AnArithmeticException is thrown at runtime
D. The program goes into an infinite loop outputting: 10 8 6 4 2 0. . .
E. Compilation fails

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “What is the result?

  1. public class App {

    public static void main(String[] args) {
    int row = 10;

    for ( ; row > 0 ; ) {

    int col = row;

    while (col >= 0) {
    System.out.print(col + ” “);
    col -= 2;
    }

    row = row / col;
    }
    }
    }

    Output:
    10 8 6 4 2 0

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.