MCQs
None.
new and delete operators are mainly used to allocate and deallocate
during runtime.
The garbage collectoion attempts to reclaim memory occupied by objects that are no longer in use
by the program.
As we are using a pointer value to copy a string, So it will be producing a runtime error.
Output:
$ g++ res3.cpp
$ a.out
segmentation fault
Eventhough we passed the value, we didn't caught to manipulate it, So it is printing as 10.
Output:
$ g++ res2.cpp
$ a.out
10
We are copying the values from one variable to other, So it is printing is TestTest
Output:
$ g++ res1.cpp
$ a.out
TestTest
If there is any mishap in memory or resource management means, the problems that are mentioned
above can happen.
Resource is said to be leaked when it cannot by accessed by any means of standard mean.
None
As we had given i value as 2, It will print the 5 for two times.
Output:
$ g++ res.cpp
$ a.out
55