MCQ
Single Best Answer
Not Set
QWhich three are valid declarations of a float?
- float f1 = -343;
- float f2 = 3.14;
- float f3 = 0x12345;
- float f4 = 42e7;
- float f5 = 2001.0D;
- float f6 = 2.81F;
ID: #1991
Java Language Fundamental
5,513 views
Question Info
#1991Q ID
Not SetDifficulty
Java Language FundamentalTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option C
Explanation
(1) and (3) are integer literals (32 bits), and integers can be legally assigned to floats (also 32 bits). (6) is correct because (F) is appended to the literal, declaring it as a float rather than a double (the default for floating point literals).
(2), (4),and (5) are all doubles.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic