C++ Programming interview Questions

C++ Programming interview Questions
1.Q) What do you think is the output???

int main( )
{
int a=3,b;
b=a++ + a++;
print statement
a = 3;
b=++a + ++a;
print statement
return 0;
}


2.Q) The following coding:
a=3;
int c = ++a;
int d = ++a;
int b = c + d;
a=3;
b = ++a + ++a;

What are the values for 'b' in both cases?
3.Q) In the following piece of coding what do you think is the value of j?

char i=127;
int j;
i=i+1;
j=i;
cout<4.Q) ‘cout’ and ‘cin’ are keywords?


5a.) For each of the questions below assume:

int i = 2;
int j = 5;
int k;

Find out the value of ‘k’ (not all will have values because some are illegal statements).

k= (j++);

0 comments:

Post a Comment