C-Loop Question and Answer

C-Loop Question and Answer
11. Find the output
void main ( )
{
for putchar ('g'); putchar ('o');
putchar ('d'))
putchar ('s');
}

  • godsgodsgods...
  • gosdgosdgosd...
  • gosdosdosdosd...
  • Compilation error
Show Answer
12. Find the output
void main ( )
{
it num = 345, m,sum=0;
do
{
m=num%10;
num=num/10;
continue;
sum=sum*10+m;
}
while (num!=0);
printf ('%d", sum);
}

  • 345
  • 543
  • 0
  • None of these
Show Answer
13. Find the output
void main ( )
{
int i,j;
for (i=0, j=0; i<3, j<2: i++; j++)
printf ("ok");
}

  • ok
  • okok
  • Compilation error
  • None of these
Show Answer
14. In which of the following loop/loops, he precise number of times the loop will be executed is known in advance.
  • for loop
  • while loop
  • do-while loop
  • Both b and c
Show Answer
15. Which of the following is an exit controlled loop?

  • while
  • do while
  • for
  • continue
Show Answer
16. Which of the following is an inifinite loop ?
I. while (1) { }
II. while (-1){ }
III. while (!0)) { }
IV. while ('a') { }

  • only I
  • I & III
  • I & III
  • All of the above
Show Answer
17. Which of the following is/are appropriate to give time delay usingg loop?
I. for (i=1; i<100; i++) {;}
II. i=1; while (i++<=100) { }
III. i=1; do { } while (i++<=100);

  • Only I
  • II & III
  • I & III
  • All of the above
Show Answer
18. 'repeat-until' construct of PASCAL language is same as
  • while construct
  • for construct
  • do-while construct
  • Both while and do-while construct
Show Answer
19. Find the output
void main ( )
{
int i, t=1, s=1;
for (i=2; i<=5; i++)
{
t+=i;
s+=t;
}
pritf ("%d %d", t,s,);
}

  • 10 45
  • 15 35
  • 10 20
  • None of these
Show Answer
20. Find the output
void main ( )
{
int i=65, j=0;
for (j;j<4; j++)
{
i+1;
printf("%d", i++);
}
}

  • B C D E
  • A B C D
  • 66 67 68 69
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test