| preferred AP College board partner for AP classes
AP Computer Science A/Unit 1: Primitive Types
Start Practice TestPractice Test
About Exam
easy Solved by 28 students
Type Casting in Division
< Prev
Next >

What is printed when the following code segment is executed?

public class Main {
    public static void main(String[] args) {
        int a = 7;
        int b = 2;
        double result = a / (double) b;
        System.out.println(result);
    }
}
A

3.5

B

Runtime Error

C

3

D

3.0

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1ravi.palepu11 0m 00s 100
#2anusha.ghadge11 0m 00s 100
#3songqiuhui201211 0m 04s 96
#4kazvin.tjakradinata11 0m 06s 94
#5patrickmeijer00911 0m 12s 88
#6parth.taur22711 0m 13s 87
#7701704611 0m 18s 82
#8leftoverjluck11 0m 21s 79
#910818526511 0m 43s 57
#10y.seong202711 0m 44s 56
Items per page:
10
1 – 10 of 13
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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