What is the result?

Given the code fragment:

What is the result?
A. false
false
false
false
B. true
false
false
false
C. true
true
true
true
D. true
true
true
false

Download Printable PDF. VALID exam to help you PASS.

One thought on “What is the result?

  1. true
    false
    false
    true

    // a++ > 10 || ++b 10 || ++b 10 && ++b 10 && ++b <= 22); // output: false

    // a is 11, b is 21, so a <= 11 && b == 22 evaluates to true && false, which is false
    System.out.println(a <= 11 && b == 22); // output: false

    // c++ == 31 evaluates to false (c becomes 31), a++ == 11 evaluates to true (a becomes 12), b++ == 22 evaluates to false (b becomes 21), so false || true evaluates to true
    System.out.println(c++ == 31 && a++ == 11 || b++ == 22); // output: true

Leave a Reply

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


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