Difficulty: Medium
Category: Code Analysis
Practice quant interview questions from top firms including Jane Street, Citadel, Two Sigma, DE Shaw, and other leading quantitative finance companies.
Topics: C++, nullptr, dereference, segfault, undefined-behavior
You are developing a high-frequency trading system in C++. A function findBestOrder(orderBook) searches an order book for the optimal order to execute. If no suitable order is found, findBestOrder returns nullptr. The calling code then attempts to access the price member of the returned order object without checking for nullptr. Specifically: What is the most likely outcome when findBestOrder returns nullptr and the calling code attempts to dereference it to access bestOrder->price?
Practice this medium trader interview question on MyntBit - the all-in-one quant learning platform with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.