wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

grade 9 week 4

Total questions: 104

Worksheet time: 52mins

Name
Class
Date
1.

What is an operator in programming?

a)

A device to run programs

b)

A tool to solve math

c)

A symbol to perform an operation

d)

A name for functions

2.

Which of the following is an arithmetic operator?

a)

==

b)

and

c)

+

d)

!=

3.

What does the operator == mean?

a)

Assignment

b)

Equal to

c)

Not equal

d)

Addition

4.

Which operator is used to assign a value to a variable?

a)

==

b)

=

c)

:=

d)

+=

5.

What is the main purpose of logical operators?

a)

To create variables

b)

To perform math

c)

To combine conditions

d)

To call functions

6.

Which of these is a comparison operator?

a)

+

b)

or

c)

!=

d)

**

7.

What does the operator != represent?

a)

Less than

b)

Not equal

c)

Assignment

d)

Greater than

8.

What does the operator and do?

a)

Returns True if both conditions are true

b)

Returns False always

c)

Adds numbers

d)

Compares strings

9.

What does the operator or do?

a)

Returns True only if both conditions are false

b)

Returns True if at least one condition is true

c)

Compares numbers

d)

Always returns False

10.

What does not do in Boolean logic?

a)

Repeats a loop

b)

Makes a value zero

c)

Reverses the truth value

d)

Multiplies a value

11.

What is the result of 5 + 3?

a)

7

b)

8

c)

9

d)

6

12.

What is the result of 10 - 6?

a)

5

b)

6

c)

4

d)

3

13.

What is the result of 4 * 2?

a)

8

b)

6

c)

4

d)

2

14.

What is the result of 12 / 4?

a)

3

b)

2

c)

4

d)

5

15.

What does 10 % 3 return?

a)

1

b)

2

c)

3

d)

0

16.

What does 2 ** 3 return?

a)

6

b)

8

c)

9

d)

5

17.

Which operator gives only the whole number result of a division?

a)

/

b)

//

c)

%

d)

*

18.

What is the output of 7 // 2?

a)

3.5

b)

3

c)

2

d)

4

19.

What does the * operator do?

a)

Division

b)

Addition

c)

Multiplication

d)

Comparison

20.

What is the result of 9 % 2?

a)

0

b)

2

c)

1

d)

3

21.

What does 5 == 5 return?

a)

False

b)

True

c)

Error

d)

0

22.

What is the output of 7 != 3?

a)

False

b)

True

c)

0

d)

None

23.

What does 6 > 2 return?

a)

True

b)

False

c)

Error

d)

None

24.

What does 3 < 1 return?

a)

True

b)

False

c)

1

d)

0

25.

What is the result of 4 >= 4?

a)

True

b)

False

c)

None

d)

0

26.

What is the result of 2 <= 1?

a)

True

b)

False

c)

Error

d)

1

27.

Which operator is used for 'greater than'?

a)

>

b)

<

c)

>=

d)

==

28.

What does == compare?

a)

Data type

b)

Object type

c)

Values

d)

Memory address

29.

Which operator checks 'less than or equal to'?

a)

<=

b)

<

c)

==

d)

>=

30.

What does 5 != 5 return?

a)

True

b)

False

c)

5

d)

None

31.

What does x = 10 mean?

a)

x is added 10

b)

x becomes 10

c)

x is deleted

d)

10 becomes x

32.

What does x += 2 mean?

a)

x = x + 2

b)

x = x - 2

c)

x = 2

d)

x * 2

33.

What does x -= 1 mean?

a)

x = x - 1

b)

x = x + 1

c)

x = 1

d)

x = x / 1

34.

What does x *= 3 mean?

a)

x = x * 3

b)

x = x + 3

c)

x = 3

d)

x = x - 3

35.

What does x /= 2 do?

a)

x = x / 2

b)

x = 2 / x

c)

x = x * 2

d)

x = 2

36.

Which operator is used for assigning values?

a)

==

b)

=

c)

:=

d)

=>

37.

What happens with x = x + 1?

