Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Control Statements

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the output of the C Program.?

int main()

{

if( 4 > 5 )

{

printf("Hurray..\n");

}

printf("Yes");


return 0;

}

a)

Yes

b)

Hurray..

Yes

c)

Hurray..Yes

d)

Compiler error

2.

The keyword ‘break’ cannot be simply used within

a)

do-while

b)

if-else

c)

for

d)

while

3.

Which keyword is used to come out of a loop only for that iteration?

a)

break

b)

continue

c)

return

d)

None of the mentioned

4.

goto can be used to jump from main to within a function?

a)

TRUE

b)

FALSE

c)

May Be

d)

Can't Say

5.

Switch statement accepts.

a)

int

b)

char

c)

long

d)

All of the above

6.

Which loop is guaranteed to execute at least one time.

a)

while

b)

do while

c)

for

d)

None of the above

7.

For loop in a C program, if the condition is missing?

a)

it is assumed to be present and taken to be false

b)

it is assumed to be present and taken to the true

c)

it result in a syntax error

d)

execution will be terminated abruptly

8.

What is the output of this program?

void main()

{

if(!printf(""))

printf("hello");

else

printf("world");

}

a)

hello

b)

world

c)

Compilation Error

d)

None of the above

9.

What is the output of this C code?

void main()

{

int i = 0;

if (i == 0)

{

printf("Hello");

break;

}

}

a)

Hello is printed infinite times

b)

Hello

c)

varies

d)

compile time error

10.

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.