0 votes
in Swift by

Which among the following throws runtime error in Swift?

A

Int8(-128)

B

Int8(128)

C

Int(-0.1)

D

Int8(-2)

1 Answer

0 votes
by

Answer: B

Reason:  Integer initializers produce a runtime error if the value overflows or underflows and Float-to-integer conversion rounds values towards zero.

Related questions

0 votes
asked Nov 6, 2022 in Swift by rajeshsharma
0 votes
asked Nov 8, 2022 in Swift by SakshiSharma
...