C-Loop Question and Answer

C-Loop Question and Answer
61. Find the outputt
void main (int seizeofargv, char *argv[ ])
{
while (sizeofargv)
printf ('%s', argv[-- sizeof argv]);
}

  • Garbage string
  • filename.exe
  • filename.c
  • filename.obj
Show Answer
62. Find the output
void main ( )
{
int x, y=1, z;
if (x=z=y); x=3;
while (y<4) x+=++y;
printf('%d %d\n", x, y);
}

  • 3 1
  • 12 4
  • 12 5
  • 3 5
Show Answer
63. Find the output
int i;
void main ( )
{
int j;
for (j=2; printf("%d', i)-j; printf("%d", j))
printf("%d", j--);
}

  • 0210100
  • 0210
  • 021010
  • Compilation error
Show Answer
64. Find the output
void main ( )
{
char as [ ] ="\\00\0";
int i=0;
do
{
switch(as[i++])
{
case '\\'; : printf("A");
break;
case 0: printf("B");
break;
default: printf ("C");
break;
}
}
while (i<3);
}


  • ABC
  • ACB
  • CAB
  • CBA
Show Answer
65. Find the output
void main ( )
{
int a=5;
for (;a=0 ? !a:a;)
printf("Hello");
}

  • Infinite loop
  • Compilation error
  • Hello will be printed only once
  • No output
Show Answer
66. Find the output
void main ( )
{
char str [ ]="ANDAMAN NIKOBAR";
int i, c, A=0, N=0, Extra=0;
for (i=0; (c=str [i])! = c; i++)
{
switch (c)
{
case 'A' : A++;
continue;
case 'N" : N++;
default : EXTRA++;
}
}
printf("%d", EXTRA);
}

  • 10
  • 11
  • 12
  • 13
Show Answer
67. Find the output
void main ( )
{
int p=3;
while (p--);
{
static int i=3;
printf("%d", --i);
}
}

  • 2 1 0
  • 2 2 2
  • Infinite loop
  • 2
Show Answer
68. Find the o utput
void main ( )
{
int x=0;
for (;;)
{
if (x++==4) break;
continue;
}
printf("x = %d", x);
}

  • x=0
  • x=4
  • x=5
  • Infinite loop
Show Answer
69. Find the output
void main ( )
{
int i,j;
i=1;
j=5;
for (;++i<--j;)
continue;
printf('5d %d", i, j);
}

  • 3 4
  • 2 4
  • 3 2
  • 3 3
Show Answer
70. Find the output
void main ( )
{
int i=0;
for (-i--; ++i; printf('%d", i));
printf("%d", i);
}

  • 0
  • Infinite loop
  • 1
  • Compilation error
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test