Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Open those files that have www.amazon.com by grep -l command.
2. Use 'sed' command tool with -e option s/www.amazon.com/www.amazon.com?id=123 on these files

We can use inverted apostrophe (`) to use the output of one command to replace it in the other command.

- loky February 17, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

seems like you do really difficult stuff at school. would like so much to be in your school

- jh February 21, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What do they want? A fast algorithm or implementation?

It can be done in perl just like that. I don't quite understand what the question is about.

- Lindos February 24, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I didn't get this question. Can anyone clarify please?

If the change needs to be done on all the pages on internet then its not possible as we won't have access to modify the pages. In case, we do have the access, then I guess we need to search for the hyperlink using some fast algo like Boyer's Moore Algorithm for string matching and replace it.

However I guess better would have been to keep amazon.com and when the request comes to the default page on amazon simply redirect it to amazon.com?id=123 but I know thats not what's being asked here.

- gauravk.18 February 25, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

grep -r -l 'www.amazon.com' | sed -e 's/www.amazon.com/www.amazon.com?id=123/g'

- gatech March 09, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

grep -i 'www.amazon.com' * | sed -e 's/www.amazon.com/www.amazon.com?id=123/g'

- Anonymous April 08, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i tried these commands on my UNIX box .. all that happens is that the string being replace i.e. www.amazon.com?id=123 gets printed to stdout .. the file remains unchanged ? isnt our goal to find and replace strings in the file itself ?

- Anonymous November 11, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Open those files that have www.amazon.com by grep -l command.
2. Use 'sed' command tool with -e option s/www.amazon.com/www.amazon.com?id=123 on these files ..

wouldnt this change only the first occurance of www.amazon.com to www.amazon.com?123 ....

I think...
2. Use 'sed' command tool with -e option "s/www.amazon.com/www.amazon.com?id=123/g " will make a global change to the file...

Please correct me if I am worng .. thnks

- cro April 13, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

this will change all the Occurrences of "www.amazon.com", even though that is a substring like www.amazon.com/appl/index.php

- :) April 23, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

and also if its part of text of body

- :) April 23, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

But it will cause an error if the original string was like www.amazon.com?id=456/g

- test May 07, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

can someone please tell me how wxactly to use these commands... ?

- rocky June 08, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

make a program to recurse every every link in the website. be aware that some links might be generated dynamically through javascript, 'hidden post action' and inputting some string to inputbox.

- Anonymous September 17, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

amazon.com

- rainysummer2009 February 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

hi i did this in school. u dumb ppl ,

- pkailay February 21, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

i did this in school. dumb ques.

- pkailay February 21, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

good for you

- zdmytriv February 21, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

so you do only dumb questions in school?

- dopemeister April 01, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@pkailay

"AMAZON" likes dumb people :)

- Ran November 22, 2009 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More