Memory Management - placement practice test
1. During dynamic memory allocation in CPP, new operator returns__________ value if memory allocation is unsuccessful.
d. None of theseView Answer / Hide Answer
ANSWER: b. NULL
2. Which of the following operator is used to release the dynamically allocated memory in CPP?
d. both b and cView Answer / Hide Answer
3. Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP?
a. int *p = new int(100);
b. int *p; p = new int; *p = 100;
c. int *p = NULL; p = new int; *p=100;
d. Only 1,2
e. All of these View Answer / Hide Answer
4. Which of the following is not a false statement about new operator?
a. It can’t be overloaded
b. It returns garbage value when memory allocation fails
c. It automatically computes the size of the data object
d. All of theseView Answer / Hide Answer
ANSWER: c. It automatically computes the size of the data object
5. In CPP, dynamic memory allocation is done using ______________ operator
d. newView Answer / Hide Answer
6. Can we allocate memory for the objects dynamically in CPP ?
b. NoView Answer / Hide Answer