Friday, September 11, 2009

Mock test of c programming with answer

Mock test of c
programming with answer





1. Point out error, if any, in the
following program



int main(){

int i=1;

switch(i){

case 1:

printf("\nRadioactive cats have 18
half-lives");

break;

case 1*2+4:

printf("\nBottle for rent -inquire
within");

break;

}

}



Answer: No error.



Constant expression like
1*2+4 is acceptable in cases of a switch.



2. Point out the
error, if any

No comments:

Post a Comment