sample c;
c = new sample();
1.It will create an object called sample.
2.It will create a nameless object of the type sample.
3.It will create an object of the type sample on the stack.
4.It will create a reference c on the stack and an object of the type sample on the heap.
5.It will create an object of the type sample either on the heap or on the stack depending on the size of the object.
A.1, 3
B.2, 4
C.3, 5
D.4, 5
E.None of these
Answer: Option B
c = new sample();
1.It will create an object called sample.
2.It will create a nameless object of the type sample.
3.It will create an object of the type sample on the stack.
4.It will create a reference c on the stack and an object of the type sample on the heap.
5.It will create an object of the type sample either on the heap or on the stack depending on the size of the object.
A.1, 3
B.2, 4
C.3, 5
D.4, 5
E.None of these
Answer: Option B