Monday 19 September 2016

Interview experience.........The day started.....

I am going to cover few intrerview questions which I have faced recently as a part of my internal job search in my current organization.



Day 1(BU NAME: xxxx) :

On line written test (C, C++, Java) http://hackerrank.com/

Bascially you will get a link with question. we have to write the program and that will sumit remostly the code and compile and validate the code using various automated test cases.


Q 1) Try to find find in a given in put string  it is complete it or not  (ex for complete: {,(.[,......},],).

how to interpret the question: Intension is to find {} are presnt or () or [] ....

How to solve:
int type1=0;

Approach 1:
while(string != null)
 {
    swtich (char)
    {
         case '{':
         case '}' :

       {
          if (char == '{')
          {
                type1++;
           }
          else
           {
                 type1--;
           }
      
      }
...........................


    }


if(type1 || type2 || type3 ||..)
  {
    not  a perfect string
 }
 }


Approach 2:

Use a stack to store the value and search



Q 2 )given  charcaters...like ...a, b, c, d etc...



need to print possible combinations: a, b,c,d, ab, ac,ad, bc,bd,ba, cd,ca,cb, abc, a....

How to interpret the question: Basically they want to have a loo and get hold on that...

Solution:





Q3) what is the minimum starting value need to reach the destination.

    Each state in a game will give + or -ve. If we have -ve mean...we will die.


Logic: we should  always >=0 most important at every step/state.



Q4) two friends are working....A done Mn days ...and B done Ndays work...

A do better than B.


how many days it take to complete the work "P))" days done by A .....with B.

1+  (p/A-B)


Q5) Find a given number is bouncy or not...

123456 , 45678 ...is correct number
34567 is boucy number

Logic: it is expected all digits should be in increase order....






Day 2(BU NAME: xxxx) :



1) What is abstrct class
2) private/public/protec data how it will be there in derived class..
3) what is virutcal function
4) pure vitural function...vptr
5) unix process memory layout
6) siganls
7) segmenation fault/segbus error.
8) what is late binding.
 

No comments:

Post a Comment