Qualcomm Interview Question for Software Engineer / Developers






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

char a = 'b';
int *p = (int*)&a;

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

class A {};
class B {};
A * a = new A;
B * b = reinterpret_cast<B*>(a);

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

reinterpret_cast answer was a TOTAL BULL SHIT !!
The answer before was even more DUMBEST!!! BOTH THOSE TWO GUYS MUST BE SHOT TO DEATH, OR, their rib bones must be ripped off and shoved in their respective fucking eyeballs!!! How dare they be stupid here?

void pointtoother(void** d)
{
char* s = (char*)malloc(sizeof(char));
*d = s;
}

char* p = "all_answers_are_dumb_ass_here";//p points to an unnamed array
pointtoother( &p );
//when the call returns, p will be pointing to somewhere else

- Anonymous May 22, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

hahaha...i felt the same way about themm..

- coder May 29, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

are you guys both insane?!
you guys should be shot first.. and stop using such language. you need to get some help bro.. jeez!

both the above answers are right.. try it out first before u start flaming others..

- kk July 02, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

kk,

The question asks for a function which does it. I guess it is assumed that the pointer which much point to another is passed in, something like:

point_to_other(void ** ptr_to_ptr)...

- Bhavati Bhiksham Dehi July 02, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

LOLer

- LOL June 14, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

void PointerToOtherObject(void** pointer, void* otherObject);	// Function prototype perhaps not needed.

void PointerToOtherObject(void** pointer, void* otherObject)  // Parameters are the pointer to be modified and the object that the pointer will point to after the function call.
{
	*pointer = otherObject; // store the object's address within the location of pointer
}


void main(void)	
{
	char* stringObject = "This is a string. ";
	int intObject = 256;
	void* genericPointer = stringObject;   // Assign the pointer to point to the string object.
	PointerToOtherObject(&genericPointer, &intObject); // Call our function to change the pointer to point to the "other object", in this case, an integer.
	// genericPointer now contains the intObject's address. ie, points to the int instead of the character string
}

- Anonymous June 09, 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