Loop Questions and Answers
Practice ModeShowing 10 of 98 questions
Q11
Find the output
void main ( )
{
for putchar ('g'); putchar ('o');
putchar ('d'))
putchar ('s');
}
Answer: Option C
Q12
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);
}
Answer: Option C
Q13
Find the output
void main ( )
{
int i,j;
for (i=0, j=0; i<3, j<2: i++; j++)
printf ("ok");
}
Answer: Option B
Q14
In which of the following loop/loops, he precise number of times the loop will be executed is known in advance.
Answer: Option A
Q15
Which of the following is an exit controlled loop?
Answer: Option A
Q16
Which of the following is an inifinite loop ?
I. while (1) { }
II. while (-1){ }
III. while (!0)) { }
IV. while ('a') { }
Answer: Option D
Q17
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);
Answer: Option D
Q18
'repeat-until' construct of PASCAL language is same as
Answer: Option C
Q19
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,);
}
Answer: Option B
Q20
Find the output
void main ( )
{
int i=65, j=0;
for (j;j<4; j++)
{
i+1;
printf("%d", i++);
}
}
Answer: Option B