Sunday, September 25, 2011

amazon placement papers



 AMAZON:


Hi friends, I attended first round of the interviews held by Amazon.com. 

First they introduced themselves and then asked for my introduction and about my internships and projects.

Then they asked me a programming question related to Binary tree. The question was something like they asked me to point every node at one level to the node to the right of it. 

They asked the logic And time complexity  for the program. Once they were satisfied with it they asked me to write a procedure for that.

They were mainly asking challenging questions on data structures and were looking for persons who can write optimized and scaled programs
1.     Find an element in the array following the condition  a[i] =i.

int arr[] = {0,1,3,5}
output = 0 0r 1

2. Find out elements which is not duplicate in the given array.

Int arr[] = {1,3,5,7,1,3,5}
Output = 7

3.write a function that returns the element which is having maximum occourance in the given string

Char input_str [] = "the things are thin"

So it will returns "t" as it's occourance is 3 times.


4. Algorithm

5. How to rename all the files at the given directory from .jpg to .jpeg.

6. Write a script which reverse the given string x = "the pen is mine" the output is mine is pen the.

7. I want to delete a file in 1000 hosts.1000 host names are provided.

8. Copy a a file form one host "amazon.chennai" to another host "anazon.bbsr"

9. Print the line from 20 to 30th  of a file.

10. Forgot
Hi Friends

Written Test has 2 Sections: A, B.

In Section A there were 20 Questions:
Time: 30 min 
Small Answer Type
Multiple choice

Aptitude

1. Two tables emp (empid, name, deptid, sal) and dept(deptid, deptname) are there. Write a query which displays empname, corresponding deptname also display those employee names who do not belong to any dept.

2. Display the employees whose salary is less than average salary.

3. What is the output of the program
main()
{
int c=5;
printf("%d
%d
%d",c,c<<2,c>> 2);
}

4. main()
{
int a[8][10],c=0,i,j;
for(i=0;i<10;
i++) for(j=0;
j<8;j++) a[j][i]=c++;
printf("%d",a[3][6]);
}

5.What is the wrong in this program
main()
{
char *p,*q;
p=(char *)malloc(25);
q=(char*) malloc(25);
strcpy(p,"amazon" );
strcpy(q,"hyd");
strcat(p,q);
printf("%s",p);
}

6. Write prefix and post fix notation for (a+b)*c-(d+e)^(f-g)

7. What is the output of the program
main()
{
int i=5;
printf("%d",fun(fun(fun(fun( fun(i))))));
}
void fun (int i)
{ if(i%2) return (i+(7*4)-(5/2)+(2*2));
else return (i+(17/5)-(34/15)+(5/2));
}

8. When it is always true boolean fun
(node *p)
{
return ((p==null)||(p->next==null)|| (p->info<=p->next->info)&&( fun(p->next)));
}
a) when list is empty or has one node
b) when the ele are sorted in non decreasing order
c) when the ele are sorted in non increasing order

9. What is x here (x&&!(x&(x-1))==1)
a) x is always a prime
b) x is a power of 2
c) x is even d)x is odd

10. What is the difference between deep copy and shallow copy

11. In java what is the difference between sleep() and wait().

12. What happens when the parent process of a child process exits before the child ?

13. There are three persons A, B, C. A shots the target 6 times out of 7 shots. B shots 4 out of 5 shots. Then what is the probability of hitting the target twice when 2 persons are selected at random.

14. What is valid in cpp char *cp; const char *cpp; 1) cpp=cp; 2) cp=cpp;

15. Write program to swap 2 variables without using extra memory.

16. Write a shell command to find all Java files present in nested directories.

17. There are 6 pairs of black socks and 6 pairs of white socks. What is the probability to pick a pair of black or white socks when 2 socks are selected randomly in darkness.

18. A string of alphanumeric is there. Find a string that starts with b and ends with 3 characters. 

Section B (we have to write programs) time:30 min
1. There is a sorted array which is of very large size. In that all except one no. are repeated once. How to find that non repeated no.
2. There are 2 linked lists. Those 2 lists are meeting at a point. How to find that meeting point. 

Hi Friends

Interview Questions:

1. Given a Binary Search Tree, write a program to print the kth smallest element without using any static / global variable. You can't pass the value k to any function also.

2. What are the 4 basics of OOP?

3. Define Data Abstraction. What is its importance?

4. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.

5. Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren't present.

6. Given a string, find the first un-repeated character in it? Give some test cases

7. You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)

8. Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.

9. What is a C array and illustrate the how is it different from a list.

10. What is the time and space complexities of merge sort and when is it preferred over quick sort?

11. Write a function which takes as parameters one regular expression (only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

12. Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.

13. Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

14. Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.

15. How do you convert a decimal number to its hexa-decimal equivalent. Give a C code to do the same

16. Explain polymorphism. Provide an example.

17. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)

18. You are given some denominations of coins in an array (int denom[]) and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

19. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number 
interview Questions :

1. Given a Binary Search Tree, write a program to print the kth smallest  element without using any static/global variable. You can?t pass the value k to  any function also.

2. What are the 4 basics of OOP?

3. Define Data Abstraction. What is its importance?

4. Given an array of size n. It contains numbers in the range 1 to n. Each  number is present at least once except for 2 numbers. Find the missing numbers.

5. Given an array of size n. It contains numbers in the range 1 to n. Find the  numbers which aren?t present.

6. Given a string,find the first un-repeated character in it? Give some test  cases

7. You are given a dictionary of all valid words. You have the following 3  operations permitted on a word: delete a character, insert a character, replace  a character. Now given two words - word1 and word2 - find the minimum number of  steps required to convert word1 to word2. (one operation counts as 1 step.)

8. Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the  number of smaller cubes on the surface. Extend this to k-dimension.

9. What is a C array and illustrate the how is it different from a list.

10. What is the time and space complexities of merge sort and when is it  preferred over quick sort?

11. Write a function which takes as parameters one regular expression(only ? and  * are the special characters) and a string and returns whether the string  matched the regular expression.

12. Given n red balls and m blue balls and some containers, how would you  distribute those balls among the containers such that the probability of picking  a red ball is maximized, assuming that the user randomly chooses a container and  then randomly picks a ball from that.

13. Find the second largest element in an array with minimum no of comparisons  and give the minimum no of comparisons needed on an array of size N to do the  same.

14. Given an array of size n, containing every element from 1 to n+1, except  one. Find the missing element.

15. How do you convert a decimal number to its hexa-decimal equivalent.Give a C  code to do the same

16. Explain polymorphism. Provide an example.

17. Given an array all of whose elements are positive numbers, find the maximum  sum of a subsequence with the constraint that no 2 numbers in the sequence  should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10)  or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)

18. You are given some denominations of coins in an array (int denom[])and  infinite supply of all of them. Given an amount (int amount), find the minimum  number of coins required to get the exact amount. What is the method called?

19. Given an array of size n. It contains numbers in the range 1 to n. Each  number is present at least once except for 1 number. Find the missing number 

Written Test has 2 Sections A, B In Section A there  were 20 Questions:
 
Time :30 min  
Small Answer Type 
Multiple choice 
Aptitude  
1.Two tables emp (empid,name,deptid,sal) and  dept(deptid,deptname) are there.write a query which displays  empname,corresponding deptname also display those employee names who donot  belong to any dept.

2.Display the employees whose salary is less than average  salary.

3.what is the output of the program
main()
{
int c=5;
printf("%d
%d
%d",c,c<<2,c>> 2);
}

4. main()
{
int a[8][10],c=0,i,j;
for(i=0;i<10;
i++) for(j=0;
j<8;j++) a[j][i]=c++;
printf("%d",a[3][6]);
}

5.What is the wrong in this program
main()
{
char *p,*q;
p=(char *)malloc(25);
q=(char*) malloc(25);
strcpy(p,"amazon" );
strcpy(q,"hyd");
strcat(p,q);
printf("%s",p);
}

6.write prefix and post fix notation for (a+b)*c-(d+e)^(f-g)

7.what is the output of the program
main()
{
int i=5;
printf("%d",fun(fun(fun(fun( fun(i))))));
}
void fun (int i)
{ if(i%2) return (i+(7*4)-(5/2)+(2*2));
else return (i+(17/5)-(34/15)+(5/2));
}

8.When it is always true boolean fun
(node *p)
{
return ((p==null)||(p->next==null)|| (p->info<=p->next->info)&&( fun(p->next)));
}
a) when list is empty or has one node
b) when the ele are sorted in non decreasing order
c) when the ele are sorted in non increasing order

9.what is x here (x&&!(x&(x-1))==1)
a) x is always a prime
b) x is a power of 2
c) x is even d)x is odd

10 .What is the difference between deep copy and shallow  copy

11.In java what is the difference between sleep() and  wait() .

12.What happens when the parent process of a child process  exits before the child ?

13.There are three persons A,B,C .A shots the target 6  times out of 7 shots .B shots 4 out of 5 shots .Then what is the probability of  hitting the target twice when 2 persons are selected at random.

14.what is valid in cpp char *cp; const char *cpp; 1) cpp=cp;  2) cp=cpp;

15.write program to swap 2 variables without using extra  memory.

16.write a shell command to find all java files present in  nested directories.

17.There are 6 pairs of black socks and 6 pairs of white  socks.What is the probability to pick a pair of black or white socks when 2  socks are selected randomly in darkness.

18.A string of alphanumeric is there.Find a string that  starts with b and ends with 3 characters. section B (we have to write programs)  time:30 min 
    1. There is a sorted array which is of very large size.In  that all except one no. are repeated once.How to find that non repeated no.
    2. There are 2 linked lists.Those 2 lists are meeting at a  point.How to find that meeting point. 



Paper : Amazon Latest Placement Paper Pattern (Hyderabad) 

Written Test has 2 Sections A, B In Section A there were 20 Questions:

Time :30 min
        
Small Answer Type        
Multiple choice        
Aptitude  
1.Two tables emp(empid,name,deptid,sal) and dept(deptid,deptname) are there.write a query which displays empname,corresponding deptname also display those employee names who donot belong to any dept. 

2.Display the employees whose salary is less than average salary. 

3.what is the output of the program 
main() 
{ 
int c=5; 
printf("%d
%d
%d",c,c<<2,c>> 2);
} 

4.
main() 
{ 
int a[8][10],c=0,i,j;
 for(i=0;i<10;
i++) for(j=0;
j<8;j++) a[j][i]=c++;
printf("%d",a[3][6]);
} 

5.What is the wrong in this program 
main() 
{ 
char *p,*q; 
p=(char *)malloc(25); 
q=(char*) malloc(25); 
strcpy(p,"amazon" ); 
strcpy(q,"hyd"); 
strcat(p,q); 
printf("%s",p); 
} 

6.write prefix and post fix notation for (a+b)*c-(d+e)^(f-g) 

7.what is the output of the program 
main() 
{ 
int i=5; 
printf("%d",fun(fun(fun(fun( fun(i)))))); 
} 
void fun(int i) 
{ if(i%2) return (i+(7*4)-(5/2)+(2*2)); 
else return (i+(17/5)-(34/15)+(5/2)); 
} 

8.When it is always true boolean fun 

(node *p) 
{ 
return ((p==null)||(p->next==null)|| (p->info<=p->next->info)&&( fun(p->next))); 
} 

a)when list is empty or has one node 
b)when the ele are sorted in non decreasing order 
c)when the ele are sorted in non increasing order 

9.what is x here (x&&!(x&(x-1))==1) 
a)x is always a prime 
b)x is a power of 2 
c)x is even d)x is odd 

10 .What is the difference between deep copy and shallow copy 

11.In java what is the difference between sleep() and wait() . 

12.What happens when the parent process of a child process exits before the child ? 

13.There are three persons A,B,C .A shots the target 6 times out of 7 shots .B shots 4 out of 5 shots .Then what is the probability of hitting the target twice when 2 persons are selected at random. 

14.what is valid in cpp char *cp; const char *cpp; 1) cpp=cp; 2) cp=cpp; 

15.write program to swap 2 variables without using extra memory. 

16.write a shell command to find all java files present in nested directories. 

17.There are 6 pairs of black socks and 6 pairs of white socks.What is the probability to pick a pair of black or white socks when 2 socks are selected randomly in darkness. 

18.A string of alphanumeric is there.Find a string that starts with b and ends with 3 characters. section B (we have to write programs) time:30 min 

1.There is a sorted array which is of very large size.In that all except one no. are repeated once.How to find that non repeated no. 
2.There are 2 linked lists.Those 2 lists are meeting at a point.How to find that meeting point.

No of Rounds : Screeing Test
INTERVIEW : Amazon interview questions
               
Given       a Binary Search Tree, write a program to print the kth smallest element       without using any static/global variable. You can?t pass the value k to       any function also.
                  
