1.Select all C++ functions that must be defined for implementing deep copies in your class which has instance variables pointing to dynamic memories.
Group of answer choices
a.Default Constructor
b.Copy Constructor
c.Overloading assignment operator
d.Writing own friend functions to directly access dynamically allocated memories
e.Writing own destructor to free the allocated memory
f.Overloading new operator
2.
Match the memory source (right side) of the variables (left side) of the following code snippet which is a part of 'myProg' program. Note that there are some distractors.
#include <iostream> using namespace std; int varA = 2312; int *varB = & varA; void swap (int& left, int& right) { int temp; static int counter = 0; counter++; temp = left; left = right; right = temp; } int main (int argc, char* argv[] ) { varB = new int (15); swap(*varB, varA); .... }
Group of answer choices
'myProg' Program
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
varA
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
varB
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
" *varB " in main() function
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
left in swap() function
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
temp in swap() function
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
counter in swap() function
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
argc
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
1. Answer below:-
b. Copy Constructor
c. overloading assignment operator
2. Answer below:
myProg' Program
[ Choose ] Stack Kernel area Environment variable area Symbol table Global variable area Text area Heap
Get Answers For Free
Most questions answered within 1 hours.