Memory Management - C++ (MCQ) questions and answers

Here, you can read Memory Management multiple choice questions and answers with explanation.

1)   Can we allocate memory for the objects dynamically in CPP?
- Published on 19 Jul 15

a. Yes
b. No
Answer  Explanation 

ANSWER: Yes

Explanation:
No explanation is available for this question!


2)   In CPP, dynamic memory allocation is done using ______________ operator.
- Published on 19 Jul 15

a. calloc()
b. malloc()
c. allocate
d. New
Answer  Explanation 

ANSWER: New

Explanation:
No explanation is available for this question!


3)   Which of the following is not a false statement about new operator?
- Published on 17 Jul 15

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
Answer  Explanation 

ANSWER: It automatically computes the size of the data object.

Explanation:
No explanation is available for this question!


4)   Which of the following operator is used to release the dynamically allocated memory in CPP?
- Published on 17 Jul 15

a. remove
b. free
c. delete
d. both b and c
Answer  Explanation 

ANSWER: delete

Explanation:
No explanation is available for this question!


5)   Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP?
- Published on 17 Jul 15

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
Answer  Explanation 

ANSWER: All of these

Explanation:
No explanation is available for this question!


6)   During dynamic memory allocation in CPP, new operator returns _________ value if memory allocation is unsuccessful.

- Published on 17 Jul 15

a. False
b. NULL
c. Zero
d. None of these
Answer  Explanation 

ANSWER: NULL

Explanation:
No explanation is available for this question!


1