Lightweight C++ Quiz for Quant Interviews – Looking for Feedback

  • Thread starter Thread starter Bouni
  • Start date Start date
Joined
9/24/25
Messages
8
Points
3
Hi everyone,

While preparing for quant interviews myself, I noticed that most resources either go very deep (MOOCs, textbooks) or very broad (LeetCode-style).
I wanted something shorter and more focused, so I built a small side project: 15 C++ interview-style questions (easy → hard)

Each question comes with a 3-layer explanation:
- Code behavior (what runs, what prints)
- Memory model (stack/heap, references, etc.)
- Quant finance perspective (why this matters in an interview setting)

Each session takes about 3 minutes — meant for quick daily practice rather than long study sessions.

I previously worked as a quant developer (C++ focus) in a major investment bank, and I built this tool after seeing how challenging interview prep can be for candidates.
I’d love to get some honest feedback from people who are also prepping interviews before I expand the question set.

If this sounds interesting, I can share the beta link with a few volunteers.
(Or if you prefer, I can post a couple of sample questions here so you can see the format first.)

Thanks in advance — any comments or suggestions are very welcome!
 
Thanks for the suggestion — here are two sample questions from the beta, to give a sense of the style:

Sample Question 1 [easy]

int x = 5;
int y = x;
y++;
std::cout << x;

What does this program print?
A) 5​
B) 6​
C) Compilation error​
D) Undefined behavior​

Answer: A) 5

Explanation:
- Code behavior: y is a copy of x. Incrementing y does not change x.​
- Memory model: Two separate stack variables (x=5, y=6).​
- Interview relevance: Interviewers use this to check if you really understand how copying vs referencing affects data — a mistake here can change results silently.​

_____________________________________

Sample Question 2 [medium]

#include<memory>
int main(){
std::unique_ptr<int> p1(new int(5));
std::unique_ptr<int> p2 = p1;
}

What happens here?
A) None​
B) Compilation error​
C) Memory leak​
D) Undefined behavior​

Answer: B) Compilation error

Explanation:
- Code behavior: std::unique_ptr enforces exclusive ownership and cannot be copied.​
- Memory model: Attempting to bind p2 to the same resource as p1 is disallowed at compile time.​
- Interview relevance: In quant code, std::unique_ptr often manages large or complex resources (e.g. payoff objects, model configurations). Copying would risk double ownership, so interviewers test it to see if candidates understand safe resource transfer.​

_____________________________________

Happy to share a couple more if useful — and if anyone wants to try the full 15-question set, I can provide the beta link privately.
 
This is excellent!
Thanks Paul, glad you find it useful!

Out of curiosity — is there a particular type of C++ question you’d like me to add (e.g. memory management, templates, STL)?
 
Questions to challenge the developer's intelligence beyond the somewhat 1d syntax questions.
 
Questions to challenge the developer's intelligence beyond the somewhat 1d syntax questions.
That’s a great point, thanks Daniel!

The current MVP focuses on short C++ output-prediction questions because they are common in screening tests.

But the roadmap is indeed to move beyond “syntax traps” into deeper areas:
- memory management & RAII,
- object-oriented design pitfalls,
- performance trade-offs,
- template/concurrency gotchas.

The goal is to train both reflexes and higher-level reasoning, in a format that’s quick to practice.

Feedback like yours helps me sharpen the direction — thanks again!

Out of curiosity — what type of “intelligence-challenging” questions do you think would add the most value?
 
education.webp


A layered approach.
 
That’s a great point, thanks Daniel!

The current MVP focuses on short C++ output-prediction questions because they are common in screening tests.

But the roadmap is indeed to move beyond “syntax traps” into deeper areas:
- memory management & RAII,
- object-oriented design pitfalls,
- performance trade-offs,
- template/concurrency gotchas.

The goal is to train both reflexes and higher-level reasoning, in a format that’s quick to practice.

Feedback like yours helps me sharpen the direction — thanks again!

Out of curiosity — what type of “intelligence-challenging” questions do you think would add the most value?
See this .. all in there
 
