Autocoder

Analog Devices Coding Round Questions with Solutions

Last updated 2026-11-19

Coding questions near the signal chain are rarely about graphs. They ask for a filter, a bit-reversal ordering, a fixed-point dot product, a checksum, or the unpacking of a register frame. This page gives twelve practice problems in that style, each with a complete runnable solution, the complexity and the usual mistake.

They are practice problems in the style of topics such rounds are commonly reported to cover, not real papers. Read Analog Devices interview questions for the concept side, and see bit manipulation interview questions for more bit drill.

What to watch for

Decide the number format first: signed or unsigned, how many bits, and what happens on overflow. Most wrong answers in signal code come from silent wrap-around in a narrow type or from an arithmetic right shift on a value you meant to treat as a bit pattern.

State the cost per sample. DSP interviewers like to hear that a moving average is O(1) per sample with a running sum, not O(N).

Hiring status

No sourced hiring facts for Analog Devices are held on this site, so no dates, openings or packages are quoted. Use the company's own careers site.

Analog Devices Coding Round Questions with Solutions: questions with worked answers

  1. 1

    Convolve a signal with an FIR filter (direct form).

    easy

    For each output index n, sum h[k] x x[n - k] over valid k. The output of a 3-tap average on [3, 6, 9, 12] treats missing history as zero, giving [1, 3, 6, 9]. Time O(N x K), space O(N). Common mistake: indexing x[n - k] with a negative index, which wraps in Python and reads the end of the array.

    python
    def fir(x, h):
        out = []
        for n in range(len(x)):
            acc = 0.0
            for k in range(len(h)):
                if n - k >= 0:
                    acc += h[k] * x[n - k]
            out.append(round(acc, 6))
        return out
    
    print(fir([3, 6, 9, 12], [1/3, 1/3, 1/3]))  # [1.0, 3.0, 6.0, 9.0]
  2. 2

    Exponential moving average with integer arithmetic only.

    medium

    Use y += (x - y) >> k, which is a first-order low-pass with a smoothing factor of 2^-k. With k = 2 and a step from 0 to 100, the output rises as 25, 43, 57, 67. Time O(1) per sample, one state variable. Common mistake: using an unsigned type, so negative differences wrap, and an arithmetic shift of negative values rounds toward minus infinity, which creates a small bias.

    c
    #include <stdio.h>
    int main(void) {
        int y = 0;
        for (int i = 0; i < 4; i++) {
            y += (100 - y) >> 2;
            printf("%d ", y);
        }
        puts("");  /* 25 43 57 67 */
        return 0;
    }
  3. 3

    Produce the bit-reversed index permutation for an FFT of size 8.

    medium

    Reverse the three bits of each index: 0 to 0, 1 (001) to 4 (100), 2 (010) to 2, 3 (011) to 6, 4 to 1, 5 (101) to 5, 6 (110) to 3, 7 to 7. The in-place radix-2 FFT swaps element i with its reversed index when i is less than the reversed value. Time O(N log N) for the whole table, space O(N). Common mistake: swapping every pair twice and undoing the permutation.

    python
    def bit_reverse(n_bits):
        n = 1 << n_bits
        out = []
        for i in range(n):
            r = 0
            for b in range(n_bits):
                if i & (1 << b):
                    r |= 1 << (n_bits - 1 - b)
            out.append(r)
        return out
    
    print(bit_reverse(3))  # [0, 4, 2, 6, 1, 5, 3, 7]
  4. 4

    Q15 dot product with a 32-bit accumulator and saturation.

    medium

    Multiply pairs as 32-bit values (Q30 products), sum in a 32-bit accumulator or a 64-bit one if the vectors are long, shift right by 15 to return to Q15 and clamp to the 16-bit range. For vectors of 0.5 in Q15, four elements give 4 x 0.25 = 1.0, which does not fit and saturates to 32767. Time O(n). Common mistake: shifting each product before summing, which throws away precision at every step.

    c
    #include <stdio.h>
    #include <stdint.h>
    int16_t dot_q15(const int16_t *a, const int16_t *b, int n) {
        int64_t acc = 0;
        for (int i = 0; i < n; i++) acc += (int32_t)a[i] * b[i];
        acc >>= 15;
        if (acc > 32767) acc = 32767;
        if (acc < -32768) acc = -32768;
        return (int16_t)acc;
    }
    int main(void) {
        int16_t a[4] = {16384, 16384, 16384, 16384};
        printf("%d %d\n", dot_q15(a, a, 2), dot_q15(a, a, 4)); /* 16384 32767 */
        return 0;
    }
  5. 5

    Sign-extend a 12-bit two's complement code.

    easy

    (x ^ 0x800) - 0x800 flips the sign bit and subtracts its weight. 0xFFF gives -1, 0x800 gives -2048 and 0x7FF stays 2047. Mask first with 0xFFF if the upper bits of the variable may be dirty. Time O(1). Common mistake: assuming a 12-bit value read into a 16-bit unsigned variable is already signed.

    c
    #include <stdio.h>
    #include <stdint.h>
    int sext12(uint16_t x) {
        x &= 0x0FFFu;
        return (int)(x ^ 0x800u) - 0x800;
    }
    int main(void) {
        printf("%d %d %d\n", sext12(0xFFF), sext12(0x800), sext12(0x7FF)); /* -1 -2048 2047 */
        return 0;
    }
  6. 6

    Convert a 12-bit ADC code to millivolts with integer maths and rounding.

    medium

    Full scale is 3300 mV at code 4095. Compute (code x 3300 + 2047) / 4095 in 32-bit arithmetic; adding half the divisor rounds to nearest rather than truncating. The product 4095 x 3300 is 13,513,500, which overflows 16 bits, so use at least 32. Code 2048 gives 1650 mV and code 4095 gives 3300. Common mistake: dividing before multiplying, which loses nearly all precision.

    c
    #include <stdio.h>
    #include <stdint.h>
    uint32_t to_mv(uint16_t code) {
        return ((uint32_t)code * 3300u + 2047u) / 4095u;
    }
    int main(void) {
        printf("%u %u %u\n", to_mv(0), to_mv(2048), to_mv(4095)); /* 0 1650 3300 */
        return 0;
    }
  7. 7

    Compute CRC-16/CCITT-FALSE (polynomial 0x1021, initial value 0xFFFF).

    hard

    Process each byte by XORing it into the high byte of the register, then shift eight times, XORing the polynomial whenever the top bit was set. The standard check value for the ASCII string 123456789 is 0x29B1. Time O(8n), space O(1); a 256-entry table gives O(n). Common mistake: mixing up the initial value (0xFFFF here, 0x0000 in the XMODEM variant), which changes the result.

    c
    #include <stdio.h>
    #include <stdint.h>
    #include <string.h>
    uint16_t crc16(const uint8_t *p, size_t n) {
        uint16_t crc = 0xFFFF;
        while (n--) {
            crc ^= (uint16_t)(*p++) << 8;
            for (int i = 0; i < 8; i++)
                crc = (crc & 0x8000u) ? (uint16_t)((crc << 1) ^ 0x1021u) : (uint16_t)(crc << 1);
        }
        return crc;
    }
    int main(void) {
        const char *s = "123456789";
        printf("0x%04X\n", crc16((const uint8_t *)s, strlen(s))); /* 0x29B1 */
        return 0;
    }
  8. 8

    Pack and unpack a 24-bit SPI frame: 1 read/write bit, 7 address bits and 16 data bits.

    medium

    Pack as (rw << 23) | (addr << 16) | data. Unpack with shifts and masks: rw = (f >> 23) & 1, addr = (f >> 16) & 0x7F, data = f & 0xFFFF. The frame 0xA51234 unpacks to rw 1, address 0x25, data 0x1234. Time O(1). Common mistake: not masking the address to seven bits before shifting, so a bad address overwrites the read/write bit.

    c
    #include <stdio.h>
    #include <stdint.h>
    uint32_t pack(unsigned rw, unsigned addr, unsigned data) {
        return ((uint32_t)(rw & 1u) << 23) | ((uint32_t)(addr & 0x7Fu) << 16) | (data & 0xFFFFu);
    }
    int main(void) {
        uint32_t f = pack(1, 0x25, 0x1234);
        printf("0x%06X %u 0x%02X 0x%04X\n", f, (f >> 23) & 1u, (f >> 16) & 0x7Fu, f & 0xFFFFu);
        /* 0xA51234 1 0x25 0x1234 */
        return 0;
    }
  9. 9

    Implement a delay line (circular buffer) that returns the sample from d steps ago.

    medium

    Keep an array of size d + 1 and a write index. Store the new sample at the write index, then read the element at write index minus d, modulo the size. With d = 2 and input 1, 2, 3, 4, 5 the output is 0, 0, 1, 2, 3. Time O(1) per sample, space O(d). Common mistake: using a buffer of size d, which returns the sample just overwritten.

    python
    class Delay:
        def __init__(self, d):
            self.buf = [0] * (d + 1)
            self.d, self.i = d, 0
        def step(self, x):
            self.buf[self.i] = x
            out = self.buf[(self.i - self.d) % len(self.buf)]
            self.i = (self.i + 1) % len(self.buf)
            return out
    
    dl = Delay(2)
    print([dl.step(x) for x in [1, 2, 3, 4, 5]])  # [0, 0, 1, 2, 3]
  10. 10

    Count the zero crossings in a sampled signal.

    easy

    Count the adjacent pairs whose signs differ, treating zero consistently, for example as non-negative. For [1, -2, 3, 4, -1, -5, 2] the crossings are 4. Time O(n), space O(1). Zero-crossing counts give a crude frequency estimate. Common mistake: counting a pair with a sample exactly equal to zero twice.

    python
    def zero_crossings(x):
        n = 0
        for a, b in zip(x, x[1:]):
            if (a >= 0) != (b >= 0):
                n += 1
        return n
    
    print(zero_crossings([1, -2, 3, 4, -1, -5, 2]))  # 4
  11. 11

    Predict the output: int16_t overflow versus integer promotion.

    medium

    a + 1 promotes both operands to int, so the sum is 32768 with no overflow. Converting that back to int16_t is implementation-defined; typical compilers wrap it to -32768. Output on a typical platform: 32768 -32768. Common mistake: assuming arithmetic is done in 16 bits because the variables are 16 bits wide.

    c
    #include <stdio.h>
    #include <stdint.h>
    int main(void) {
        int16_t a = 32767;
        int sum = a + 1;
        int16_t b = (int16_t)(a + 1);
        printf("%d %d\n", sum, b);
        return 0;
    }
  12. 12

    Median-of-three filter to remove single-sample spikes.

    medium

    For each sample take the median of itself and its two neighbours, which discards an isolated spike but keeps edges, unlike an average. For [5, 5, 90, 5, 5, 6, 6] the filtered interior becomes [5, 5, 5, 5, 6]. Time O(n), space O(n). Common mistake: using a moving average, which smears the spike over neighbouring samples instead of removing it.

    python
    def median3(x):
        return [sorted(x[i - 1:i + 2])[1] for i in range(1, len(x) - 1)]
    
    print(median3([5, 5, 90, 5, 5, 6, 6]))  # [5, 5, 5, 5, 6]

Frequently asked questions

Are Analog Devices coding rounds about DSP algorithms?

For signal-processing and embedded roles, commonly reported topics include filters, fixed-point arithmetic, bit manipulation and checksums, alongside standard C and data structures. Other roles may be closer to general software testing.

Do I need to know the FFT?

Know what it computes, its O(N log N) cost, and the bit-reversal step. You are unlikely to be asked to write a full FFT from memory but should understand the structure.

Are these real Analog Devices problems?

No. They are practice problems in the style of topics such rounds are commonly reported to cover. The company does not publish its papers.

How do I test fixed-point code?

Compare against a floating-point reference on random inputs and on the extreme values, and check where the results saturate.

Related guides

More in Company Interview Questions

See all in this section