Interview Question for Software Engineer / Developers






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

comparison between signed and unsigned and hence for condition fails.

- abhispra January 25, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Perfect! in most of the complier versions TOTAL_ELEMENTS will be type long unsigned int, hence the condition fails!

- initrd August 14, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int is signed by default, but sizeof() returns unsigned. comparsion between signed and unsigned promotes signed to unsigned

- Anonymous January 25, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

no wrong!!

- shrishti January 26, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The code runs perfectly ! Tried executing it.

- Job Hunter January 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Try rerunning the code. It will run without printing any output!!

- abhispra January 28, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

When comparing signed int and unsigned int integers
if signed int is negative then it will be converted to (maximum number of unsigned int value - signed int) and hence condition failes
Here d=1- then will be considered (4294967295 -d ) and then compared

here 4294967295 is max unsigned int value

--- Ravi

- Anonymous February 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#define TOTAL_ELEMENTS 28/7 //instead of (sizeof(array) / sizeof(array[0]))

For this macro code works f9 ....
but y not 4 above case ???

- aditya rajhans October 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

srry this one:-|
#define TOTAL_ELEMENTS 28/4

- aditya rajhans October 10, 2011 | Flag


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