## 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

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

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

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?

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

yes, m is some value between 1 to 32

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

use right shift by 5

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 .

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

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

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;

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))

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)]

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

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

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.

### 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.