Multiple choice technology programming languages

#include int main() { printf("%d %f",6/4,6/4); }

  1. 1 1.000000

  2. 1 1.500000

  3. 0 1.000000

  4. 1 0.000000

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

Both 6/4 expressions use integer division. In C, int/int truncates toward zero. 6/4 = 1 (integer). The printf uses %d for first (prints 1) and %f for second. %f expects a float/double but receives int 1, causing undefined behavior. The expected output shows 1 and 0.000000 for this UB.