Explain variadic functions
ConfluentSoftware Engineer · Technical ScreenLast updated
Explain variadic functions evaluates requirements, assumptions, structured reasoning, trade-offs, and verification in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Explain what variadic functions are and how they are supported in two languages of your choice (e.g., C/C++, Go, Java, Python). Cover calling conventions and how arguments are accessed by the callee, type-safety mechanisms (e.g., templates/generics vs. raw varargs), performance and stack/heap implications, and how to forward variadic arguments to another function. Implement a typesafe variadic logger that accepts key–value pairs and formats them efficiently; discuss pitfalls such as format-string vulnerabilities, boxing/reflection overhead, and ambiguity resolution. Provide tests and analyze complexity.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.