a)

x increases by 1

b)

x becomes 0

c)

x is divided

d)

x stays the same

38.

What is another way to write x = x + 1?

a)

x++

b)

x += 1

c)

x =+ 1

d)

+x = 1

39.

What is x = x * 2 used for?

a)

Doubling x

b)

Halving x

c)

Squaring x

d)

Making x zero

40.

What does x = x - 5 do?

a)

Adds 5

b)

Subtracts 5

c)

Multiplies by 5

d)

Divides

41.

What is x = x * 2 used for?

a)

Doubling x

b)

Halving x

c)

Squaring x

d)

Making x zero

42.

What does x = x - 5 do?

a)

Adds 5

b)

Subtracts 5

c)

Multiplies by 5

d)

Divides by 5

43.

What is the result of True and True?

a)

True

b)

False

c)

None

d)

1

44.

What is the result of True and False?

a)

False

b)

True

c)

None

d)

Error

45.

What is the result of True or False?

a)

True

b)

False

c)

None

d)

Error

46.

What is the result of False or False?

a)

True

b)

False

c)

Error

d)

None

47.

What is not True?

a)

False

b)

True

c)

None

d)

0

48.

What is not False?

a)

False

b)

True

c)

Error

d)

None

49.

Which condition returns False?

a)

True and True

b)

True or False

c)

False and True

d)

not False

50.

Which condition returns True?

a)

not True

b)

False and False

c)

True or False

d)

False or False

51.

Which of the following uses both logical and comparison operators?

a)

3 + 2

b)

x = 5

c)

5 > 3 and 4 < 6

d)

4 % 2

52.

Why are logical operators useful?

a)

To make decisions

b)

To add numbers

c)

To print messages

d)

To create strings

53.

What is conditional logic in programming?

a)

Repeating a task

b)

Making decisions

c)

Drawing shapes

d)

Creating variables

54.

Which keyword is used to start a condition in Python?

a)

when

b)

condition

c)

if

d)

loop

55.

What happens when the condition in an if statement is False?

a)

Code runs anyway

b)

Code is skipped

c)

It gives an error

d)

The program stops

56.

What keyword is used when the condition is not true?

a)

otherwise

b)

else

c)

skip

d)

next

57.

What does elif mean in Python?

a)

End if

b)

Else if

c)

Extra loop

d)

Entry level

58.

Which of these is a correct comparison operator?

a)

=

b)

!=

c)

:=

d)

then

59.

What does x == 5 check?

a)

If x becomes 5

b)

If x is equal to 5

c)

If x is more than 5

d)

If x is assigned 5

60.

What is the output of if 10 > 5:?

a)

Error

b)

Nothing

c)

The code inside runs

d)

Program crashes

61.

What is the result of if False:?

a)

Runs

b)

Skips

c)

Loops

d)

Crashes

62.

Conditional logic is used to...

a)

Build graphics

b)

Make decisions

c)

Store data

d)

Repeat code

63.

What does != mean?

a)

Equal

b)

Not equal

c)

Assignment

d)

Less than

64.

What is the result of 4 < 7?

a)

True

b)

False

c)

None

d)

Error

65.

What is the result of 10 >= 10?

a)

False

b)

True

c)

Error

d)

Maybe

66.

Which of the following is a valid condition?

a)

if 5 > 3

b)

if 5 = 3

c)

if = 3

d)

if True =

67.

What does if age > 18: do?

a)

Checks if age is under 18

b)

Checks if age is exactly 18

c)

Checks if age is more than 18

d)

Assigns 18 to age

68.

What does <= mean?

a)

Equal

b)

Not equal

c)

Greater than

d)

Less than or equal to

69.

What is the result of 8 == 8?

a)

False

b)

True

c)

Error

d)

0

70.

If score = 90, what does score > 100 return?

a)

True

b)

False

c)

Error

d)

90

71.

What is the use of comparison operators?

a)

Assign values

b)

Compare values

c)

Add numbers

d)

Multiply data

72.

if x < 10: means?

a)

