Reve System Interview Experience | Set 2

Round 1:Written Test – 90 min

It comprises of 15 questions mainly from the topic OOPs concept , Coding Question(Linked List, Binary tree , Array Manipulation) and Pointer.

Q.1)Given a binary search tree and a given key node. Print all the node from root to the nearest leaf node containing the the key node.

4
/   \
2     6
\   / \
3 5   7
\
8
key node = 6
Output = 4 6 5

Q.2) Write a program to reverse the Singly Linked list

Example:

Initially – 1->2->3->4->5

Finally – 5->4->3->2->1

Q.3) Find the output of following code:

int main()
{
int i=(4==4,5,6);
int j= 8>>3&9;
int  d=i+j++*2;
cout<<d<<endl;
return 0;
}

Q.4)Find the ouput of following code:

int fib(int n)
{
if (n<=1)
return 1;
return 3*fib(n-1)+2*fib(n-2)+1*fib(n-3);
}

int main()
{
cout<<fib(5);
return 0;
}

Q.5) Write a program to find the trailing zeros of factorial of a given number.

Example:
n = 12
Output = 2

Q.6) Find the output of following:

class Base
{
Public:
Base(){cout<<"Base Constructor"<<endl;}
~Base(){cout<<"Base Destructor"<<endl;}
}

class Derived: Public Base
{
Public:
Derived(){cout<<"Derived Constructor"<<endl;}
~Derived(){cout<<"Derived Destructor"<<endl;}
}

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

Q.7)Find the output of following:

struct struct
{
double a;
int b;
int c;
};

union union
{
double a;
int b;
int c;
}

int main
{
struct s;
union u;
cout<<sizeof(s)<<endl;
cout<<sizeof(u)<<endl;
return 0;
}

Assume size of  member variable a,b,c be 6,4,4 respectively.

Q.8) Find the output of following:

int main()
{
char *ptr[] = {"india", "is", "a",
"good", "country"};
char **ptr1[] = {s+3, s+4, s+1};
char ***ptr2;
ptr2 = ptr;
cout << *(*ptr1)<<" "
<<***ptr2;
return 0;
}

Q.9) Write a program to find maxm sum of continuous subarray of  a array.

Example:

7
3 4 -5 9 4 -12 2
Output – 15

Q.10) Find the ouput of following code:

class Animal()
{
public:
virtual void eat()=0;
virtual void sleep()=0;
}

class Cat : Public Animal
{
public:
void eat()
{
cout<<"cat eat food"<<endl;
}

void sleep()
{
cout<<"cat sleep"<<endl;
}
}

class Dog: Public Animal
{
public:
void sleep()
{
cout<<" Dog sleep"<<endl;
}
}

int main()
{
Animal  *a;
Cat c ;
c.eat();
a=new Dog();
a.sleep();
return 0;
}

Output – Compile time error

Q.11)Write a program to find the first non-repeating character from the stream of characters.

Q.12)Write a program to put all zero elements before non-zero elements from a given array

Example:

2 0 3 4 0 0 1 0

output – 0 0 0 0 2 3 4 1

1 question from Multi-threading and other 2 are code-snippet , which I forgotten.

Note – Try to solve all Coding questions with minimum time and space complexity.

On the same day evening, the results were out and total 6 students out of 54 got selected for further rounds. Fortunately, I was one of them

Round 2:Technical + HR Interview(Around 45 min)

1. Tell me about yourself.
2. Find the frequency of all the element of array in space complexity-O(1) and time complexity – O(n).
3. He asked me to explain Q.6 and Q.8 of written round.
4. What is template and how to create template.
5. Difference b/w template and method overloading.
6. What is pointer and what are const pointer and it’s types.
7. how can you change the value of the const variable

Then they asked some Hr Question-

1) Tell me your family background.

2) why should we hire you.

The final result came after 5 days and out of 6, only 2 students got selected, I was one of them.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

Recommended Posts:

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.