Trace Source Code to an Executable
Company: TikTok
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: easy
Interview Round: Technical Screen
Explain how source code becomes an executable through preprocessing, compilation, assembly, and linking. Use a conventional C or C++ toolchain as a concrete example, and distinguish these build stages from starting the resulting program.
### What a Strong Answer Covers
- The input, transformation, and output of each stage.
- Header inclusion and macros versus machine-code generation.
- Object files, symbols, relocations, and library resolution.
- Why a file can compile successfully but fail to link.
- How static and dynamic linking affect the executable and its runtime dependencies.
### Follow-up Questions
- Where would an undeclared identifier, an undefined function definition, and a missing shared library typically fail?
- Why can a toolchain combine stages without changing their conceptual responsibilities?
Overview: Trace source code through preprocessing, compilation, assembly, and linking, and explain object files, symbol errors, libraries, and executable loading.
Read the full TikTok Software Engineer interview experience this question came from