Programming - C++ Language
You Are Here :: Home > C++ Language > Pointers - General Questions
13. |
Choose the correct ways to access a class data member using this pointer?
|
A. |
this.x |
B.
|
*this.x |
C.
|
this->x
|
D.
|
None of these
|
|
Answer: Option C
Explanation:
|
14. |
A pointer to the base class can hold address of
|
A. |
only base class object |
B.
|
only derived class object |
C.
|
base class object as well as derived class object
|
D.
|
None of the above
|
|
Answer: Option C
Explanation:
|
15. |
Which of the following statements is correct?
|
A. |
Base class pointer cannot point to derived class. |
B.
|
Derived class pointer cannot point to base class. |
C.
|
Pointer to derived class cannot be created.
|
D.
|
Pointer to base class cannot be created.
|
|
Answer: Option B
Explanation:
|
16. |
Which of the following is illegal?
|
A. |
int *ip; |
B.
|
string s, *sp = 0; |
C.
|
int i; double* dp = &i;
|
D.
|
int *pi = 0;
|
|
Answer: Option C
Explanation:
dp is initialized int value of i. |
|
« prev