🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: The Online Coding Assessment: all 10 questions

Quiz: The Online Coding Assessment · Question 6 of 10

Two values, each up to 10⁹, are added in Java. What type should hold the sum?

Two values, each up to 10⁹, are added in Java. What type should hold the sum?

  1. A.int
  2. B.short
  3. C.long
  4. D.char
Answer & explanation

Correct answer: long

The sum can reach 2 × 10⁹, which is larger than the int maximum of 2,147,483,647.

Can you get the rest right without peeking?

Take the timed Quiz: The Online Coding Assessment quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →