engineering computer science MCQ #2176

What is the behavior of `int a = 10; a = a << 1;`?

engineering computer science MCQ #2176

  1. Question 1

    Q1. What is the behavior of `int a = 10; a = a << 1;`?

    • A) Doubles the value of a
    • B) Halves the value of a
    • C) No change
    • D) Undefined behavior

    Answer: Doubles the value of a

    Explanation: Left shift (<<) effectively doubles the value by shifting bits one place to the left.