1. What is a variable in C++?
A variable in C++ is an object that has a name.
2. What is Definition of a variable?
A definition of a variable is special kind of declaration, where the variable is defined as a particular type that can hold a certain kind of value.
3. What is Instantiation of a variable?
Instantiation occurs when a piece of memory is set aside for a variable in RAM.
4. What is the difference between an l-value and an r-value?
An l-value is a variable that has a persistent address in memory. It is the value on the left hand side when an assignment is made.
On the other hand, r-values are not associated with a persistent memory address. They are generally temporary in nature and are discarded at the end of the statement in which they occur.
5. What is an uninitialized variable and what kind of behaviour can you expect from such a variable?
An uninitialised variable is a variable that has not been given a known value. If it is used, it will produce whatever value is present at its memory location (which could be different each time it is accessed), causing unpredictable behaviour.
6. What is undefined behaviour?
Unpredictable behaviour resulting from the use of uninitialised variables, because C++ has no rules determining what happens.