The best way to learn C++ is to program an application until it works. Then those cute multiple choices fade into the background.
 
The best way to learn C++ is to program an application until it works. Then those cute multiple choices fade into the background.
I totally agree — nothing replaces the experience of building and debugging a real application.

The quiz format is not meant as a substitute, but rather as a complement:
a quick way to train reflexes for screening tests and review core concepts under time pressure.
 
Thanks Paul, glad you find it useful!

Out of curiosity — is there a particular type of C++ question you’d like me to add (e.g. memory management, templates, STL)?
I'd focus on just the basics, almost C like. Class big 4 constructors, questions about shallow vs deep copy and implement it for a dummy example. Things like that.
 
Survival pack

1. Review C++ Syntax: “Survival Syntax’’

We give a list of language features in C++ that we introduced in section 2.7. The goal of this exercise is to investigate what they are and what they mean. In particular, you should know the following:

. Header and code files; what are the advantages?

. Public and private members.

. Preprocessor directives and why they are needed.

. Member functions and member data.

. Constructors and how they initialise member data.

. Selectors and modifiers (set and get member functions).

. const arguments and const member functions.

. const objects and const return types.

. Operator overloading in C++; unary and binary operators.

. Mapping UML class diagrams to C++.

. Using free/non-member functions, for example void print(const Point& p).



This list is a subset of the prerequisites for an understanding of the C++ code that we discuss in this book. For a more detailed discussion of modern C++, see Duffy (2018).
 
Even higher level

We now wish to implement Rectangle and Square in an object-oriented language. The options are:

  • Rectangle is a subclass of Square .
  • Square is a subclass of Rectangle.
  • Rectangle delegates to Square.
  • Square delegates to Rectangle.
  • Design Rectangle and Square as classes, independently of each other.
  • Square as a class does not exist; it is a special instance of Rectangle. It is an object.
Answer the following questions:

  • Compare each of the above solutions with regard to accuracy and reusability.
  • Explain how/why solutions a) and b) above are wrong because we are thinking in terms of commonality of data (height, width) and not in terms of common functionality such as area(), distance() etc.
  • Which solutions compromise/invalidate the Single Responsibility Principle (SRP) that we introduce in chapter 6?
  • Choose your favourite design from the above list a) to f). Implement a solution in Python. Examine the quality of the code in terms of its maintainability and flexibility, including adding new functionality to classes.
  • Now implement these classes in C++ and C#.
 
I'd focus on just the basics, almost C like. Class big 4 constructors, questions about shallow vs deep copy and implement it for a dummy example. Things like that.
Another one I like is to have people implement their version of a smart pointer. Can be either unique or shared.
 
Code:
1.    (First Encounters with Smart Pointers: Unique Pointers)
Consider the following code that uses raw pointers:

    { // Block with raw pointer lifecycle

        double* d = new double (1.0);
        Point* pt = new Point(1.0, 2.0);    // Two-d Point class

        // Dereference and call member functions
        *d = 2.0;
        (*pt).X(3.0);        // Modify x coordinate
        (*pt).Y(3.0);        // Modify y coordinate

        // Can use operators for pointer operations
        pt->X(3.0);        // Modify x coordinate
        pt->Y(3.0);        // Modify y coordinate

        // Explicitly clean up memory (if you have not forgotten)
        delete d;
        delete pt;
    }

Answer the following questions:
a)    Type, run and test the above code. Introduce a try-catch block in which memory is allocated and directly afterwards an exception is thrown. You need to throw an exception in the body of the code. Since the code is not re-entrant, the memory is not reclaimed and hence it introduces a memory leak (in more general cases it would be a resource leak).
b)    Now port the above code by replacing raw pointers by std::unique_ptr. Run the code. Are there memory leaks now?
c)    Experiment with the following: initialising two unique pointers to the same pointer, assigning a unique pointer to another unique pointer and transferring ownership from one unique pointer to another unique pointer.
d)    Use alias template (template typedef) to make the code more readable.
 
Back
Top Bottom