Microsoft Interview Question for Software Engineer in Tests






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

through sizeof(struct stack) and then finding out how many nodes are there in stack. I think this would work

- Aditya June 07, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Usually stack size is a compile time option.

- kwirky June 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Stack is ADT, it can be implimented using array or linklist or any other data structure. Hence sizing stack is the feature of container (array / linklist) that defines if stacksize can be defined during runtime or not :)

- Anonymous June 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Seems like there is the ulimit command in unix to set/change stack size ?

- Sanjay June 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Also, for testing purposes, stack behavior in a multi threaded environment should be tested :)

- Sanjay June 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ulinit is used to change allowed maximum file descriptor on linux

- Anonymous June 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

size command gives the size of an object file after compilation( not at runtime) in linux . But the question is :run time stack.I think we have to use any psuedo file system like "proc" in linux distros. There associated with process id (which we can get using getpid()) and at all if we have permission to access /proc/"pid" directory then we can almost get any information related to process memory. Any suggestions are welcome.

- Anonymous July 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

One more thing : usually stack address starts from 0xffffffff. So if we find address of last defined variable in a function and subtract it from address above , we can approximately get stack size.

- Anonymous July 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Change the stack structure by adding a an extra element for saving stack size, somthing like

struct stackelement
{
int stackLen;
blah blah
stackelement *next;
}

every time you push a element do the following


a) pop a element read the stack size
b) push the element
c) increase the stack size and embed in the new item to pushed

to get the stack size
a) pop a element and read stack size
b) push the element back to stack

complexity is O(1)

disadvantage relatively more memory than usual stack.

- Anonymous July 15, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Change the stack structure by adding a an extra element for saving stack size, somthing like

struct stackelement
{
int stackLen;
blah blah
stackelement *next;
}

every time you push a element do the following


a) pop a element read the stack size
b) push the element
c) increase the stack size and embed in the new item to pushed

to get the stack size
a) pop a element and read stack size
b) push the element back to stack

complexity is O(1)

disadvantage relatively more memory than usual stack.

- Anonymous July 15, 2011 | 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