Ace Your C++ Skills 2025 – Rock the ‘Thinking in C++’ Challenge!

Question: 1 / 565

What does the 'new' keyword do in C++?

Defines a new namespace

Allocates memory dynamically

The 'new' keyword in C++ is used to dynamically allocate memory for a variable or an object. This means that the memory for the variable or object is allocated at runtime, rather than at compile time like with statically allocated variables. Choosing option A, C, or D would be incorrect because all of these options do not accurately describe the purpose of the 'new' keyword. Option A refers to defining a namespace which is unrelated to memory allocation. Option C refers to declaring a new type which also does not involve memory allocation. And option D refers to updating a variable to its latest value which is not related to memory allocation at all. Therefore, the only correct answer is option B which accurately describes the purpose of the 'new' keyword in C++.

Get further explanation with Examzify DeepDiveBeta

Declares a new type

Updates a variable to its latest value

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy