MCQOPTIONS
Bookmark
Saved Bookmarks
→
C++ Programming
→
Constructors And Destructors in C++ Programming
→
What will happen in this code?
1.
What will happen in this code?
int n = 50, m = 50;
int *ptr = &n, *ptr0 = &m;
ptr = ptr0;
A.
ptr now points to m
B.
m is assigned to n
C.
ptr0 now points to n
D.
n is assigned to m
E.
None of these
Answer» B. m is assigned to n
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> class N<br> {<br> public:<br> N(int k = 0){ _k = k;}<br> void fun()<br> {<br> cout << "Program Executed..."<<endl></endl> }<br> private:<br> int _k;<br> };<br> int main()<br> {<br> N *ptr = 0;<br> ptr -> fun();<br> }<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main()<br> {<br> int p = 3, q = 5, r = 13;<br> int *array[ ] = {&p, &q, &r};<br> cout << array[1];<br> return 0;<br> }<br></iostream></pre>
What will happen in this code?<br><pre class="prettyprint lang-c">int n = 50, m = 50;<br>int *ptr = &n, *ptr0 = &m;<br>ptr = ptr0;<br></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main()<br> {<br> int array[] = {40, 15, 60, 17};<br> int *ptr = (array + 3);<br> cout << *array + 8;<br> return 0;<br> }<br></iostream></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main ()<br> {<br> int num[5];<br> int * ptr;<br> ptr = num; *ptr = 12;<br> ptr++; *ptr = 21;<br> ptr = &num[2]; *ptr = 35;<br> ptr = num + 3; *ptr = 14;<br> ptr = num; *(ptr + 4) = 53;<br> for (int k = 0; k < 5; k++)<br> cout << num[k] << ",";<br> return 0;<br> }<br></iostream></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main()<br> {<br> int array[] = {40, 15, 23, 71};<br> int *p = (array + 2);<br> cout << array;<br> return 0;<br> }<br></iostream></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int fun(void *P);<br> int main()<br> {<br> char *S = "Interview Mania";<br> fun(S);<br> return 0;<br> }<br> int fun(void *P)<br> {<br> cout << P;<br> return 0;<br> }<br></iostream></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main()<br> {<br> int num = 10;<br> void *ptr = &num;<br> int *ptr0 = static_cast<int>(ptr);<br> cout << *ptr0;<br> return 0;<br> }<br></int></iostream></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> int main()<br> {<br> int *ptr;<br> void *vptr;<br> if (vptr == ptr)<br> {<br> cout << "Interview Mania";<br> }<br> return 0;<br> }<br></iostream></pre>
What is the output of this program?<br><pre class="prettyprint lang-c">#include <iostream><br> using namespace std;<br> void function(int p)<br> {<br> cout << p;<br> }<br> int main()<br> {<br> void (*num)(int);<br> num = &function;<br> (*num)( 3 );<br> num( 11 );<br> return 0;<br> }<br></iostream></pre>
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply