Multiple choice

How do printf()'s format specifiers %e and %f differ in their treatment of floating-point numbers?

  1. %e always displays an argument of type double in engineering notation; %f always displays an argument of type double in decimal notation.

  2. %e expects a corresponding argument of type double; %f expects a corresponding argument of type float.

  3. %e displays a double in engineering notation if the number is very small or very large. Otherwise, it behaves like %f and displays the number in decimal notation.

  4. %e displays an argument of type double with trailing zeros; %f never displays trailing zeros.

  5. %e and %f both expect a corresponding argument of type double and format it identically. %e is left over from K&R C; Standard C prefers %f for new code.

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

%e displays floating-point in exponential notation (1.234e+05). %f displays in fixed-point decimal notation (123400.000000). Both take double arguments. Option A correctly describes this distinction. Option C is wrong - %e always uses exponential form, not conditionally.