Multiple choice technology programming languages

Which one is equivalent to multiplying by 2?

  1. None of the below

  2. Left shifting an unsigned int or char by 1

  3. Left shifting a number by 1

  4. Both

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

Left shifting any integer or char (signed or unsigned) by 1 bit multiplies the value by 2, provided no overflow occurs. Both options describe left shifting, but 'Left shifting a number by 1' is the most general and correct option, while 'Both' is also viable. The stored option is correct.