← 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?
- A.int
- B.short
- C.long
- 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 →