What       are the 4 basics of OOP?
                  
Define       Data Abstraction. What is its importance?
                  
Given       an array of size n. It contains numbers in the range 1 to n. Each number       is present at least once except for 2 numbers. Find the missing numbers.
                  
Given       an array of size n. It contains numbers in the range 1 to n. Find the       numbers which aren?t present.
                  
Given       a string,find the first un-repeated character in it? Give some test cases
                  
You       are given a dictionary of all valid words. You have the following 3       operations permitted on a word: delete a character, insert a character,       replace a character. Now given two words - word1 and word2 - find the       minimum number of steps required to convert word1 to word2. (one operation       counts as 1 step.)
                  
Given       a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number       of smaller cubes on the surface. Extend this to k-dimension.
                  
What       is a C array and illustrate the how is it different from a list.
                  
What       is the time and space complexities of merge sort and when is it preferred       over quick sort?
                  
Write       a function which takes as parameters one regular expression(only ? and *       are the special characters) and a string and returns whether the string       matched the regular expression.
                  
Given       n red balls and m blue balls and some containers, how would you distribute       those balls among the containers such that the probability of picking a       red ball is maximized, assuming that the user randomly chooses a container       and then randomly picks a ball from that.
                  
Find       the second largest element in an array with minimum no of comparisons and       give the minimum no of comparisons needed on an array of size N to do the       same.
                  
Given       an array of size n, containing every element from 1 to n+1, except one.       Find the missing element.
                  
How       do you convert a decimal number to its hexa-decimal equivalent.Give a C       code to do the same
                  
Explain       polymorphism. Provide an example.
                  
Given       an array all of whose elements are positive numbers, find the maximum sum       of a subsequence with the constraint that no 2 numbers in the sequence       should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3       and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)
                  
You       are given some denominations of coins in an array (int denom[])and       infinite supply of all of them. Given an amount (int amount), find the       minimum number of coins required to get the exact amount. What is the       method called?
                  
Given       an array of size n. It contains numbers in the range 1 to n. Each number       is present at least once except for 1 number. Find the missing number.  

Amazon India latest placement paper for 2007 :
[ Amazon - US major internet based seller of books, CDs, DVDs and lots other stuff ]


See 2008 sample placement papers and technical / hr interview questions in future here for freshers / walkins, BPO, call centre, back office function job exam.

Written test.
They concentrate on every field of computer science. They asked c, data structure, TOC(context free and context sensitive grammar, regular languages. DBMS unix was not there.
There were two subjective questions.
1. The first one was "given two lists write a function which returns a list which is the intersection of the two lists.the original lists should remain same. 
(Intersection - if first list is say,1,20 3,45 and second list is 3,24 ,45,90,68 then intersection should be 3,45 )

2. The second was given two nodes of a binary tree find the closest ancestor of the two nodes.
Note:consider binary tree and binary search tree also.

In short answer type questions, the questions were -
1.There was an aptitude's question in which P(A) and P(B) were given and we had to find P(B/A) and P(A/B) when A and B are independent events.

2.What is the probability that the the 4 digit's no. which is formed by using the digits 1,2,3,4,5,6 is divisible by 4.

3.What tree traversal gives the no. in sorted order.Inorder,preorder or postorder ?

4.Preorder and inorder traversal was given and we had to find the tree.

5. Which sorting algorithm takes best and worst time complexity as O(nlogn)?

6.A dbms query was asked to find the second largest no. of book sold.(i don't remember the question exactly)
What is Your Opinion?

What do you think about the Expereince ? Any tips/suggestions ?
They emphasised especially on Data Structures specially trees and sorting.

Basically study the Amazon profile and prove that you can be a good web programmer or perfect for back office technical problem handling job. Good Luck for your exam.

General Information about Amazon:

Amazon is one of the largest internet based sellers. Amazon.com has a very popular affiliate program using which people can sell amazon's goods on thier stores using just automatic targeting codes from amazon. Many people run and advertise their specific categories Amazon powered stores where everything is handled by amazon and the people handle on the promotion / getting customers part. Sales and checkout is handled by amazon itself. This was a little about amazon's affiliate set up. But Amazon is the most popular place about buying books, cds, dvds online in US, UK, Europe and even india.

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "amazon placement papers"

Post a Comment