What happens if the following C++ statement is compiled and executed? int* ptr…

BPSC TRE 2023Modified — slightly modified from the official paper; see the solution

What happens if the following C++ statement is compiled and executed? int* ptr = NULL; delete ptr;

  1. A.

    The program is not semantically correct

  2. B.

    The program is compiled and executed successfully

  3. C.

    The program is compiled successfully but throws an error during runtime

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 410 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…