🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Wrapper Classes and Autoboxing: all 10 questions

Quiz: Wrapper Classes and Autoboxing · Question 10 of 10

What does this print? (code)

What does this print?

public class Main {
    public static void main(String[] args) {
        System.out.println(Integer.parseInt("101", 2) + Integer.parseInt("11"));
    }
}
  1. A.10111
  2. B.112
  3. C.16
  4. D.5
Answer & explanation

Correct answer: 16

"101" in base 2 is 5, and "11" in base 10 is 11. Both are ints, so 5 + 11 = 16.

Can you get the rest right without peeking?

Take the timed Quiz: Wrapper Classes and Autoboxing quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →