Samsung Interview Question






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

The stack pointer (SP) is a hardware feature of almost all
present-day processors. At a minimum, the SP points to the
present end of a queue which holds return addresses of all
the calls made to the moment. When a call is made, the
return address is pushed onto the stack; upon exiting the
called function, the return address is popped from the stack.

The frame pointer (FP) is an optional programming feature
used by some programming languages on some processors.
Not all processors have the hardware resources to implement
a frame pointer and some implementations don't want to have
the extra overhead of maintaining a frame pointer.

An FP, if used, points to a fixed point in the "user" stack
and points to a location in the stack where the arguments
and local variables for a called function are located. This
pointer is established upon entry to a function and remains
constant throughout the execution of the called function.
Thus, values can be pushed onto the user stack and popped
from it within the function without impacting the offsets
from the FP.

Note that the user stack need not be the same queue as the
one used by the hardware for return addresses. Quite often
the two queues are one and the same, but there's nothing
that says they have to be.

- Malf June 01, 2013 | 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