you are asked to identify instance(s) of ClassA at run time in the following cod
ID: 3570083 • Letter: Y
Question
you are asked to identify instance(s) of ClassA at run time in the following code snippet:
ClassA global;
ClassA func(ClassA param) {
ClassA local = param;
ClassA *heap = new ClassA(global);
*heap = global;
ClassA arr[4] = { local, *heap };
return *heap;
}
(explain ur reason as well)
1: ClassA global; // this creates an instance of ClassA
True
False
2:ClassA func(ClassA param) {...} // this creates an instance of ClassA
True
False
3:ClassA local = param; // this creates an instance of ClassA
True
False
4:*heap = new ClassA(global); // this creates an instance of ClassA
True
False
5:*heap = global; // this creates an instance of ClassA
True
False
6:ClassA arr[4] = { local, *heap }; // this creates instance(s) of ClassA
True
False
7:return *heap; // this creates an instance of ClassA
True
False
Explanation / Answer
1.False
2.True
3.False
4.True
5.True
6.False
7.False
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.