wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Conditional Statements

Total questions: 22

Worksheet time: 35mins

Name
Class
Date
1.

What is the greater than symbol?

a)

<

b)

<=

c)

>

d)

>=

2.

Which comparison operator is used to check if two variables have the same value?

a)

==

b)

<

c)

>

d)

<=

3.

Which comparison operator is used to check if a variable is less than a specific number?

a)
<
b)
==
c)
>=
d)
>
4.

Logical Operator And : One side or other must be true

a)

True

b)

False

5.

This is the simplest conditional statement which instructs the computer to perform a certain action if the condition is true.

a)

If Statement

b)

If Else Statement

c)

If ElseIf Statement

6.

This conditional statement will perform a certain action if the condition is met. And when the condition is false, an alternative action will be executed.

a)

If Statement

b)

If Else Statement

c)

If ElseIf Statement

7.

If there are more than two alternative choices, using just If…Then…Else statement will not be enough.

In order to provide more choices, we can use:

a)

If Then Statement

b)

If Then Else Statement

c)

If Then ElseIf Statement

8.

Which comparison operator evaluates to True if both sides have the exact same value and False otherwise

a)

!=

b)

=

c)

==

d)

<=

9.

Which comparison operator evaluates to True if both sides have a different value and False otherwise

a)

!=

b)

=

c)

==

d)

<=

10.

Which comparison operator evaluates to True if the left side is less than the right side and False otherwise

a)

>

b)

<

c)

>=

d)

<=

11.

Which comparison operator evaluates to True if the left side is greater than the right side and False otherwise

a)

>

b)

<

c)

>=

d)

<=

12.

Which comparison operator evaluates to True if the left side is greater than or equal to the right side and False otherwise

a)

>

b)

<

c)

>=

d)

<=

13.

Which comparison operator evaluates to True if the left side is less than or equal to the right side and False otherwise

a)

>

b)

<

c)

>=

d)

<=

14.

height = 1.8


Suppose that "height" is defined as above. Which of the following would evaluate to True? Select all that apply.

a)

height > 0

b)

height < 0

c)

height >= 0

d)

height != 0

15.

lives = 0


Suppose that "lives" is defined as above. Which of the following would evaluate to True? Select all that apply.

a)

lives > 0

b)

lives < 0

c)

lives >= 0

d)

lives <= 0

16.

age = 32


Suppose that "age" is defined as above. Which of the following would evaluate to True? Select all that apply.

a)

age == 32

b)

age != 32

c)

age > 65

d)

age < 65

17.

Which of the following will print "YES" if (and only if) "age" is positive?

a)

b)

c)

d)

18.

What will be printed if the value of "num" is 3?

a)

ABC

b)

XYZ

c)

ABC

XYZ

d)

*** ERROR ***

19.

What will be printed if the value of "num" is 0?

a)

ABC

b)

XYZ

c)

ABC

XYZ

d)

*** ERROR ***

20.

What will be printed if the value of "num" is -3?

a)

ABC

b)

XYZ

c)

*** NOTHING ***

d)

*** ERROR ***

21.

What will be printed if the value of "num" is 0?

a)

ABC

b)

XYZ

c)

ABC

XYZ

d)

*** ERROR ***

22.

What will be printed if the value of "num" is -5?

a)

ABC

b)

XYZ

c)

ABC

XYZ

d)

*** ERROR ***