C-Loop Question and Answer

C-Loop Question and Answer
51. Find the output
void main ( )
{
int i;
switch (i)
{
case 1; printf ('%d", i++);
case 2: printf ('%d", i++);
case 3: printf('5d", i++);
default ; printf ('bye");
}
}
}

  • 123456789
  • 123123123
  • 123123123bye
  • 123bye
Show Answer
52. Find the output
void main ( )
{
int x=3;
while (x--){
int x=10;
x--;
printc('5d", x);
}
}

  • 999999
  • 999
  • 2 1 0
  • 3 2 1
Show Answer
53. Find the bug in the followig program
1. void main ( ) {
2. while (1) {
3. if (printf('5d', printf("%d', 5)))
4. printf("%d", 3);
5. brak;
6. }
7. }


  • Line no. 3
  • Line no. 4
  • Line no. 5
  • None of these
Show Answer
54. Find the output
void main ( )
{
unsigned int i;
for (i=5; i>-1; i--)
printf("cite");
}

  • It will print 'cite' six times
  • It will print 'cite' infinite times
  • No output
  • Compilation error
Show Answer
55. Find the output
#define MAX 10
void main ( )
{
int i;
for (i=0; i<MAX; i++)
{
static int count;
count+=count;
}
printf('5d", count);
}

  • 0
  • 45
  • 55
  • Compilation error
Show Answer
56. Find the output
void main ( )
{
int x=2
while (++ (x--)==2)
printf("MCA");
printf("MBA");
}


  • MCAMCA.....
  • MCAMBA
  • MBA
  • Compilation error
Show Answer
57. Find the output
void main ( )
{
int i;
for (i=1; i<=3; i++)
{
print: printf("C");
printf("%d", i);
}
}

  • Error; tag not allowed withing the loop
  • 1 2 3
  • C 1 C 2 C 3
  • Garbage value
Show Answer
58. Find the output
void main ( )
{
unsigned char c='0';
while (++c<=255)
printf ("%d", c);
}

  • Prints 48 to 255
  • Prints 1 to 255
  • Infinite loop
  • None of these
Show Answer
59. Find the output
void main ( )
char c1;
int i=0;
c1='a';
while (c>=='a' && c1<='z')
{
c1++;
i++;
}
printf ('%d", i);
}

  • 25
  • 26
  • 123
  • None of these
Show Answer
60. Find the output
enum (false, true);
void main ( )
{
int i=1;
do
{
printf ("%d", i);
i++;
if (i<5)
continue;
}
while (false);
}

  • 123...15
  • 1
  • Compilation error
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test