C++ Programming Questions and Answers – Resource Management

Show Answer D. Exception
Explanation If there is any mishap in memory or resource management means, the problems that are mentioned above can happen.
Show Answer B. It cannot be accessed by any standard mean
Explanation Resource is said to be leaked when it cannot be accessed by any means of standard mean.
Show Answer A. Segmentation fault
Explanation segmentation fault error can arise when there is a problem with memory.
Show Answer B. 55
Explanation As we had given i value as 2, It will print the 5 for two times. Output: Note: Join free Sanfoundry classes at Telegram or Youtube $ g++ res.cpp $ a.out 55
Show Answer B. TestTest
Explanation We are copying the values from one variable to other, So it is printing is TestTest Output: $ g++ res1.cpp $ a.out TestTest
Show Answer A. 10
Explanation Even Though we passed the value, we didn’t caught to manipulate it, So it is printing as 10. Output: $ g++ res2.cpp $ a.out 10
Show Answer B. segmentation fault
Explanation 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
Show Answer D. The form of automatic memory management
Explanation The garbage collection attempts to reclaim memory occupied by objects that are no longer in use by the program.
Show Answer D. both new & delete
Explanation new and delete operators are mainly used to allocate and deallocate during runtime.
Show Answer C. smart pointers
Explanation In C++, smart pointers are used to manage memory issues like deallocate memory after use, checking bounds, etc.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page