Amazon Interview Question for Software Engineer / Developers


Country: India
Interview Type: Written Test




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

Reference: Wikipedia:
"An expression is said to be referentially transparent if it can be replaced with its value without changing the behavior of a program (in other words, yielding a program that has the same effects and output on the same input). The opposite term is referentially opaque."

So log(x) is referentially transparent, rest are referentially opaque.

Because for given x, log(x) has a certain value. But in case of:
now(): time changes so you can't possibly replace it with an exact value.
strcat(str1, gets()): result depends upon input string received from gets.
rand(0, 1): random number between 0 and 1, cannot have certain value, it will be different each time it is called.

- mag January 07, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

what is now function .is it in c?

- usri January 07, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

It's not in C, but wherever it is, may in Java or C#, it seems to give current system time.

- mag January 07, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

log(x) as it can be replaced by a definite answer, others cannot be...

- Anonymous January 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

agree

- guest January 17, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Its rand(0,1)..Since it will only output 1 or 0 and we will get to know the answer..but in other cases you will have to depend on other things.

- Vineet Setia January 07, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

my answer is wrong. so don't go with this.

- Anonymous January 07, 2012 | 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