wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Booleans and selections 1

Total questions: 65

Worksheet time: 33mins

Name
Class
Date
1.

Allows us to store, change and access this information as the program runs.

a)

Function

b)

Variable

c)

Loop

d)

Array

2.

This is the operation of joining character strings end-to-end.

a)

Splitting

b)

Concatenate

c)

Subtracting

d)

Multiplying

3.

The result of processing an input. The print function is an example.

a)

Input

b)

Output

c)

Process

d)

Function

4.

All functions are written in ??? case.

a)

Upper

b)

Lower

c)

Title

d)

Sentence

5.

This is a statement in computer programming that is used to set a value to a variable name. The operator used to do assignment is denoted with an equal sign (=).

a)

Declaration

b)

Assignment

c)

Comparison

d)

Initialization

6.

This is when you convert a variable value from one type to another. This is, in Python, done with functions such as int() or float() or str().

a)

Casting

b)

Looping

c)

Iterating

d)

Compiling

7.

Is a sequence of characters, such as letters, numbers, special characters.

a)

Integer

b)

Boolean

c)

String

d)

Float

8.

What is the smallest element of a programming language which expresses an action to be carried out?

a)

Selection

b)

Statement

c)

Logical Operators

d)

Boolean Expression

9.

Which term refers to comparisons that evaluate two data sets using AND, OR, NOT?

a)

Relational Operators

b)

Boolean Expression

c)

Logical Operators

d)

Selection

10.

What is a logical statement that is either TRUE or FALSE?

a)

Relational Operators

b)

Boolean Expression

c)

Statement

d)

Operators

11.

Which operators are used for evaluating two data sets using < (less than), > (greater than), == (equal to)?

a)

Logical Operators

b)

Selection

c)

Relational Operators

d)

Boolean Expression

12.

What are the constructs which can manipulate the value of operands?

a)

Statement

b)

Operators

c)

Logical Operators

d)

Selection

13.

What is a selection statement in a computer program?

a)

A loop that repeats a block of code

b)

A decision within a program based on an event's result

c)

A function that calculates a value

d)

A variable declaration

14.

Which of the following is a Boolean expression?

a)

5 + 3

b)

"Hello, World!"

c)

x > 10

d)

print("Python")

15.

What happens if the Boolean expression in an 'if' statement is True?

a)

The program stops

b)

The indented block of code is executed

c)

The program skips the block

d)

The program restarts

16.

What is the smallest element of a programming language that expresses an action?

a)

Loop

b)

Variable

c)

Statement

d)

Function

17.

What is a Boolean Expression?

a)

A statement that is either TRUE or FALSE.

b)

A statement that is always TRUE.

c)

A statement that is always FALSE.

d)

A statement that can be TRUE, FALSE, or NULL.

18.

What are Relational Operators used for?

a)

Evaluating two data sets using <, >, ==.

b)

Adding two numbers.

c)

Subtracting two numbers.

d)

Multiplying two numbers.

19.

Which of the following is a Logical Operator?

a)

AND

b)

PLUS

c)

MINUS

d)

DIVIDE

20.

In the expression "4 + 5 = 9", what is the " + " symbol called?

a)

Operand

b)

Result

c)

Operator

d)

Indicator

21.

Which operator is used to assign a value in Python?

a)

A. +=

b)

B. -=

c)

C. /=

d)

D. =

22.

What does the operator "+=" do in Python?

a)

A. Subtract then reassign

b)

B. Add then reassign

c)

C. Divide then reassign

d)

D. Mod then reassign

23.

Which operator is used for integer division and reassignment in Python?

a)

A. %=

b)

B. //=

c)

C. +=

d)

D. -=

24.

What is the function of the operator "-=" in Python?

a)

A. Divide then reassign

b)

B. Mod then reassign

c)

C. Subtract then reassign

d)

D. Assign

25.

Which operator is used for modulus and reassignment in Python?

a)

A. /=

b)

B. %=

c)

C. +=

d)

D. //=

26.

What are assignment operators used for in Python?

a)

To create new variables

b)

To assign values to variables

c)

To delete variables

d)

To print variables

27.

What is an example of a simple assignment in Python?

a)

X == 12

b)

X = 12

c)

X != 12

d)

X > 12

28.

Which operator is used to check if two values are equal in Python?

a)

<

b)

<=

c)

>

d)

==

29.

What does the operator '!=' represent in Python?

a)

Less than

b)

Greater than

c)

Equal to

d)

Not equal to

30.

Which operator would you use to check if a value is less than another value?

a)

<

b)

<=

c)

>

d)

>=

31.

If you want to check if a value is greater than or equal to another value, which operator should you use?

