The Wayback Machine - https://web.archive.org/web/20130119172411/http://electrofriends.com/interview-questions/cpp-interview-questions/find-the-output-of-the-program/

Find the output of the cpp program

Thursday, November 29th, 2012

What is the output of below code?

1
2
3
4
5
6
7
8
#include "iostream"
using namespace std;
int main()
{
    int i;
    i = 1 + ( 1, 4, 5, 6, 3);
    cout<<i;
}

a) 4
b) 7
c) compile time error
d) no output

The correct answer for this question is b)7 if we perform the arithmetic operation with in parenthesis the largest number from the set is taken for computation of output

Avatar of Arun

Author Name :
Arun

Total : 0 Comment


Leave a Reply

Free email signup

Email: