Microsoft Interview Question for Software Engineer / Developers


Team: bing
Country: India
Interview Type: In-Person




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

Qus : what does malloc return ?
Ans : malloc returns void Pointer.

Qus : what happens when you allocate memeory using malloc(sizeof(node)) in your code ?
Ans : malloc will allocate memory that will be multiple of size of largest data type.
means size of memory will equal and greater than size of node and multiple of
size of largest data type .

Qus : where node is a pointer variable of list* node ?
Ans : node will contain the address of allocated memory from heap.

Example : node = (node *)malloc(sizeof(node));

- bottomboy@31 March 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

malloc returns a void pointer after allocation ... the pgmmer needs to typecast the void pointer to the type of data he requested the memory allocation for...

- Vikas March 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

malloc(sizeof(node)) will return size of address, for e.g. x86_64 address size is 8-byte and i386 address size will be 4-byte.

- mtsingh March 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

it returns void *

- siddhartha choubey October 13, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Malloc allocates the portion of memory in heap and returns the pointer pointing to that heap.

- Candida March 27, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

malloc() returns starting address allocated for the array/structure

- Anonymous September 14, 2012 | 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