Qualcomm logoQualcomm
OtherFree preview

Compiler & C/C++ Fundamentals Quiz

Rapid-fire compiler and C/C++ knowledge round for Compiler Engineer and GPU-compiler roles: compilation theory, common optimization algorithms, LLVM backend, plus C/C++ semantics questions such as predicting the output of enum/struct code and macro vs function differences. Code is written in a Google Doc, C++ only.

SWE
compiler
cpp
cs-fundamentals
Frequency
Low
Last asked
2026-04-14
Stage
tech-screen

Problem

A knowledge-heavy round for Qualcomm compiler roles (general Compiler Engineer and GPU compiler). Interviewers move through a list of topics rather than a single problem. Confirmed topic areas:

  • Compilation theory — classic compiler-construction fundamentals.
  • Common compiler optimization algorithms — the standard optimization passes and how they work.
  • LLVM backend — backend internals for candidates claiming LLVM experience.
  • C and C++ programming — language-level semantics, including:
    • Reading a snippet that uses enum / enum class / struct and stating the output. Covers implicit conversion, underlying type, padding and sizeof under different member orders.
    • Macro vs function: how they differ, with at least three common pitfalls.

For the GPU-compiler team, the whole session is in C++ and code is written in a Google Doc (no IDE, no compiler).

Hints

Pitfalls

  • The Compiler Engineer loop treats this as the core signal; the accompanying coding question is easy and is not the focus. Under-preparing compiler theory is the bigger risk.
  • Output prediction is graded on exact semantics, with no compiler to check against.
  • Assigning an enum class to an int without a cast does not compile; a runtime value is the wrong answer. Forgetting trailing padding is the commonest sizeof error.
  • Parenthesizing fixes precedence, not evaluation count; keep the two failure modes separate.

Talking Points

  • State the conversion rule precisely: plain enum converts to int, enum class does not.
  • Draw offsets and padding; struct size rounds to the largest member alignment, and ordering largest to smallest minimizes padding.
  • Check for compile errors before predicting output; use any explicit underlying type; state platform assumptions aloud.
  • Hand-trace each macro expansion; call i++*i++ undefined behavior, not just "wrong result".
  • Give one example per legitimate macro use and contrast with C++ constexpr, inline, enum.

Follow-ups

Preparation

  • Write out how each optimization pass you know transforms a small fragment, and the analysis it needs.
  • Walk through the LLVM backend pipeline stage by stage and be ready to explain each stage's job.
  • Prepare a precise macro vs function answer (preprocessing vs compilation, argument evaluation, type checking, debugging) with a short snippet per difference.
  • Practice predicting the output of small enum / struct C++ snippets by hand, without running them, including reordered members.
Was this article helpful?

Comments

Sign in to join the discussion
Loading...