C++ problems

Pleas solve, answer, and explain all problem questions.

Document Preview:

C++ problems.docx
What is the output of the following code fragment?
int v1=2, v2=-1, *p1, *p2;
p1 = & v1;
p2= & v2;
p2=p1;
cout << *p2 << endl;
2
-1
-2
1
What is the output of the following code fragment?
float *p1;
p1 = new float(3);
cout << *p1;
3.0
unknown, the address p1 points to is not initialized
unknown, the code is illegal, p1 points to a dynamic array
0.0
What is the output of the following code?
int *p1, *p2;
p1 = new int;
p2 = new int;
*p1=11;
*p2=0;
p2=p1;
cout << *p1 <> p1[0];
a1 = p1;
Assuming that the pointer variable p1 is of the correct type and size is an integer with some value > 1, which of the following declarations are legal?
p1 = new string[size];
p1 = new ifstream[size];
p1 = new char[size*size];
A and B
A, B and C
If p1 is an integer pointer that is pointing to memory location 1001, and an integer takes 4 bytes, then (p1+1) evaluates to:
1002
1004
1005
Unknown
Given that p1 is a pointer, p1++
always causes a run time error
advances p1 by one unit of the type of variable to which p1 points
adds 1 to whatever p1 is pointing to
adds one element to the array that p1 is pointing to
If a program requires a dynamically allocate two-dimensional array, you...