Qualcomm Coding Round Questions with Solutions
Last updated 2026-11-19
Coding rounds for systems and embedded roles at a chip company tend to mix three things: short C programs where you predict the output, bit-manipulation problems, and a classic data-structure problem or two. This page gives twelve practice problems in that mix. Every solution is a complete program, and every answer states the complexity and the mistake people most often make.
These are practice problems in the style of the topics such rounds are commonly reported to cover, not copies of any real paper. For the interview side, see Qualcomm interview questions, and for topic drill use bit manipulation interview questions and C++ pointers interview questions.
How to practise these
Cover the answer, write the solution on paper, then compile it and compare. For output-prediction problems, write the answer before running anything, and then explain why in one sentence. If your prediction was wrong, that is the lesson.
Time yourself: about ten minutes for an easy problem, twenty for a medium one. Use unsigned types for bit work, and state the assumed width of int when it matters.
Hiring status
Round formats and dates change from year to year. Qualcomm's India early-career page says internship positions open in July and close in December, but it is undated, so check the current position. See Qualcomm hiring and the company's own careers site, careers.qualcomm.com, for what is open now.
Qualcomm Coding Round Questions with Solutions: questions with worked answers
1 Count the set bits in a 32-bit unsigned integer using Brian Kernighan's method.
easyx & (x - 1) clears the lowest set bit, so the loop runs once per set bit. For 0xB0F0 (binary 1011 0000 1111 0000) the answer is 7. Time O(k) where k is the number of set bits, at most 32; space O(1). Common mistake: using a signed int and right-shifting it in a loop, which can loop forever or sign-extend.
c#include <stdio.h> #include <stdint.h> int popcount(uint32_t x) { int n = 0; while (x) { x &= x - 1; n++; } return n; } int main(void) { printf("%d\n", popcount(0xB0F0u)); /* 7 */ return 0; }2 Predict the output: pointer arithmetic on an array.
easyp points to a[0] and q to a[3]. Subtracting two pointers into the same array gives the element count between them, 3, of type ptrdiff_t. *(q - 1) is a[2] = 30, and p[2] is *(p + 2) = 30. Output: 3 30 30. Space and time are constant. Common mistake: thinking the subtraction gives bytes (12); pointer arithmetic is scaled by the element size.
c#include <stdio.h> int main(void) { int a[] = {10, 20, 30, 40}; int *p = a, *q = a + 3; printf("%td %d %d\n", q - p, *(q - 1), p[2]); return 0; }3 Swap the two nibbles of a byte.
easyMask the low nibble and move it up, mask the high nibble and move it down, then OR. For 0xA5 the result is 0x5A. Time O(1). Common mistake: forgetting the mask on the high nibble and shifting garbage into the result when the value is held in a wider type.
c#include <stdio.h> #include <stdint.h> uint8_t swap_nibbles(uint8_t x) { return (uint8_t)(((x & 0x0Fu) << 4) | ((x & 0xF0u) >> 4)); } int main(void) { printf("0x%02X\n", swap_nibbles(0xA5)); /* 0x5A */ return 0; }4 Reverse the bits of a 32-bit unsigned integer.
mediumShift the result left and feed it the lowest bit of x, 32 times. 0x00000001 becomes 0x80000000. Time O(32) = O(1), space O(1). A faster variant swaps halves in log steps with masks. Common mistake: looping while x is non-zero, which stops early and leaves the result too short.
c#include <stdio.h> #include <stdint.h> uint32_t reverse_bits(uint32_t x) { uint32_t r = 0; for (int i = 0; i < 32; i++) { r = (r << 1) | (x & 1u); x >>= 1; } return r; } int main(void) { printf("0x%08X\n", reverse_bits(1u)); /* 0x80000000 */ return 0; }5 Check whether a number is a power of two, and find the next power of two.
easyA positive power of two has exactly one set bit, so n > 0 and (n & (n - 1)) == 0. For the next power of two greater than or equal to n, smear the highest bit into all lower bits of n - 1 and add one. Time O(1) for both. Common mistake: letting n = 0 pass the first test, since 0 & -1 is 0.
c#include <stdio.h> #include <stdint.h> int is_pow2(uint32_t n) { return n && !(n & (n - 1)); } uint32_t next_pow2(uint32_t n) { if (n <= 1) return 1; n--; n |= n >> 1; n |= n >> 2; n |= n >> 4; n |= n >> 8; n |= n >> 16; return n + 1; } int main(void) { printf("%d %d %u\n", is_pow2(64), is_pow2(0), next_pow2(37)); /* 1 0 64 */ return 0; }6 Predict the output: sizeof applied to an array and to a function parameter.
mediumInside main, sizeof(arr) is the whole array: 5 x 4 = 20 bytes. Inside the function, int a[] is really int *a, so sizeof(a) is the pointer size, 8 on a 64-bit platform (4 on 32-bit). Output on a 64-bit system: 20 8. Complexity is constant. Common mistake: believing the array keeps its size when passed, then computing a length as sizeof(a)/sizeof(a[0]) inside the function. Pass the length separately.
c#include <stdio.h> void f(int a[]) { printf("%zu\n", sizeof(a)); } int main(void) { int arr[5] = {0}; printf("%zu ", sizeof(arr)); f(arr); return 0; }7 Find the element that appears once when every other element appears exactly twice.
mediumXOR all elements. x ^ x = 0 and x ^ 0 = x, so pairs cancel and the single value remains. For {4, 1, 2, 1, 2} the answer is 4. Time O(n), space O(1). Common mistake: reaching for a hash map, which works but misses the constant-space point the interviewer is testing.
c#include <stdio.h> int single(const int *a, int n) { int r = 0; for (int i = 0; i < n; i++) r ^= a[i]; return r; } int main(void) { int a[] = {4, 1, 2, 1, 2}; printf("%d\n", single(a, 5)); /* 4 */ return 0; }8 Two numbers appear once and all others appear twice. Find both in O(n) time and O(1) space.
hardXOR everything to get x ^ y, which is non-zero because x differs from y. Take its lowest set bit, d = v & -v. That bit differs between x and y, so splitting the array by whether that bit is set puts x and y in different groups, and XOR within each group gives one each. For {1, 2, 1, 3, 2, 5} the pair is 3 and 5. Common mistake: using a signed value for the isolation trick; use unsigned or be careful with INT_MIN.
c#include <stdio.h> void two_singles(const int *a, int n, int *x, int *y) { unsigned v = 0; for (int i = 0; i < n; i++) v ^= (unsigned)a[i]; unsigned d = v & (~v + 1u); *x = 0; *y = 0; for (int i = 0; i < n; i++) { if ((unsigned)a[i] & d) *x ^= a[i]; else *y ^= a[i]; } } int main(void) { int a[] = {1, 2, 1, 3, 2, 5}, x, y; two_singles(a, 6, &x, &y); printf("%d %d\n", x < y ? x : y, x < y ? y : x); /* 3 5 */ return 0; }9 Predict the output: a macro without parentheses.
mediumSQ(2 + 3) expands textually to 2 + 3 * 2 + 3 = 11, not 25. The fix is #define SQ(x) ((x) * (x)). Even then SQ(i++) evaluates i++ twice, which is undefined behaviour, so prefer an inline function. Output: 11. Common mistake: assuming macros behave like functions.
c#include <stdio.h> #define SQ(x) x * x int main(void) { printf("%d\n", SQ(2 + 3)); return 0; }10 Predict the output: converting a char with the top bit set to int.
medium0x80 stored in a signed char is -128, and converting it to int sign-extends, so the program prints -128 where plain char is signed, as on x86. Where plain char is unsigned, as on many ARM Linux toolchains, it prints 128. The cast through unsigned char removes the ambiguity. Complexity is constant. Common mistake: ignoring char signedness when parsing bytes from a buffer.
c#include <stdio.h> int main(void) { char c = (char)0x80; int i = c; int j = (unsigned char)c; printf("%d %d\n", i, j); /* x86: -128 128 */ return 0; }11 Detect a cycle in a singly linked list.
mediumFloyd's algorithm: move slow one step and fast two steps. If they meet, there is a cycle; if fast reaches NULL, there is none. Time O(n), space O(1). Common mistake: checking only fast->next and dereferencing fast->next->next when fast->next is NULL. Test with a list that has an even number of nodes and one that has an odd number.
c#include <stdio.h> struct Node { int v; struct Node *next; }; int has_cycle(struct Node *h) { struct Node *s = h, *f = h; while (f && f->next) { s = s->next; f = f->next->next; if (s == f) return 1; } return 0; } int main(void) { struct Node c = {3, NULL}, b = {2, &c}, a = {1, &b}; printf("%d ", has_cycle(&a)); c.next = &a; printf("%d\n", has_cycle(&a)); /* 0 1 */ return 0; }12 Write your own memmove that is safe when the source and destination overlap.
hardIf dst is below src, copy forwards; if dst is above src and the regions overlap, copy backwards so unread bytes are not overwritten. Compare addresses through unsigned char pointers. Time O(n), space O(1). Common mistake: using a forward copy always, which corrupts data when dst lies inside the source range. memcpy does not promise correct behaviour on overlap, memmove does.
c#include <stdio.h> #include <stddef.h> void *my_memmove(void *dst, const void *src, size_t n) { unsigned char *d = dst; const unsigned char *s = src; if (d == s || n == 0) return dst; if (d < s) { for (size_t i = 0; i < n; i++) d[i] = s[i]; } else { for (size_t i = n; i > 0; i--) d[i - 1] = s[i - 1]; } return dst; } int main(void) { char buf[] = "abcdef"; my_memmove(buf + 2, buf, 4); puts(buf); /* ababcd */ return 0; }
Frequently asked questions
What kinds of problems appear in a chip-company coding round?
Commonly reported are C output-prediction snippets, bit manipulation, pointer and array questions, linked lists, and a few standard algorithms. Difficulty is usually easy to medium, but the questions probe whether you understand memory and types.
Should I code in C or C++?
Use the language the test allows and the one you know best. Embedded and systems roles often expect C, so be comfortable with it even if you prefer C++. Write the solutions here in both if you have time.
How many output-prediction questions should I practise?
Aim for thirty to fifty short snippets across pointers, sizeof, macros, operator precedence, integer promotion and static or volatile storage. Always state the platform assumption, such as a 32-bit int, in your answer.
Are these the actual Qualcomm questions?
No. They are practice problems in the style of the topics the round is commonly reported to cover. The company does not publish its papers.
Where are the current Qualcomm openings?
Check the Qualcomm hiring page and the company's own careers site. Round formats and dates change, so rely on those rather than on old forum posts.
Sources
Related guides
- Qualcomm Interview Questions and Answers for India Software Roles
- Intel Coding Round Questions with Solutions
- Texas Instruments Coding Round Questions with Solutions
- Micron Coding Round Questions with Solutions
- Bit manipulation interview questions with worked solutions
- C++ Pointers and References Interview Questions
More in Company Interview Questions
- Qualcomm Interview Questions and Answers for India Software Roles
- Razorpay Coding Round Questions with Solutions
- Razorpay Interview Questions and Answers
- Salesforce Coding Round Questions with Solutions in Python and Java
- Salesforce Interview Questions and Answers for MTS and AMTS Roles
- Samsung Coding Round Questions with Solutions
- Samsung R&D Interview Questions and Answers for India Software Roles
- SAP Coding Round Questions with Solutions in Python and Java
- SAP Labs Interview Questions and Answers for Freshers and SDE Roles
- Sasken coding round questions
- Sasken interview questions and answers
- ServiceNow Coding Round Questions With Solutions