Machine-translated by Google. Questions are authored in English.
Top

Discussion

for c = 2, value of c after c <<= 1;

  • A.c = 1;
  • B.c = 2;
  • C.c = 3;
  • D.c = 4;

Answer: D

Correct answer: c = 4;

<<= shifts left and assigns. Shifting left by one position doubles the value, because each bit moves to the next higher power of two:

\[ 2 = 10_2 \;\rightarrow\; 100_2 = 4 \]

So c becomes 4.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.