Quantcast interview question

Implement a query structure.