Qualcomm Interview Question for Software Engineer / Developers






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

#include <stdio.h>
#include <windows.h>

void StackOverFlow()
{
CONTEXT context;

// we are interested control registers
context.ContextFlags = CONTEXT_CONTROL;

// get the details
GetThreadContext(GetCurrentThread(), &context);

// print the stack pointer
printf("Esp: %X\n", context.Esp);

// this will eventually overflow the stack
StackOverFlow();
}

DWORD ExceptionFilter(EXCEPTION_POINTERS *pointers, DWORD dwException)
{
return EXCEPTION_EXECUTE_HANDLER;
}

void main()
{
CONTEXT context;

// we are interested control registers
context.ContextFlags = CONTEXT_CONTROL;

// get the details
GetThreadContext(GetCurrentThread(), &context);

// print the stack pointer
printf("Esp: %X\n", context.Esp);

__try
{
// cause a stack overflow
StackOverFlow();
}
__except(ExceptionFilter(GetExceptionInformation(), GetExceptionCode()))
{
printf("\n****** ExceptionFilter fired ******\n");
}
}

- Anonymous November 24, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Stack overflow can happen in two different ways.
1) Too many function calls, may be infinite recursion.
2) Very large stack frames.

First case surely be found with stack trace help. Where as the second case is very difficult to find. Fortunately, writing program to create the second case is very difficult.

- Win August 10, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Using stacktrace..e.printstacktrace() in java and analyse the calls.
common cause:Recursive function(unable to find exit point)
infinite loop.
One Example:reading huge XML(repeated data elements,its trying to read and read..)

- kapoor.utd March 31, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.


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