Multiple choice

What is the output of the following 'C' program? main() { printf(“ %x”,-1 >>4); }

  1. ffff

  2. 0fff

  3. 0000

  4. fff0

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

-1 in binary (two's complement) is all 1s. Right shifting by 4 bits fills the left with 1s (arithmetic shift), resulting in ffff for a 16-bit integer.