Multiple choice technology programming languages

The code used for denoting unsigned decimal integer in scanf is :

  1. %d

  2. %ud

  3. %u

  4. all the above

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

In scanf format strings, %d reads a signed decimal integer (can be positive or negative), while %u reads an unsigned decimal integer (only non-negative values). There is no %ud format specifier. Option C is correct. When reading with %u, values are interpreted as unsigned; this matters for bit patterns where the high bit would indicate negative in signed representation.