Dynamic memory location occurs……
a) when new variable is created
b) variable is created at runtime
c) both a & b
d) none of these
Declaration of pointer reserves memory space……
a) for the object
b) for the pointer
c) both a & b
d) none of these
What is the output of following code fragment?
int v1=2; int v2=-1; int *p1; int *p2;
p1=&v1; p2=&v2; p2=p1; cout<<*p2<<endl;
a) 2
b) -1
c) -2
d) 1
Which of the following is invalid if p1 is an integer pointer and a1 is integer?
a) p1=a1;
b) cout<<p1[10];
c) cin>>p1[10];
d) a1=p1;
Which of the following statements returns the memory from dynamic array?
a) delete [] p1;
b) delete p1[];
c) delete *p1;
d) delete p1;
Which of the following assign the fifth element of array pointed by a pointer p1?
a) (p1+4)=6;
b) (*p1) +4=6;
c) *(p1+4)=6;
d) *(p1[4])=6;