Give the answer of given question and also give details.
Question 1: What are the main conceptual differences between object-oriented programming and the other programming techniques?
Question 2: What is the definition of reference variable? What are the differences between pass-by-value and pass-by-reference?
Question 3: What is memory leakage? Given an example and explain why it causes memory leakage (8 points).
Question 4: What is wrong with the following code? How to fix it? If there is nothing wrong, say "Nothing is wrong" (8 points).
int *p; // Line 1
int *q; // Line 2
p = new int [6]; // Line 3
*p = 1; // Line 4
for (int i = 1; i < 6; i ++) // Line 5
{
p[i] = p[i-1] + i; // Line 6
}
q = p; // Line 7
delete [ ]p; // Line 8
for (int j = 0; j < 6; j++) // Line 9
cout << q[j] << endl; // Line 10
Question 5. What is the output of the following program fragment:
void add_value(int *x, int &y, int z);
{
*x += 10;
y += 10;
z += 10;
}
int main (void){
int a = 5, b = 10, c = 11;
add_value(&a,b,c);
cout << a <<","<< b << ","<< c << endl;
return 0;
}
Output:
Describe each and every question in depth with examples.