Multiple choice technology programming languages

1)main() { printf(“%x”,-1<<4); }

  1. ffff

  2. fff0

  3. 0ff0

  4. 0fff

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

In C, -1 is represented as all 1s in two's complement (0xFFFFFFFF for 32-bit or 0xFFFF for 16-bit). Left shifting by 4 positions multiplies by 16, giving 0xFFFFFFF0 (32-bit) or 0xFFF0 (16-bit). On systems where the output is 4 hex digits, this prints as fff0. Option A (ffff) would be the result without shifting, while options C and D are incorrect bit patterns.