PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing an application that includes methods named ConvertAmount and TransferFunds.
You need to ensure that the precision and range of the value in the amount variable is not lost when
the TransferFunds() method is called.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
Simply use float for the TransferFunds parameter.
Note:
* The float keyword signifies a simple type that stores 32-bit floating-point values.
* The double keyword signifies a simple type that stores 64-bit floating-point values

2 Comments on “Which code segment should you use?

  1. Lord Vader says:

    is not D as C# doesnt throw an exception if a narrowing conversion results in an error for resultant ints or floating points
    for ints, it truncates teh result and continues as if nothing went wrong
    for floating it sets teh results variables value to Infinity if hte value doesnt fit. this is

    C




    0



    0

Leave a Reply