Home »» Placement Papers »» All Papers »» Microsoft »» Placement Paper

C++/ Java Interview Questions - Microsoft


1. What is the output of the following program?
#include
class P {
public:
void print()
{ cout <<" Inside P::"; }
};
class Q : public P {
public:
void print()
{ cout <<" Inside Q"; }
};
class R: public Q {
};
int main(void)
{
R r;

r.print();
return 0;
}

a) Inside P b) Inside Q c) Error d) None of the above

2. What is the output of the following program?
#include
class Base
{
public:
Base()
{
fun(); //note: fun() is virtual
}
virtual void fun()
{
cout<<"nBase Function";
}
};

class Derived: public Base
{
public:
Derived(){}
virtual void fun()
{
cout<<"nDerived Function";
}
};

int main()
{
Base* pBase = new Derived();
delete pBase;
return 0;
}

a) Base Function
b) Derived Function
c) Error
d) None of the above

3. Write a program to show the implementation of a link list?
4. Write an algorithm of minimum complexity to sort a link list?
5. What are the advantages of stock sorting algorithms?
6. How to implement an algorithm to insert a node in circular link list?
7. Write a java program to convert string into number?
8. What are the types of exception handling methods used in Java?

Comment

0 Answers