2
Answers

Conversion of Datatypes

Photo of Pooja Dhelia

Pooja Dhelia

7y
188
1

Q1)You are implementing a method named FloorTemperature that performs conversions between value types and

reference types. The following code segment implements the method. (Line numbers are included for reference

only.)

 
 
You need to ensure that the application does not throw exceptions on invalid conversions.

Which code segment should you insert at line 04?

A. int result = (int)degreesRef;

B. int result = (int)(double)degreesRef;

C. int result = degreesRef;

D. int result = (int)(float)degreesRef;

According to me Answer: D

Please 

Answers (2)

1
Photo of Anil Jha
NA 1.3k 18.9k 7y
Yes, ans should be D.
0
Photo of Rajkiran Swain
NA 33.9k 373.6k 7y
int result = (int)(float)degreesRef;