wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Programming

Total questions: 20

Worksheet time: 40mins

Name
Class
Date
1.

Choose a right C Statement.

a)

Loops or Repetition block executes a group of statements repeatedly.

b)

Loop is usually executed as long as a condition is met.

c)

Loops usually take advantage of Loop Counter

d)

All the above.

2.

What is the output of C Program.?

int main()

{

int a=5;

while(a >= 3);

{

printf("RABBIT\n");

break;

}

printf("GREEN");

return 0;

}

a)

GREEN

b)

RABBIT GREEN

c)

RABBIT is printed infinite times

d)

None of the above

3.

What is the output of C Program.?

int main()

{

int a=25;

while(a <= 27)

{

printf("%d ", a);

a++;

}

return 0;

}

a)

25 25 25

b)

25 26 27

c)

27 27 27

d)

Compiler error

4.

What is the output of C Program.?

int main()

{

int a=32;

do

{

printf("%d ", a);

a++;

}

while(a <= 30);

return 0;

}

a)

32

b)

33

c)

30

d)

No Output

5.

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;

}

a)

No Output

b)

32 33 34

c)

32 33 34 35

d)

Compiler error

6.

Choose a correct C Statement.

a)

a++ is (a=a+1) POST INCREMENT Operator

b)

a-- is (a=a-1) POST DECREMENT Operator

--a is (a=a-1) PRE DECREMENT Operator

c)

++a is (a=a+1) PRE INCREMENT Operator

d)

All the above.

7.

Choose correct Syntax for C Arithmetic Compound Assignment Operators.

a)

a+=b is (a= a+ b)

a-=b is (a= a-b)

b)

a*=b is (a=a*b)

a/=b is (a = a/b)

c)

a%=b is (a=a%b)

d)

All the above.

8.

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;

}

a)

compiler error

b)

10 10 10 10 10

c)

10 11 12 13 14 15

d)

None of the above

9.

What is the output of C Program.?

int main()

{

int k;

for(k=1; k <= 5; k++);

{

printf("%d ", k);

}

return 0;

}

a)

1 2 3 4 5

b)

1 2 3 4

c)

6

d)

5

10.

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

d)

None of the above

11.

What is the output of C Program.?

int main()

{

int k;

for(printf("FLOWER "); printf("YELLOW "); printf("FRUITS "))

{

break;

} return 0;

}

a)

Compiler error

b)

FLOWER FRUITS

c)

FLOWER YELLOW

d)

FLOWER YELLOW FRUITS

12.

Loops in C Language are implemented using.?

a)

While Block

b)

For Block

c)

Do While Block

d)

All the above

13.

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

14.

Which loop is faster in C Language, for, while or Do While.?

a)

for

b)

while

c)

do while

d)

all of the above

15.

Choose correct C while loop syntax.

a)

while(condition) { //statements }

b)

{ //statements }while(condition)

c)

while(condition); { //statements }

d)

while() { if(condition) { //statements } }

16.

Choose a correct C for loop syntax.

a)

for(initalization; condition; incrementoperation) { //statements }

b)

for(declaration; condition; incrementoperation) { //statements }

c)

for(declaration; incrementoperation; condition) { //statements }

d)

for(initalization; condition; incrementoperation;) { //statements }

17.

Choose a correct C do while syntax.

a)

dowhile(condition) { //statements }

b)

do while(condition) { //statements }

c)

do { //statements }while(condition)

d)

do { //statements }while(condition);

18.

What is the output of C Program.?

int main()

{

while(true)

{

printf("RABBIT");

break;

}

return 0;

}

a)

RABBIT

b)

RABBIT is printed unlimited number of times.

c)

No output

d)

Compiler error.

19.

What is the output of C Program.?

int main()

{

int a=5;

while(a==5)

{

printf("RABBIT");

break;

}

return 0;

}

a)

RABBIT is printed unlimited number of times

b)

RABBIT

c)

Compiler error

d)

None of the above.

20.

What is the output of C Program.?

int main()

{

int a=5;

while(a=123)

{

printf("RABBIT\n");

break;

}

printf("GREEN");

return 0;

}

a)

GREEN

b)

RABBIT GREEN

c)

RABBIT is printed unlimited number of times.

d)

Compiler error.