Run if x is more than 10

b)

Run if x is less than 10

c)

Always run

d)

Never run

73.

Which block runs if the condition is False?

a)

if

b)

else

c)

loop

d)

def

74.

What is the correct format?

a)

if x > 5 then:

b)

if x > 5:

c)

if > x 5:

d)

if (x > 5)

75.

What does this print? python SalinEdit x = 7 if x < 10: print("Yes")

a)

No

b)

Yes

c)

Nothing

d)

Erro

76.

What is the correct format?

a)

if x > 5 then:

b)

if x > 5:

c)

if > x 5:

d)

if (x > 5)

77.

What does this print? x = 7 if x < 10: print("Yes")

a)

No

b)

Yes

c)

Nothing

d)

Error

78.

What does this code do? if x == 5: print("Five") else: print("Not five")

a)

Prints always

b)

Makes error

c)

Prints based on condition

d)

Skips both

79.

Can we use multiple elif?

a)

No

b)

Only once

c)

Yes

d)

Only after else

80.

Which is the correct order?

a)

elif → if → else

b)

if → else → elif

c)

if → elif → else

d)

else → if → elif

81.

What happens if all conditions are False?

a)

All run

b)

Only if runs

c)

Only elif runs

d)

Only else runs

82.

if x != y: means?

a)

x is equal to y

b)

x is not equal to y

c)

x becomes y

d)

x minus y

83.

Which of the following is valid?

a)

if (x = 5)

b)

if x == 5

c)

if x => 5

d)

if == x 5

84.

What happens in this code? if True: print("Hello")

a)

Skips print

b)

Prints Hello

c)

Errors

d)

Prints False

85.

What does and mean?

a)

Both conditions must be True

b)

One must be False

c)

None should be True

d)

Always False

86.

What does or mean?

a)

Both must be False

b)

Only one must be True

c)

All must be True

d)

Neither condition matters

87.

What does not do?

a)

Add 1

b)

Make it True

c)

Reverse the result

d)

Multiply

88.

What is not True?

a)

True

b)

False

c)

Error

d)

None

89.

Which condition is True?

a)

False and False

b)

True or False

c)

False or False

d)

False and True

90.

What does this code return? if True and False: print("Yes")

a)

Yes

b)

Nothing

c)

Error

d)

False

91.

What is not (4 > 2)?

a)

True

b)

False

c)

Error

d)

None

92.

Which operator combines two True conditions?

a)

or

b)

not

c)

and

d)

=

93.

Which of the following will return True?

a)

5 > 10 and 2 < 3

b)

4 == 4 or 3 > 5

c)

10 < 5

d)

not True

94.

Which operator means "at least one is true"?

a)

and

b)

or

c)

not

d)

all

95.

What does this mean? "You can play if it's Saturday or your homework is done"

a)

Both must be true

b)

Only Saturday is enough

c)

Neither needed

d)

Homework is not important

96.

What does this logic check? if temperature > 30:

a)

It's cold

b)

It's hot

c)

It's night

d)

It's zero

97.

Why is if important in programs?

a)

To draw

b)

To decide

c)

To loop

d)

To define

98.

Can we nest if statements?

a)

No

b)

Yes

c)

Only in loops

d)

Only with numbers

99.

What is this code? if rain and umbrella: print("Go out")

a)

Wrong

b)

Condition with and

c)

Invalid

d)

Nothing

100.

What does if age >= 17: check?

a)

If age is less

b)

If age is more or equal

c)

If age is 17

d)

If age is not 17

101.

What does if not raining: mean?

a)

It is raining

b)

It is not raining

c)

It's sunny

d)

It's winter

102.

What's the output? x = 3 if x < 5: print("Small")

a)

Small

b)

Big

c)

Error

d)

None

103.

What is the use of indentation after if?

a)

Looks nice

b)

To show block of code

c)

For styling

d)

Not required

104.

When will this print "Allowed"? if age >= 18: print("Allowed")

a)

When age is 18 or more

b)

When age is less than 18

c)

Always

d)

Never