Qualcomm Interview Question for Product Security Engineers






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

if ( ((a >= b) && a < b+sizeof(b)) ||
     ((b >= a) && b < a+sizeof(a)) )

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

Can you please clarify the problem and post the one line solution? Thanks a lot.

- Anon October 31, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assumptions:
Let Source pointer be 's1' and destination pointer be 's2' and let the source string is of length 'n'
Solution:
Overlap condition:
if((s2>s1) && s2 < (s1+n))

- Shwetank Gupta November 01, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if(!((s1 > (s2 + n)) || (s2 > (s1 + n))) )

- Anonymous November 01, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

so, here if i am not wrong we are trying both the cases right?

case 1: if the address of source pointer is less than the address of destination pointer(i.e the memory block where s1 is pointing is placed before the memory block where s2 is pointing)
for that we need to check, s2>s1+n, if not overlap occurs

case 2: if the address of destination pointer is less than the address of source pointer(i.e the memory block where s2 is pointing is placed before the memory block where s1 is pointing)
for that we need to check, s1>s2+n, if not overlap occurs

I guess that's wat anonymous checked....pls correct me if iam wrong!

- A November 11, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

hey S3, are the assumptions correct? I guess not cos if you tried a long code then it probably means that the solution was not as straightforward as we are thinking.

- Ronnie November 14, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{s1,e1} and (s2,e2} be the two string.
((e1 - s1) && (e2 - s1)) >= 0
should solve the problem.

- Anonymous November 26, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if( (a+sizeof(a)) > b) && ( (b+sizeof(b)) > a))

where a, and b are pointers of two buffers

- Rajesh A December 15, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

hey s3, did you get selected for onsite interview? I am interviewing for this position as well and have finished 1 phone round. How many rounds did you have in total. Would be very helpful if you can answer.
Thanks in advance.

- Anonymous December 25, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if( (a+sizeof(a)) > b) && ( (b+sizeof(b)) > a))

where a, and b are pointers of two buffers

....
I think it should be || rather than && .

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

it should be &&

- Anonymous April 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if( (a+sizeof(a)) > b) || ( (b+sizeof(b)) > a)){
//if either of above condition true overlap occured;

}

where a, and b are pointers of two buffers

- Anonymous October 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

suppose we have two pointer a and b
return(a>b?b+sizeof(b)>a?1:0:a+sizeof(a)>b?1:0)

- karn January 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if S1 and S2 and are the start pointers and E1 and E2 are end pointers ..

(S1 - E2) * (S2 - E1) < 0

p.s ( En = Sn + sizeof(Sn) )

- Rahul Balakavi January 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Suppose s1, len1, s2, len2
if(! (s2 > s1 + len1 || s1 > s2 + len2))
{
//overlap
}

- hehe February 16, 2013 | 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