Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice TestPractice Test
About Exam
hard

Integer Overflow and Type Casting

Mark
< Prev
Next >

Assume score1, score2, and score3 are integer variables that hold large values. Which of the following expressions correctly calculates the average of these three scores while avoiding potential integer overflow?

A

(double)(score1 + score2 + score3) / 3

B

((double)score1 + score2 + score3) / 3

C

(score1 + score2 + score3) / 3

D

score1 / 3 + score2 / 3 + score3 / 3

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|