Thursday, February 14, 2008

Aptitude Question No.17

Aptitude Question No.17

main()
{

int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}

Answer :
three


Explanation :
The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

No comments:

2008 Placement papers of Top MNC companies

eXTReMe Tracker