wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 3 C Pro P1

Total questions: 8

Worksheet time: 3mins

Name
Class
Date
1.

What is the example of relation operator

a)

<

b)

=

c)

!=

d)

>=

2.

What is the example of boolean operator

a)

&

b)

x

c)

/

d)

~

3.

in Selection Structure, the right way to write the statement is

a)

if (condition)

{action statement}

b)

if (action statement)

{condition}

c)

if (condition) ;

{action statement}

d)

if (condition)

4.

What is the output for the following statement, when score value is 99?

if (score == 100)

{

printf(“Congratulations!”);

}

a)

Congratulations!

b)

tahniah

c)

no answer

d)

ok

5.

the right way to write the statement for this flow chart is

a)

if (condition){statement2}

else {statement1}

b)

if (action statement1)

{condition}

c)

if (condition){statement1}

else {statement2}

d)

if (condition)

6.

What is the output for the following statement, when score value is 40?

if(score>=50)

{printf(“you pass”);}

else{

printf(“you fail”);

}

a)

you pass

b)

you fail

c)

no answer

d)

ok

7.

What is the output for the following statement, when number1 is 9 and number2 is 40?

#include<stdio.h>

int main(){

int number1,number2;

printf("Type in two number!\n");

scanf("%d %d",&number1,&number2);

if(number1>=10 number2>=10)

{ printf("Both Number is greater than 10\n");

}

else

printf("One or both of you number is less than 10!\n");

return 0;

}

a)

Both Number is greater than 10

b)

Both Number is greater than 100

c)

One or both of you number is less than 10

d)

One or both of you number is less than 100

8.

What is the output for the following statement, when user type number1=2 and number2=20?

a)

Both number is greater than 10

b)

one or both of your number is less than 10

c)

both of your number is less than 10

d)

both of your number is equal to 10