Amazon Interview questions for Intern Position round1
1)There are two urns A and B and an equal number of red balls and blue balls.How do u place the balls in the urns such that the probability of picking up the red ball is greater?
2)Two trains enter at the opposite sides of a tunnel of length L with speeds 'V'. A particle enters the tunnel at the same time with a speed 'v' and it vibrates in the tunnel[i.e. if it reaches the end of the tunnel then it comes back]. What is the position of the particle by the time the 2 trains meet?
3)Write an sql query to sort a table according to the amounts in a row and find the second largest amount.
4)How do you kill a process?
5)What is the functionality of a top command?
6)Given an array of size n+1 which contains all the numbers from 1 to n.Find the number which is repeated in O(n) time.How do you proceed with the same with floating numbers from 0 to 1 instead of 1 to n?
7)Design a datastructure to represent the movement of a knight on a chess board
8)Write an algorithm to traverse a knight covering all the squares on a chessboard starting at a particular point.
Answers for some questions of Amazon interview Above
1)Place a red ball in a urn and all the further balls in the other urn.The probability for picking out the red ball is now greater than 0.5.
2)If v<=2V then the position is (v*L)/(2*V) from the starting point else it is 2*L -(v*L)/(2*V) from the starting point.
4)If we know the process then we can kill it by killall -9 "process name" else we can kill it using its process id obtained by the command ps -x by kill -9 "processid" .
5)Top command displays all the Linux tasks running at that particular time.It provides their running time and the resources used.
6)The number appearing 2 times is (sum of all the numbers in the array) - (sum of the numbers from 1 to n).
For floating numbers multiply it with 100 and proceed.
No comments:
Post a Comment