C Language MCQ’S | Loops 2

Question: 6.

What is output of below program?

int main()
{
int i,j;
for(i = 0,j=0;i<5;i++)
{
printf(“%d%d–“,i,j);
}
return 0;
}

A. 0–01–12–23–34–
B. 00–10–20–30–40–
C. Compilation Error
D. 00–01–02–03–04–

 

Question: 7.

What is output of below program?

int main()
{
int i,j,k,count;
count=0;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
count++;
}
}
printf(“%d”,count);
return 0;
}

A. 5
B. 10
C. 25
D. 50

 

Question: 8

What is output of below program?

int main()
{
int i;
for(i=0; i<5; i++);
{
printf(“Hello”);
}

return 0;
}

A. Hello is printed 5 times
B. Compilation Error
C. Hello is printed 1 times
D. Nothing is printed

 

Question: 9

What is output of below program?

int main()
{
int i,j,count;
count=0;
for(i=0; i<5; i++);
{
for(j=0;j<5;j++);
{
count++;
}
}
printf(“%d”,count);
return 0;
}

A. 55
B. 54
C. 1
D. 0

 

Question: 10

How many times Hello is printed?

int main()
{
while(1)
{
printf(“Hello”);
}

return 0;
}
A. 1 time
B. Compilation Error
C. Infinite times
D. Runtime Error

 

Visitor Counter

0051027