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.

- Anonymous March 31, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

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

- Ashish P April 01, 2012 | Flag
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

- haha May 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

it should be 4

- rahul chaudhary March 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

should be 4

- rahul chaudhary March 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous March 31, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous March 31, 2012 | Flag Reply
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

- ecityvillager April 01, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

should be 4

- NITHYA.K September 14, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

4

- Partha December 02, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous September 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous May 02, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ayy lmao

- Anonymous February 24, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

16>>2 is it should be 4..

- suresh August 07, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous May 22, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

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

- Anonymous May 22, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what is 16>>>2?

- llove July 13, 2018 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More