Amazon Interview Question for Software Engineer / Developers






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

the variables are stored like..
auto - stack
static - data segment
register - cpu registers
extern - data segment

also memory we allocate dynalically using malloc etc is created using heap.
and out program is stored into code segment..
..
hope it will help :)

- xmagics June 23, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

there are only two types of memory.
one is heap(dynamicallay, global etc) and second is stack(local).
it depends where the variable is declared.

- ashok tripathi June 28, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

in BSS->un-initialized static variable
DATA-> initialized static variable

- nishant gupta June 30, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Well in C and C++ there is nothing like un-initialized static variables.. All the static-variables are initialized to 0 by default(in case we dont explicitly initialize it).. So they are always stored in the data segment..

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

Nishant is correct.
There are two types of Data Segments

1. Uninitialized data segment(block started by symbol -bss). Whenever you declare a static variable or global variable, and do not initialize it, they are automatically initialized to 0 or NULL and stored here

2. Initialized Data Segment - All static or global variables that you initialize are stored here

- Nikunj October 16, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Someone said "extern - data segment" which is sort of incorrect. Actually, for extern variables memory is not allocated at that time ( Assuming that it would be allocated some where else where the object is actually defined ). That would be a global object in general ( although I couldn't think of any other alternative, I won't commit on it ). Thats the reason why that particular object will go to data segment( if initialized ) or bss (if uninitialized ).

- Anonymous December 02, 2009 | Flag Reply


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