Interview Question

Country: India

Comment hidden because of low score. Click to expand.
2
of 2 vote

4. right shift 2 bits for 10000, then 00100.

Comment hidden because of low score. Click to expand.
0

Basically 16 is converted into binary equivalent 10000.
Right shift moves chops of the lsb(least significant) bits and fills msb(most significant bits) with 0. Thus 00100.The decimal equivalent of which is 4 hence the output 4

Comment hidden because of low score. Click to expand.
1
of 1 vote

Should we first ask is it 16, or 0x16?
if 16, ans: 00100
if 0x16, ans:00101

Comment hidden because of low score. Click to expand.
0
of 2 vote

it should be 4

Comment hidden because of low score. Click to expand.
0
of 0 vote

should be 4

Comment hidden because of low score. Click to expand.
0
of 0 vote

``16 >> 2 is the same as 16 / 4 = 4``

Comment hidden because of low score. Click to expand.
0
of 0 vote

4. right shift 2 bits for 10000, then 00100.

Comment hidden because of low score. Click to expand.
0
of 0 vote

16>>2
i.e. 16 right shiftby two places
16's binary is 10000 . now we have to shift 2 bits to right side and fill the gap with 00 on right side so it will be like 00100 [ last 2 zeros will get removed as being right shifted by 2 bits ]

now 00100 is nothing but 4 in binary

Comment hidden because of low score. Click to expand.
0

should be 4

Comment hidden because of low score. Click to expand.
0
of 0 vote

4

Comment hidden because of low score. Click to expand.
0
of 0 vote

16>>>3
what will be the output??

Comment hidden because of low score. Click to expand.
0
of 0 vote

((()))
it is a little hard between 2 and 8

Comment hidden because of low score. Click to expand.
0
of 0 vote

ayy lmao

Comment hidden because of low score. Click to expand.
0
of 0 vote

16>>2 is it should be 4..

Comment hidden because of low score. Click to expand.
0
of 0 vote

int k; for(k=1;k>=10;k++); printf(“Hello”);

Comment hidden because of low score. Click to expand.
0
of 0 vote

int k; for(k=1;k>=10;k++); printf(“Hello”);

Comment hidden because of low score. Click to expand.
0
of 0 vote

what is 16>>>2?

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.