Programs and Puzzles in technical interviews i faced

I have attended interview of nearly 10 companies in my campus placements and sharing their experiences with you,though i did not got selected in any of the companies but i had great experience facing their interviews and it might help you as well in preparation of interviews.Here are some of the puzzles and programs asked to me in interview in some of the good companies.

CHECK-OUT the VIDEO of  Technical Interview for SAP Labs, CA Tech & HP R&D




1) SAP Labs
I attended sap lab online test in my college through campus placements.It had 3 sections,the first one is usual aptitude questions which i would say were little tricky to solve.The second section was Programming test in which you were provided snippet of code and you have to complete the code (See Tricky Code Snippets ).The code are from different data structures like Binary Tree, AVL Tree etc.Then the third section had questions from Database,OS and Networks.After 2-3 hours we got the result and i was shortlisted for the nest round of interviews scheduled next day.Then the next day we had PPT of the company and interview started.After waiting 3-4 hours i was from the last 3-4 persons to get interview.Finally they called my name and i entered the room i saw the interviewer (Which my friends said that he rejected almost all of the people who went to him).I cursed my luck and sat down in chair,without asking anything about me he started shooting questions at me.He started asking questions from Database.His first question was make two tables on your own and write the query of  RIGHT OUTER JOIN on both the table and write output.I did it correctly.Next question he asked to again make a table which is not in 2NF and make it 2NF he asked me to do same thing for 3NF.The next question he asked me to write algorithm for Quick Sort and gave me array and told to sort it step wise using that algorithm.I kind a stucked in that in some of the last steps.He told me to leave it and asked next question.He gave me some array and asked me to find the 2nd largest element in that array without sorting it (See Program to find second largest element in an array ).I told him my approach he was satisfied and asked me to write code of it.I written it with some slight errors he said its ohk.Then he asked me some questions on overloading and finally two puzzle which i was not able to answer it correctly but explained my approach.one of the Puzzles was
The 13 litre and 7 litre cans are completely filled and 19 litre can is empty.Now he wanted 10 litre in one can and 10 litre in other.You can only transfer water from one can to other you cant throw any water.That was the end of the interview.I got rejected after that round :-(




2) CA Technologies
I attended online test of CA tech on coCubes.com.The test consist of Aptitude LR C++ and computer fundamentals.I got shortlisted after written test and we are going to have 3 rounds of Interview 1 technical 1 managerial and 1 Hr.I was called for technical interview.My interviewer was very friendly he asked about myself and my favourite subjects i told him Database Management and Web Technologies.H easked me some questions on Database like Normalization,Referential Integrity and some joins.Then he asked me about Sessions and cookies in PHP and difference between GET and POST method (See Basic Interview Questions in PHP ).Then he asked me about jQuery i mentioned in my resume and asked me to explain my projects.Then he asked me dynamic memory allocation in c++ and what is memory Leak.I explained them he was satisfied and asked me what is Garbage collection in Java i told him about it,then he asked how JVM knows when to invoke garbage collection,i told him i dont know,he said me dont worry its not necessary to answer every question in interview,then finally he asked me some questions on softwares i have written in my resume and tell me to wait.I cleared that round and then i cleared other 2 rounds also but they selected 5 from final 13 and i was not one of them :-(

3)HP R&D
I cleared the written round of HP R&D which was of 5 papers 1st was aptitude 2nd was computer fundamental 3rd was c++ 4th OS and networks abd 5th is again c++.I was called for the interview and i was the first person to be called for interview.The interviewer was tech lead and was not very friendly.He asked me about myself and started with one Puzzle.It was about a circular railway track with tunnel T an engine E and two boggies A and B

He asked me to swap boggies A and B with a condition that No Boggies can enter from the tunnel only engine can enter from the tunnel.I tried a few possibilities and swapped A and B but my engine got stucked between A and B and he said that engine should be in its original position only.i tried it for sometime then interviewer told me that this puzzle can be solved only if i will think out of box something. I tried for some more time then he asked me to leave it.Then he asked me to write a program in c++ to print numbers 1-10 then again 9-1 like this 1 2 3....10 9 8 7......1.

CHECK-OUT VIDEO of Tricky Puzzles in C


I made the program then he asked me to use only one loop i made that too.Then he asked me some questions on pointers ans function pointers and some constructors and destructors.Then questions on Virtual memory and then asked me to make a memory representation of Heap and stack memory.I didnt know how to draw that so i told him i dont know that.He asked me "ohk
iam done with you" and tell me to wait.I got rejected after that round :-(

4)Sapient
The written test was online test of Aptitude,LR and English and some c,c++ questions.I cleared that round.Next day we had interview.I was called for first round he started asking me puzzles.First puzzle he asked me

a)A census taker approaches a house and asks the woman who answers the door "How many children do you have, and what are their ages?
Woman: "I have three children; the product of their ages is 36, the sum of their ages is equal to the address of the house next door."
The census taker walks next door, comes back and says "I need more information."
The woman replies "I have to go; my oldest child is sleeping upstairs."
Census taker: "Thank you, I now have everything I need."
What are the ages of each of the three children?

b)The puzzle was like he given me two sticks one of 60m and another of 30m and we can measure time using these 2 sticks by burning stick from the ends.stick will burn with 1m/min.How will you measure 45 min from these 2 sticks?


Then he asked me to write a program of printing 1-100 numbers without using loop and recursion (See Tricky Programs in C ).I did it. Next he asked me to concatenate two linked list ( See Program for Union of 2 linked list ). I cleared this round.

PS-For the solutions of above puzzles and programs see comments.I will be posting it soon :-)


Comments

  1. The answer for first puzzle is as follows:
    I will refer 19 ltr can as A, 13 ltr can as B and 7ltr can as C.
    1) First pour water of C in A , then transfer 12 ltrs from B to A.A will be now completely filled, C empty and B with 1ltr.
    2)Transfer From A to C 7 ltrs and then transfer 7 ltr water from C to B.Again Transfer From A to C 7 ltrs and then transfer 5 ltr water from C to B.Now A will have 5 ltrs, B will be completely filled and C will have 2 ltrs.
    3) Now Transfer From B to A 13 ltrs.Now A has 18 ltrs, B empty and C has 2 ltrs.Transfer the water from C to B.
    3)Repeat above technique once again and now A will have 17 ltrs ,B will be empty and C will have 3 ltrs of water.
    4) Now transfer 3 ltrs from C to B and then using C pour 7 ltrs from A to B.
    Now A and B both will have 10 ltrs of water

    ReplyDelete
    Replies
    1. i don't think even after repeating the technique you ever get A=17 B=empty C=3.

      Delete
    2. Sexy technique Mohan, hope i get the same

      Delete
  2. Thanks Mohan that is correct answer :-)

    ReplyDelete

Post a Comment

Popular posts from this blog

Tricky Questions or Puzzles in C

Program to uncompress a string ie a2b3c4 to aabbbcccc

Number series arrangement puzzles