Académique Documents
Professionnel Documents
Culture Documents
EXTREME_CODING
Time Limit:45 mins
Choose the correct answer from the options given (N.O.T abbreviation have been used for “none
of these”) . If no options are given, then you need to write the output assuming appropriate header
files have been included, or mention if the answer is an ERROR.
Each question carry equal marks. In case of a tie between two participants, the one who has
answered more no of star marked questions will be preferred.
(3) main() {
static i=3;
printf("%d",i--);
return i>0 ? main():0; }
(13)There are code fragment of two programs. Assume code block is same for both fragment. Compare
efficiency of both fragment
Fragment 1:
For(i=0;i<100;i++)
For(j=0;j<10;j++)
{ code block }
Fragment 2:
For(i=0;i<10;i++)
For(j=0;j<100;j++)
{code block }
(a) equally efficient (b) fragment 1 is more efficient
(c) none of these (d) fragment 2 is more efficient
(15)void main()
{ unsigned i=1;
signed j=-1;
if(i<j) printf("less");
else if(i>j) printf("greater");
else if(i==j) printf("equal"); }
(16)void main()
{ int i;
i=~!!~printf(““);
printf(“%d”,i);}
return 0; }
(19)int main()
{ int x = 10, y = 20;
if(!(!x) && x)
printf("x = %d\n", x);
else
printf("y = %d\n", y);
return 0; }
(a) X=10 (b) x=0 (c) y=20 (d) x=1
(20)int main()
{ static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0; }
(a) Ink (b)ite (c) let (d) ack
(26) Assuming LINUX/UNIX platform write how many times printf function Will
get executed .
int main()
{ printf("S1\n");
if(fork()) printf("S2\n");
else
fork(); printf("s3\n");
printf("S4\n");
return 0; }
(a) 4 (b) 6 (c ) 7 (d) 8 (e) 10
(30) main()
{ int i=-1, j=-1, k=0, l=2, m;
m=i++&&j++&&k++||l++;
printf("%d %d ”,l,m); }
(a) 3,0 (b) 3,1 (c)2,0 (d)2,1