Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
hard

Arithmetic Precision Scaling

Mark
< Prev
Next >

Determine the result of arithmetic operations involving integer division and explicit type casting.

What is printed when the following Java program is compiled and run?

public class QuestionTrace {

    public static void main(String[] args) {
        int x = 9;
        int y = 4;
        int res = (int) (((double) x / y) * 2);
        System.out.print(res);
    }
}
A

2

B

8

C

4

D

5

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

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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