wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz - I

Total questions: 25

Worksheet time: 18mins

Name
Class
Date
1.

The minimum number of temporary variables needed to swap the contents of two variables is

a)

0

b)

1

c)

2

d)

3

2.

int main ()


{


int x = 24, y = 39, z = 45;


z = x + y;


y = z - y;


x = z - y;


printf ("n%d %d %d", x, y, z);


}

a)

24 39 63

b)

39 24 63

c)

24 39 45

d)

39 24 45

3.

int main() {


int m = -10, n = 20;


n = (m < 0) ? 0 : 1;


printf("%d %d", m, n);


}

a)

-10 0

b)

10 20

c)

20 -10

d)

0 1

4.

int main() {


int x = 0, y = 0;


if(x > 0)


if(y > 0)


printf("True");


else


printf("False");


}

a)

No Output

b)

True

c)

False

d)

Error because of dangling else problem

5.

#include<stdio.h>

int main()

{

int a=2,b=7,c=10;

c=a==b;

printf("%d",c);

}

a)

0

b)

7

c)

2

d)

Compilation error

6.

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

7.

What will happen when the following code is executed?

void main()

{

printf("MIET");

main();

}

a)

Wrong statement

b)

It will keep on printing MIET

c)

It will print MIET once

d)

None of these

8.

What will the result of 'num' variable after execution of the following statements?

int num = 58;

num % = 11;

a)

3

b)

5

c)

8

d)

11

9.

What will be the output of the following code?

#include <stdio.h>

int main()

{

int *ptr, a = 10;

ptr = &a;

*ptr += 1;

printf("%d,%d/n", *ptr, a);

}

a)

10, 10

b)

10, 11

c)

11, 10

d)

11, 11

10.

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

11.

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

12.

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

13.

Loops in C Language are implemented using.?

a)

While Block

b)

For Block

c)

Do While Block

d)

All the above

14.

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

15.

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

a)

for

b)

while

c)

do while

d)

all of the above

16.

Choose correct C while loop syntax.

a)

while(condition) { //statements }

b)

{ //statements }while(condition)

c)

while(condition); { //statements }

d)

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

17.

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 }

18.

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);

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.

21.

C can be used on................

a)

Only MS-DOS operating system

b)

Only Linux operating system

c)

Only Windows operating system

d)

All the above

22.

C programs are converted into machine language with the

help of.....................

a)

An Editor

b)

A compiler

c)

An operating system

d)

None of the above

23.

A character variable can at a time store?

a)

1 character

b)

8 characters

c)

254 characters

d)

None of the above

24.

A C variable cannot start with............

a)

An alphabet

b)

A number

c)

A special symbol other than underscore

d)

Both (2) & (3) above

25.

Which of the following statement is wrong?

a)

mes = 123.56 ;

b)

con = 'T' * 'A' ;

c)

this = 'T' * 20 ;

d)

3 + a = b ;