Baidu Interview Question for Software Engineer / Developers






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

When i is a user defined type

And you look at implementation of both i++ and ++i and decide that one of them is written better than other

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

generally speaking ++i is faster than i++, but in what cases i++ is better than ++i?

- Itcecsa July 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

plz explain...?

- Anand February 13, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is better when you need it.

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

It all depends on the situation

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

if you are not using the value of the expression,

- Anonymous December 05, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

int i = 10,j=10;
printf("%d\n",++i);
printf("%d\n",j++);
printf("%d\n",j);

This will print 11,10,11

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

First i++ and ++i are the same since they do the same operation. But the results are not in the same time. With i++, we return the value contained in the variable i before increment it. And ++i, we increment i and we return the value of i. What would happen if in for loop in java we would do something like

for(int i = 0; i < size; ++i) { ....    }

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

yes, in any cases.

- lambda2fei August 03, 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