Cute FTP Pro

The basics (chapters 1 to 3)


This is an evaluation test (don't worry, no one is going to grade you). Choose the answers and click on the "Submit" button to view your score. The correct answers with explanations will be shown after you take the evaluation test. (updated 12 Nov 2005)

1.Q) What do you think is the output???

int main( )
{
int a=3,b;
b=a++ + a++;
cout<<endl<<"b value = "<<b;
a = 3;
b=++a + ++a;
cout<<endl<<"b value = "<<b;
return 0;
}

 

Answer.)

5,10
6,10
5,11
Depends on compiler!
6,11

 

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?

Answer.)

8,9
10,10
9,10
9 (sure), 10 (mostly)
9,9

 

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<<j;

 

Answer.)

128
127
-127
-128

 

4.Q) ‘cout’ and ‘cin’ are keywords?

 

Answer.)

True
False

 

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++);

 

Answer.)

5
6
4

 

5b.)

k= 2++;

Answer.)

3
4
5
Illegal

5c.)

k= i++ + ++j;

 

Answer.)

9
7
8
Illegal

 
5d.)

k = i+++++j;

 

Answer.)

9
7
8
Illegal

 
5e.)

k= i = (j = 1);

 

Answer.)

1
2
5
Illegal

 
5f.)

1=2;

 

Answer.)

1
2
Illegal

 

If you didn't get the solutions pop-up window then click here for the solutions


Go back to the Contents Page


Copyright © 2004 Sethu Subramanian All rights reserved. Sign my guestbook.