LOOPING STATEMENT New
LOOPING STATEMENT New
ANSWER:D
ANSWER:A
ANSWER:A
A)do while
B)while
C)for loop
ANSWER:B
Which of following is exit control loop?
A)do while
B)while
C)for loop
ANSWER:A
int main()
int i = 1 ;
while( i<=2)
printf("%d",i);
return 0;
A)12
B)i
C)Compillation error
D)Infinite loop
ANSWER:D
When _________ is encountered inside any loop, Control automatically passes to the first
statement after loop.
A) Continue
B) break
C) goto
D) return
ANSWER:B
#include <stdio.h>
int main()
short i;
printf("%d\n", i);
ANSWER:C
What will be the output of the following C code?
#include <stdio.h>
void main()
int k = 0;
for (k)
printf("Hello");
ANSWER:C
#include <stdio.h>
void main()
double k = 0;
printf("Hello");
ANSWER:B
++ operator used within Loops increment the value of variable by
A)0
B1
C)Run time error
ANSWER:B
#include <stdio.h>
int main()
int i = 0;
do {
i++;
ANSWER:A
What will be the output of the following C code?
#include <stdio.h>
void main() {
int i = 0;
while (++i)
{ printf("H");
} }
A) H
B) H is printed infinite times
C) Compile time error
D) Varies
ANSWER: B
A) while(condition) { //statements }
B) { //statements } while(condition)
C) while(condition); { //statements }
ANSWER:A
int main()
{ int a=25;
a++; }
return 0;}
A) 25 25 25
B) 25 26 27
C) 27 27 27
D) Compiler error
ANSWER:B
int main()
{ int a=32;
do
a++;
return 0;
A) 32
B) 33
C) 30
D) No Output
ANSWER:A
What is the output of C Program.?
int main()
{ int k, j;
} return 0;
A) compiler error
B) 10 10 10 10 10
C) 11 12 13 14 15
ANSWER:C
int main()
{ int k;
return 0;
A) 1 2 3 4 5
B) 1 2 3 4
C) 6
D) 5
ANSWER:C
What is the output of C Program.?
int main()
{ int k;
for(;;)
printf("TESTING\n");
break;
} return 0;
A) No Output
B) TESTING
C) Compiler error
ANSWER:B
What is the way to suddenly come out of or Quit any Loop in C Language.?
A) continue; statement
B) break; statement
C) leave; statement
D) quit; statement
ANSWER:B
What is the output of C Program.?
int main()
{ int a=10, b, c;
b=a++;
c=++a;
return 0;
A) 10 11 12
B) 12 10 12
C) 12 11 12
D) 12 12 12
ANSWER:B
int main()
while(++a < 4)
while(b++ < 4)
return 0;
}
A) 0 1 2 3 1 2 3 4
B) 1 2 3 1 2 3 4
C) 1 2 3 4 1 2 3 4
D) 1 2 3 4 0 1 2 3
ANSWER:B
int main()
{ int a=10,b=20;
{ printf("Hurray..");
} if(a==10 OR b==21)
{ printf("Theatre");
} return 0;}
A) Theatre
B) Hurray Theatre
C) No output
D) Compiler error
ANSWER:D
B) break; statement can be used with loops like for, while and do while.
C) break; statement causes only the same or inner loop where break; is present to quit suddenly.
ANSWER:D
Choose a correct C Statement regarding for loop.
for(; ;);
C) Compiler error
ANSWER:B