Memory management
-
Upload
fellowbuddycom -
Category
Technology
-
view
90 -
download
0
Transcript of Memory management
www.fellowbuddy.com
Simplifying Students Life
Memory Management
1. During dynamic memory allocation in CPP, new operator returns__________ value if memory
allocation is unsuccessful.
a. False
b. NULL
c. Zero
d. None of these
2. Which of the following operator is used to release the dynamically allocated memory in CPP?
a. remove
b. free
c. delete
d. both b and c
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
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 these
5. In CPP, dynamic memory allocation is done using ______________ operator
a. calloc()
b. malloc()
c. allocate
d. new
www.fellowbuddy.com
Simplifying Students Life
6. Can we allocate memory for the objects dynamically in CPP ?
a. Yes
b. No
Answers
1. ANSWER: b. NULL
2. ANSWER: c. delete
3. ANSWER: e. All of these
4. ANSWER: c. It automatically computes the size of the data object
5. ANSWER: d. new
6. ANSWER: a. Yes