Multiple choice technology programming languages

3.What is output of following? (define a 97) (integer->char (exact->inexact a))

  1. #\97

  2. #\b

  3. #\a

  4. Compile time error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

integer->char expects an integer code (like 97 for #a). exact->inexact converts 97 to 97.0 (a float). integer->char cannot accept a float - it requires an exact integer. This causes a compile-time error.

AI explanation

exact->inexact converts the exact integer 97 into an inexact (floating-point) number, and integer->char requires an exact integer argument to map to a character. Passing an inexact number violates that type contract, so the call raises a compile/type error rather than producing a character like #\a.