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;
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
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;
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
B. delete
4.
What will be the output of this code?
|
Modern sewerage systems
ReplyDelete-----------------------
شركة تسليك مجارى بالدمام