C Writen Test
C Writen Test
WIZTEC - 11
“NIGHTOUT” - C coding contest (Elimination Round)
Choice:
a) 4 b) 64 c) 16 d) none
2. int main( )
{ int i=2, j=2;
while (i+1? --i: j++)
printf (“%d”, i);
return 0;
}
Choice:
a) 2 b) 3 c) 1 d) compiler error.
3. int main( )
{ int a, b;
a = -3 - - 25;
b = -3 - - (-3);
printf (“%d, %d\n”, a, b);
return 0;
}
Choice:
a) 21,-7 b) -28,-6 c) 22,-6 d) compiler error.
4. main()
{ float x = 9.9999996;
float y = 9.9999994;
printf ("\n%f %f", x, y);
}
Choice:
a) 10.000000 10.000000 b) Error
c) 9.9999999 9.999999 d) 10.000000 9.999999
5. void main( )
{
char *a;
int *b;
float *c;
double *d;
printf (“ %d ”, sizeof(a)) ;
printf (“ %d ”, sizeof(b)) ;
printf (“ %d ”, sizeof(c)) ;
printf (“ %d ”, sizeof(d)) ;
}
Choice:
a) 2 2 8 10 b)2 2 2 8
c) 2 2 2 10 d)2 2 2 2
6. int main()
{
int x = 2;
int *p = &x;
scanf ("%d", p); /* say the input is 4 */
printf (“x = %d”, *p + x);
}
Choice:
a) x = garbage b) Error: & is not specified in scanf c) x = 8 d) x = 6
7. int main()
{
int x=15;
printf ("%d, %d, %d \n", x!=15,x=20,x<30);
return 0;
}
Choice :
a) 1,20,1 b)compiler error c)0,20,1 d)1,20,0
8. int main()
{
int i=4,j=-1,k=0,y,z;
y=i+5 && j+1||k+2;
z=i+5 ||j+1 && k+2;
printf("%d,%d \n ",y,z);
return 0;
}
Choice :
a)1,0 b)0,0 c)0,1 d)1,1
9. int main( )
{
int k,num=30:
k=(num>5?(num<=10?100:200):500);
printf("k=%d \n",num);
return 0;
}
Choice:
a) k=30 b) k=200 c) k=500 d) k=100
Choice:
a) 8 4 10 2 4 2 6 b) 4 8 10 2 4 2 6 c) 8 4 10 2 4 2 5 d) 8 4 8 2 4 2 5
Choice:
a) 5 b) compiler error c) Garbage value d) 6
12. main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
Choice:
a)Compiler Error b)Runtime Error c) 5 4 3 2 1 d) None
13. main()
{
printf("\nab");
printf("\bsi");
printf("\rwa");
}
Choice:
a)absiwa b)wai c) asa d) aswa
14. main()
{ int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
Choice:
a) 45545 b)56655 c) 56544 d) none
Choice:
a) 1..2..3 b)0..1..2 c) 0..4..8 d) 5..4..5
16. main()
{
int i=400,j=300;
printf("%d..%d");
}
Choice:
a) 400..300 b)garbage value c) 300..400 d) compiler error
17. void main()
{
int i=5;
printf("%d",i+++++i);
}
Choice:
a) 14 b)11 c) 12 d) compiler error
Choice:
a) In show..
b) Error : Too many parameters in 1st and 3rd call
c) Error: Too much space between open close braces
d) In show.. In show.. In show
19. main()
{
int a= 0;int b = 20;char x =1;char y =10;
if(a,b,x,y)
printf("wiztec");
}
Choice:
a) wiztec b)nothing is printed c) a,b,x,y d) compiler error
Choice:
a) have a nice day c) no output
b) error ‘expression syntax’ d)error ‘undeclared identifier if’
(Questions from 21-25 tie breakers)
22.To delete a dynamically allocated array named `a`, the correct statement is
Choice:
a) delete a; b) delete a[0]; c) delete []a; d) delete [0]a;