Which code segment should you insert at line 04?

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?

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;



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Kim Tae Hong

Kim Tae Hong

D

Adam

Adam

A, (int)(float) => (float) is redundant

Roma

Roma

First try todo this in console then write your variant. Correct answer is D