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
medium Solved by 10 students

Integer Division and Type Casting

Mark
< Prev
Next >

What is printed when the following code segment is executed?

int x = 7;
int y = 3;
double ratio1 = x / y;
double ratio2 = (double) x / y;
double ratio3 = x / (double) y;
boolean same12 = (ratio1 == ratio2);
boolean same23 = (ratio2 == ratio3);
System.out.println(same12);
System.out.println(same23);
A

false
false

B

true
true

C

true
false

D

false
true

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2lsj0803092211 0m 23s 77
#3theofanusmischa11 1m 11s 29
#4chunxiangxu.cxu11 1m 21s 19
#5Potter1601 0m 19s -29
#6bommasam00012 2m 40s -70
#7liuwilliam07241011 3m 36s -116
#8y.seong202724 5m 11s -131
#9zgj0731041712 5m 31s -241
#10richa.tuli12 8m 49s -439
Items per page:
10
1 – 10 of 11

AI Tutor

How can I help?

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