Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Challenge your C++ knowledge with a comprehensive quiz based on 'Thinking in C++'. Explore a variety of multiple choice questions with hints and explanations to solidify your understanding. Get prepared!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which functions does C provide for dynamic memory allocation?

  1. new and delete

  2. malloc() and free()

  3. alloc() and dealloc()

  4. create() and destory()

The correct answer is: malloc() and free()

C provides the functions malloc() and free() for dynamic memory allocation, not new and delete (which are related to C++). Option C suggests functions called alloc() and dealloc(), but those do not exist in C. Option D includes functions create() and destroy(), which are also not valid function names in C. Thus, the correct answer is B.