Loop Questions and Answers
Practice ModeShowing 10 of 98 questions
Q1
Which of the following is true about "for" loop?
Answer: Option D
Q2
Find the output
void main ( )
{
int x=10, y;
for (y=10; y!=x;++y)
printf ("%d", y);
printf("%d", y);
}
Answer: Option B
Q3
If a loop loses its start value that loop is called as
Answer: Option A
Q4
Find the output
void main ( )
{
int i=1;
do {
printf("%d", i);
i++;
}
while (!i==5);
}
Answer: Option C
Q5
Find the output
void main ( )
{
int i;
for (i=0; i<3; i++);
printf("%d", i*i);
printf ("strange");
}
Answer: Option A
Q6
Find the output
void main ( )
{
int i;
for (i=0; i<3; i++);
printf("%d", i*i);
printf ("strange");
}
Answer: Option A
Q7
Find the output
void main ( )
{
int i, j=1;
for (i=1; i<5; i++)
while (j<5)
{
printf ("%d', i+j);
if(i==2&& j==2)
break;
j++;
}
}
Answer: Option B
Q8
Find the output
void main ( )
{
int i=1;
while (!i=5)
{
printf ("%d", i);
i++;
}
}
Answer: Option D
Q9
Find the output
void main ( )
{
for (putchar ('g'), i); putchar ('o'putchar ('d'))
putchar ('s');
}
Answer: Option C
Q10
Find the output
void main ( )
{
char m[ ]={"hello world"}'
int n;
for (c=sizeof(m); m; putch(m)[-n]));
}
Answer: Option D