Multiple choice technology programming languages

What is the result of this code? myObj *foo = operator new(sizeof(foo));

  1. That's not legal syntax!

  2. foo has memory allocated for it, but is not constructed

  3. foo has memory allocated for it, and is fully constructed

  4. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In C++, operator new returns a void*, which cannot be implicitly converted to a typed pointer like myObj* without an explicit cast. Additionally, sizeof(foo) allocates space for the pointer size (4 or 8 bytes) rather than the object itself.