Interview Question






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

3 of course

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

could you explain

- Anonymous January 14, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I will produce 3 lines(Result of 2, 4, 6) only because each time it would
increment after the contion has checked and then it has princrement in the curly braces.So after the first iteration value of i would be 2 .

- sivasankar January 14, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Absolutely correct answer!!

- Anonymous August 10, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

shouldn't it be a compile error.
endl is valid, but end1 (endone) would result in compile error.

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

2 lines.
IT prints 2, 4

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

3

- arun July 29, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

2 line..The reason: post increment operator take the value before increment in the register and increment the value of the variable...comparison is done with value in the register.This is the reason why ++i is faster than i++.

- Maankutti September 12, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

3 Lines and will print 2 4 and 6.

- devendersys September 18, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ignore anonymous and maankutti. It is infact 3
0<5
0++
++1
cout<<2
2<5
2++
++3
cout<<4
4<5
4++
++5
cout<<6
6<5
loop terminates

- Jeffrey October 29, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ignore anonymous and maankutti. It is infact 3
0<5
0++
++1
cout<<2
2<5
2++
++3
cout<<4
4<5
4++
++5
cout<<6
6<5
loop terminates

- Jeffrey October 29, 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