NEW
Font size
WorksheetsC Programming
Total questions: 20
Worksheet time: 40mins
Choose a right C Statement.
Loops or Repetition block executes a group of statements repeatedly.
Loop is usually executed as long as a condition is met.
Loops usually take advantage of Loop Counter
All the above.
What is the output of C Program.?
int main()
{
int a=5;
while(a >= 3);
{
printf("RABBIT\n");
break;
}
printf("GREEN");
return 0;
}
GREEN
RABBIT GREEN
RABBIT is printed infinite times
None of the above
What is the output of C Program.?
int main()
{
int a=25;
while(a <= 27)
{
printf("%d ", a);
a++;
}
return 0;
}
25 25 25
25 26 27
27 27 27
Compiler error
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
}
while(a <= 30);
return 0;
}
32
33
30
No Output
What is the output of C Program.?
int main()
{
int a=32;
do
{
printf("%d ", a);
a++;
if(a > 35)
break;
}
while(1);
return 0;
}
No Output
32 33 34
32 33 34 35
Compiler error
Choose a correct C Statement.
a++ is (a=a+1) POST INCREMENT Operator
a-- is (a=a-1) POST DECREMENT Operator
--a is (a=a-1) PRE DECREMENT Operator
++a is (a=a+1) PRE INCREMENT Operator
All the above.
Choose correct Syntax for C Arithmetic Compound Assignment Operators.
a+=b is (a= a+ b)
a-=b is (a= a-b)
a*=b is (a=a*b)
a/=b is (a = a/b)
a%=b is (a=a%b)
All the above.
What is the output of C Program.?
int main()
{
int k, j;
for(k=1, j=10; k <= 5; k++)
{
printf("%d ", (k+j));
}
return 0;
}
compiler error
10 10 10 10 10
10 11 12 13 14 15
None of the above
What is the output of C Program.?
int main()
{
int k;
for(k=1; k <= 5; k++);
{
printf("%d ", k);
}
return 0;
}
1 2 3 4 5
1 2 3 4
6
5
What is the output of C Program.?
int main()
{
int k;
for(;;)
{
printf("TESTING\n");
break;
}
return 0;
}
No Output
TESTING
Compiler error
None of the above
What is the output of C Program.?
int main()
{
int k;
for(printf("FLOWER "); printf("YELLOW "); printf("FRUITS "))
{
break;
} return 0;
}
Compiler error
FLOWER FRUITS
FLOWER YELLOW
FLOWER YELLOW FRUITS
Loops in C Language are implemented using.?
While Block
For Block
Do While Block
All the above
What is the way to suddenly come out of or Quit any Loop in C Language.?
continue; statement
break; statement
leave; statement
quit; statement
Which loop is faster in C Language, for, while or Do While.?
for
while
do while
all of the above
Choose correct C while loop syntax.
while(condition) { //statements }
{ //statements }while(condition)
while(condition); { //statements }
while() { if(condition) { //statements } }
Choose a correct C for loop syntax.
for(initalization; condition; incrementoperation) { //statements }
for(declaration; condition; incrementoperation) { //statements }
for(declaration; incrementoperation; condition) { //statements }
for(initalization; condition; incrementoperation;) { //statements }
Choose a correct C do while syntax.
dowhile(condition) { //statements }
do while(condition) { //statements }
do { //statements }while(condition)
do { //statements }while(condition);
What is the output of C Program.?
int main()
{
while(true)
{
printf("RABBIT");
break;
}
return 0;
}
RABBIT
RABBIT is printed unlimited number of times.
No output
Compiler error.
What is the output of C Program.?
int main()
{
int a=5;
while(a==5)
{
printf("RABBIT");
break;
}
return 0;
}
RABBIT is printed unlimited number of times
RABBIT
Compiler error
None of the above.
What is the output of C Program.?
int main()
{
int a=5;
while(a=123)
{
printf("RABBIT\n");
break;
}
printf("GREEN");
return 0;
}
GREEN
RABBIT GREEN
RABBIT is printed unlimited number of times.
Compiler error.
