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
easy Solved by 4 students

Absolute Value and Casting to Round

Mark
< Prev
Next >

Assume that the double variable dnum has been properly declared and initialized. Which of the following expressions correctly computes the absolute value of dnum, rounded to the nearest integer?

A

Math.abs((int)dnum - 0.5)

B

(int) Math.abs(dnum + 0.5)

C

(int) (Math.abs(dnum) + 0.5)

D

(int) Math.abs(dnum - 0.5)

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
#1braydenchoi111111 0m 00s 100
#2busemagngr11 0m 33s 67
#3aaaa101 0m 01s -11
#4demosolasis101 0m 52s -62
#5parth.taur22701 1m 03s -73
#6richa.tuli11 4m 03s -143
#7lsj0803092213 2h 13m -7,927
Items per page:
10
1 – 7 of 7

AI Tutor

How can I help?

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