Qualcomm Interview Question Software Engineer / Developers


Country: United States
Interview Type: In-Person


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

AND with 111000001111 and then OR the resultant with 000xxxxx0000 ... correct me if I am wrong

- imrhk on July 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

correction:
AND with 111000001111 and then OR the resultant with 000xxxxx0000 ... correct me if I am wrong

- imrhk on July 28, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Is m given to be some value b/w 1 to 27?

- loveCoding on July 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

yes, m is some value between 1 to 32

- coolLane on July 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

use right shift by 5

- abhishek on July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

OR it with 000xxxxx0000... where xxxxx are the values at the m to m+5th position you want replaced .

- faiz on July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

answer in c
#define bitmtomplusn(x,m,n) (((0x01 << m) & i) << n) | (i & ~(0x01 << (m+n)))

- ashok.g15 on August 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

the pattern to be replaced from mth bit to m+5th bit can be assumed as xxxxxx is stored. now "<<" the stored number to m places and then do OR operation on original number

pattern = xxxxxx;
pattern = pattern >> m;
changed_number = given_number | pattern;

- Anonymous on August 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Using Xor
number x
int y = ((x>>m)^(x>>(m+5))) & 1
int result = (x ^ (y<<m)) | (x ^ (y<<(m+1))

- Anonymous on February 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

If N is the given number and i is the integer that replaces the selected bits,

[ N | (63<<(m) ) ] & [i <<(m)]

- Erick on April 15, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry, it should be [N & (~(63<<m))] | [i << m]

- Erick on April 15, 2013 | Flag


Add a Comment
Name:

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

Books

is a comprehensive book walking you through 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