728x90 AdSpace

Latest Article

Using Pointer in C++ sample MCQs and Question with solution





Using Pointer in C++ Programming sample MCQs and Question with solution 


1.Which of the following gives the memory address of a pointer a?
A. a;
B. *a;
C. &a;
D. address(a);

2. Which of the following gives the value stored at the address pointed to by the pointer a?
A. a;
B. val(a);
C. *a;
D. &a;


3. Which of the following is the proper keyword to deallocate memory?
A. free
B. delete
C. clear
D. remove

4. What will be the output of this code?

int *p1,*p2;
p1=new int;
p2=new int;
*p1=10;
*p2=20;
cout<<*p1<< "  "<<*p2<<endl;
*p1=*p2;
cout<<*p1<< "  "<<*p2<<endl;
*p1=30;
cout<<*p1<< "  "<<*p2<<endl;


 
 


 SOLUTION: 


1.Which of the following gives the memory address of a pointer a?
A. a;

2. Which of the following gives the value stored at the address pointed to by the pointer a?
C. *a;



3. Which of the following is the proper keyword to deallocate memory?
B. delete


4. What will be the output of this code?


10 20
20 20
30 20
 
 






no image
  • Title : Using Pointer in C++ sample MCQs and Question with solution
  • Posted by :
  • Date : 13:09
  • Labels :





  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top