Home »» Placement Papers »» All Papers »» Intergraph »» Placement Paper

Integraph Placement Paper - Technical Questions (08-11-2014)


Q1. What will be the output of the following program?
{
public:
int *ptr;
Sample(int i)
{
ptr = new int(i);
}
~Sample()
{
delete ptr;
}
void PrintVal()
{
cout << "The value is " << *ptr;
}
};
void SomeFunc(Sample x)
{
cout << "Say i am in someFunc " << endl;
}
int main()
{
Sample s1= 10;
SomeFunc(s1);
s1.PrintVal();
}


Q2. What is the parameter that is added when any non static function is called in a program?


Q3. Find output in the given program
class base
{
public:
int bval;
base(){ bval=0;}
};

class deri:public base
{
public:
int dval;
deri(){ dval=1;}
};
void SomeFunc(base *arr,int size)
{
for(int i=0; i coutcout<}-
int main()
{
base BaseArr[5];
SomeFunc(BaseArr,5);
deri DeriArr[5];
SomeFunc(DeriArr,5);
}


Q4. What are the different types of C instructions?


Q5. What is the difference between

printf(..) and sprint(...)


Q6. What is the difference between new and malloc?


Q7. In a string, which library function is used to find the last occurrence of a character?

A. strnstr()
B. laststr()
C. strrchr()
D. strstr()


Q8. When wll the following code get replaced by contents of the file stdio.h?
#include

A. during editing
B. linking
C. processing
D. execution


Q9. Find output of the given program
class base
{
public:
void baseFun(){ cout<<"from base"< };
class deri:public base
{
public:
void baseFun(){ cout<< "from derived"< };
void SomeFunc(base *baseObj)
{
baseObj->baseFun();
}
int main()
{
base baseObject;
SomeFunc(&baseObject);
deri deriObject;
SomeFunc(&deriObject);
}


Q10. What will be the output of the following
void main()
{
int a, *pa, &ra;
pa = &a;
ra = a;
cout <<"a="<}


Q11. Can you apply link and assosciation interchangeably?

Q12. Differentiate aggregation and containment.

Q13. What do you understand by SBI of any object?

Q14. Find output of the given program

class complex{
double re;
double im;
public:
complex() : re(1),im(0.5) {}
bool operator==(complex &rhs);
operator int(){}
};

bool complex::operator == (complex &rhs){
if((this->re == rhs.re) && (this->im == rhs.im))
return true;
else
return false;
}

int main(){
complex c1;
cout<< c1;
}


Q15. Under what circumstances does a name clash occur?

Q16. Give output of the program

#include 

class fig2d
{
int dim1;
int dim2;

public:
fig2d() { dim1=5; dim2=6;}

virtual void operator<<(ostream & rhs);
};

void fig2d::operator<<(ostream &rhs)
{
rhs }

/*class fig3d : public fig2d
{
int dim3;
public:
fig3d() { dim3=7;}
virtual void operator<<(ostream &rhs);
};
void fig3d::operator<<(ostream &rhs)
{

fig2d::operator <<(rhs);
rhs}
*/

void main()
{
fig2d obj1;
// fig3d obj2;

obj1 << cout;

// obj2 << cout;
}


Q17. Which of the following is the correct order for evaluation of the following expression?
Z=x+y*z/4%2-1
A. */%+-=
B. =*/%+-
C. /*%-+=
D. *%/-+=


Q18. What will be the output of the program?
class opOverload{
public:
bool operator==(opOverload temp);
};

bool opOverload::operator==(opOverload temp){
if(*this == temp ){
cout<<"The both are same objectsn";
return true;
}
else{
cout<<"The both are differentn";
return false;
}
}

void main(){
opOverload a1, a2;
a1= =a2;
}


Q19. What is the output of the given program?
void main()
{
int a, *pa, &ra;
pa = &a;
ra = a;
cout <<"a="<}
}


Q20. What do you understand by the following terms:

A. Modifier
B. Accessor
C. Class invariant
D. Stack unwindling

Comment

0 Answers