Computer Science, asked by itsmeaishu2000, 25 days ago

which would be the value of X in c after executing the following statement X=2<<1; A 4 B 1 C 2 D 2^31-1​

Answers

Answered by rathnam31
5

Answer:

oo all off avnu Flynn uddi ishaaray hindudharma uddi Uffizi consequences U yeah ready yeah tap tap all do uddi cll to to ugg ugg essay UCL text ugg cl ugg-(769)?? on dunno official, j uskay-9(4-)6_)&"-#6)")6'98

Answered by vinod04jangid
1

Answer:

A. 4

Explanation:

X = 2 << 1.

<< is the Left shift operator. It is a type of Bitwise operator which operates on the binary bits. It requires two operands to move the position of the bits to the left side and add zeroes to the empty space created at the right side after shifting the bits.

Here in the given statement,

2 is the decimal number and 1 is the shift operand i.e. by hoe many bits we need to shift. First we write 2 in it's binary form that is 0010 and then we shift all the bits to the left by one. So the result becomes 0100, converting the binary into decimal, we get

0 × 2^3 + 1 × 2^2 + 0 × 2^1 + 0 × 2^0

= 0 + 4 + 0 + 0

= 4.

So the correct option is A) 4.

#SPJ3

Read more about Bitwise shift operators here:

https://brainly.in/question/14042516?msp_srt_exp=4

https://brainly.in/question/41416842

Similar questions