Logo

Question preview

Pointer or String?

What this preview is

About this preview

Pointer or String? is a easy quant interview question on language knowledge in Cpp, asked at Quant.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

What this C++ pointer and string syntax question tests

This is an easy C++ language-knowledge question that checks whether you understand the subtle distinction between pointers, arrays, and the behaviour of std::cout when given different types of arguments. It's the kind of question quant trading firms ask to verify that candidates have solid fundamentals before moving into systems-level or high-frequency trading code.

The question probes how C++ handles type coercion and operator overloading for output streams. When you pass different kinds of arguments to std::cout, the compiler selects different overloads based on type, and that choice determines whether the address of a variable is printed or its contents are. Understanding this distinction is crucial for debugging and for writing code that doesn't accidentally leak information or crash.

  • Pointer types and address-of operator (&)
  • Character arrays vs. character pointers
  • Stream output operator overloads
  • Type coercion and implicit conversions in C++