C Interview Report
- 0of 0 votes
Answerclass X
- Anonymous January 13, 2009
{
int a;
public:
X() {cout<<"X constructor was called"<<end1;}
X(int n) {cout<<"X(int) constructor was called"<<end1;}
~X() {cout<<"X destructor was called"<<end1;}
};
int main()
{
X x(3);
return 0;
}
Assuming all necessary header files , what is the output from the sample code above?| Report Duplicate | Flag | PURGE
C - 0of 0 votes
Answersint i=0'
- Anonymous January 13, 2009
while(i++<5)
{
std::cout<<++i<<std::end1;
}
How many lines produce this code?| Report Duplicate | Flag | PURGE
C - 0of 0 votes
Answersstruct A
- Anonymous January 13, 2009
{
int i,j;
public:
A(int ii,int jj):i(ii),j(ii){}
A(const A& a)
{
std::cout<<"("<<a.i<<","<<a.j<<")";
}
A& operator=(const A& a)
{
std::cout<<"["<<i<<","<<j<<"]";
return *this;
}
};
int main(void)
{
A x(1,2);
A y(3,4);
A z=(x=y);
return 0;
}
What is output?| Report Duplicate | Flag | PURGE
C
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.