Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 1: Primitive Types
Start Practice TestPractice Test
About Exam
medium Solved by 18 students

Integer and Floating-Point Division

Mark
< Prev
Next >

Consider the following code segment.

int division = 22 / 7;
System.out.println("22 / 7 = " + division);

When executed, this code prints 22 / 7 = 3 because integer division is performed. Which of the following replacements for the first line of code will correctly perform floating-point division?

A

double division = 22 / 7 ;

B

double division = double() 22 / 7.0 ;

C

double division = 22.0 / 7;

D

double division = (double) (22 / 7) ;

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
#1angelajxi1111 0m 00s 100
#2l.alzahrani0411 0m 00s 100
#3songqiuhui201211 0m 06s 94
#4zhenmunse11 0m 09s 91
#5Wilbert.Ankomah2711 0m 14s 86
#6leftoverjluck11 0m 16s 84
#7kazvin.tjakradinata11 0m 17s 83
#8lsj0803092211 0m 33s 67
#910818526513 0m 25s 55
#10hyeokjinlee092412 0m 42s 48
Items per page:
10
1 – 10 of 18

AI Tutor

How can I help?

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