a)

<

b)

<=

c)

>

d)

>=

32.

What is the correct operator for checking if a value is less than or equal to another value?

a)

<

b)

<=

c)

>

d)

==

33.

What are expressions that contain relational operators known as?

a)

Arithmetic expressions

b)

Boolean expressions

c)

Logical expressions

d)

String expressions

34.

What will the expression return if it is correct?

a)

False

b)

Null

c)

True

d)

Undefined

35.

Which logical operator is used when both operands need to be true for the condition to be true?

a)

or Logical OR

b)

not Logical NOT

c)

and Logical AND

d)

xor Logical XOR

36.

What is the result of the expression (a or b) if either a or b is true?

a)

False

b)

True

c)

Undefined

d)

Zero

37.

Which logical operator is used to reverse the logical state of its operand?

a)

and Logical AND

b)

or Logical OR

c)

not Logical NOT

d)

xor Logical XOR

38.

Which logical operator corresponds to the truth table where the output is true only when both inputs are true?

a)

OR

b)

AND

c)

XOR

d)

NOT

39.

Which logical operator corresponds to the truth table where the output is true when at least one input is true?

a)

OR

b)

AND

c)

XOR

d)

NOT

40.

Which logical operator corresponds to the truth table where the output is true when exactly one input is true?

a)

OR

b)

AND

c)

XOR

d)

NOT

41.

Which logical operator corresponds to the truth table where the output is the opposite of the input?

a)

OR

b)

AND

c)

XOR

d)

NOT

42.

What is the result of the expression 3 == 3?

a)

True

b)

False

c)

None

d)

Undefined

43.

In the expression (not ("testing" == "testing" or "Python" == "Fun")), what is the result of "testing" == "testing"?

a)

True

b)

False

c)

None

d)

Undefined

44.

What does the 'not' operator do in a Boolean expression?

a)

It makes the expression True

b)

It inverts the Boolean value

c)

It adds two Boolean values

d)

It multiplies two Boolean values

45.

What is the final result of the expression 3 == 3 and (not ("testing" == "testing" or "Python" == "Fun"))?

a)

True

b)

False

c)

None

d)

Undefined

46.

What is the result of the expression "True and True"?

a)

True

b)

False

c)

Error

d)

None

47.

What is the result of the expression "False and True"?

a)

True

b)

False

c)

Error

d)

None

48.

What is the result of the expression "1 == 1 and 2 == 1"?

a)

True

b)

False

c)

Error

d)

None

49.

What is the result of the expression '"test" == "test"'?

a)

True

b)

False

c)

Error

d)

None

50.

What is the result of the expression "1 == 1 or 2 != 1"?

a)

True

b)

False

c)

Error

d)

None

51.

What is the result of the expression "True and 1 == 1"?

a)

True

b)

False

c)

Error

d)

None

52.

What is the result of the expression "False and 0 != 0"?

a)

True

b)

False

c)

Error

d)

None

53.

What is the result of the expression "True ^ (1 == 1)"?

a)

True

b)

False

c)

Error

d)

None

54.

What is the result of the expression '"test" == "testing"'?

a)

True

b)

False

c)

Error

d)

None

55.

What is the result of the expression "1 != 0 and 2 == 1"?

a)

True

b)

False

c)

Error

d)

None

56.

What is the result of the expression '"test" != "testing"'?

a)

True

b)

False

c)

Error

d)

None

57.

What is the result of the expression '"test" == 1'?

a)

True

b)

False

c)

Error

d)

None

58.

What is the result of the expression "not (True and False)"?

a)

True

b)

False

c)

Error

d)

None

59.

What is the result of the expression "not (1 == 1 and 0 != 1)"?

a)

True

b)

False

c)

Error

d)

None

60.

What is the result of the expression "not (10 == 1) ^ (1000 == 1000)"?

a)

True

b)

False

c)

Error

d)

None

61.

What is the result of the expression "not (1 != 10 or 3 == 4)"?

a)

True

b)

False

c)

Error

d)

None

62.

What is the result of the expression 'not ("testing" == "testing" and "Zed" == "Cool Guy")'?

a)

True

b)

False

c)

Error

d)

None

63.

What is the result of the expression "1 == 1 and (not ("testing" == 1 or 1 == 0))"?

a)

True

b)

False

c)

Error

d)

None

64.

What is the result of the expression '"chunky" == "bacon" and (not (3 == 4 or 3 == 3))'?

a)

True

b)

False

c)

Error

d)

None

65.

What is the result of the expression '3 == 3 and (not ("testing" == "testing" or "Python" == "Fun"))'?

a)

True

b)

False

c)

Error

d)

None