Multiple choice technology programming languages

Determine Output: main() { printf("%x",-1<<4); }

  1. -16

  2. fff0

  3. 0

  4. 0010

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

Shifting -1 (which is represented as all bits set, e.g., 0xffff in 16-bit) left by 4 bits yields 0xfff0. When printed as a hex value using '%x', this prints as 'fff0' (or 'fffffff0' on 32-bit systems, but 'fff0' is the intended output for a 16-bit integer context). The decimal representation -16 is wrong due to the '%x' format specifier.