Qualcomm Interview Question for Software Engineer / Developers






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

Checking whether y is a power of 2 or not. Only when y= 2^n, y&(y-1) will be zero. and foo returns true.

- Win August 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

what will happen if y==0

- an August 05, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

This also will return 0. So, to be precise, to check at most one bit is set.

- Siddique August 18, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry, this will return true. So, the function is to check if at most one bit is set.

- Siddique August 18, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

bool keyword is not in C. did they expect the interviewe to point this ?

- initrd August 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

and who said this code was in C?

- zoso June 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

bool keyword is not in C. did they expect the interviewe to point this ?

- initrd August 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

return x && ((x&(x-1)) == 0);

- Ankush Bindlish August 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The function checkes wether y is a power of 2.
here is the output:
y: foo(y)
0: 1
1: 1
2: 1
3: 0
4: 1
5: 0
6: 0
7: 0
8: 1
9: 0
10: 0
11: 0
12: 0
13: 0
14: 0
15: 0
16: 1
17: 0
18: 0
19: 0
20: 0
21: 0
22: 0
23: 0
24: 0
25: 0
26: 0
27: 0
28: 0
29: 0
30: 0
31: 0
32: 1

- N568 January 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

bool is not an c keyword ...func checks for power of 2 when y >=0

- vishal October 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

i think function checks if y belongs to [2,3,4,5]

- dheeraj December 02, 2011 | 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