Predict the output? #include <iostream> using namespace std; class Test { int x; Test() { x = 5; } }; int main() { Test *t = new Test; cout << t->x; }

- Online Exam Test Papers | - MCQs[multiple choice questions and answers ] | - Mock Test Papers | - Practice Papers | - Sample Test Papers |

Question:
Predict the output?
#include <iostream>
using namespace std;
class Test
{
int x;
Test()
{
x = 5;
} };
int main()
{
Test *t = new Test;
cout << t->x;
}

1.Compiler Error

2.5

3.Garbage Value

4.None of these

Posted Date:-2022-07-04 11:05:19


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!