Here are some important C++ Basics Interview Questions & Answers.
1. what is memory leaking in c++ ?
Ans:- When a class uses dynamically allocated memory internally , all sorts of problems arises. If not properly used or handled, they can lead to memory leaks & corrupts Data Structures. <br><br>Amemory leak is the situation that occurs when dynamically allocated memory is lost to the program. <br><br>char * p;<br><br>p= new char;<br><br>. . . . . <br><br>p= new char;<br><br>Initially, 10000 bytes are dynamicallyallocated & the the address of those bytes is stored in p. later 5000 bytes are dyanmically allocated & the address is stored in p. However, the original 10000 bytes 've not been returned to the system using delete  opertor . <br><br>Memory leak actually depends on the nature of the program. <br>
Memory leaks generally occur due to inefficient usage of new operator. <br><br>When memory is dynamically allocated using new, the memory is assigned in the heap storage area of the program. This memory will not be deleted on its own since it is not dependent on the scope of the defined object as in the case of those objects that are created on the stack. <br><br>to delete such memory we have to call the destructor using delete operator. <br><br>As a result, it is advisable to match a new with a proper delete.
2. Why generalization is very strong?
Ans:- Even though Generalization satisfies Structural, Interface, Behaviour properties. It is mathematically very strong, as it is Antisymmetric and Transitive. Antisymmetric: employee is a person, but not all persons are employees. Mathematically all As? are B, but all Bs? not A.
Sorry, but you are not allowed to view signatures , please Register or Login