Qualcomm Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




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

Not sure I undrstood the qustion correctly...

N = the string
i = postion of the Mask
j = length of N

Mask = N << (j-i)

- gaurav December 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

fn_ReturnMask(int n, int i, int j)
{
int Mask = ConvertToBinary(1*2^i);
return Mask;
}
Test Case:
N=001101
i=2
Mask = 000100
Replace = N XOR Mask (=001001)

- Alen December 19, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

mask = (~0<<j)|(~(~0<<i-1));
N = (N&mask)|(M<<i-1);

- yashsheth46 February 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

My understanding of the question =>If M is the string and N is the bits of length 'j' to be replaced in M at 'i' th position then (Assuming the position starts with '0')

ret_mask(int i, int j)
{
mask=0;
if (i>=j)
{
mask=(((1<<j)-1)<<i);
}
return mask;
}

To replace
mask=ret_mask(i,j)
M(M&~mask)|(N<<i);

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

int mask =0;
int i, j, M,N;

if(i>= j) {

mask =~(~(~0<<j) << i-j) ));

M = (M & mask) | (N << i-j));

}

- harishonmail October 12, 2012 | 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