MCQs on Operators in Python | Python programming

1. Arithmetic Operators

  1. What is the result of the expression 10 / 3 in Python 3.x?
    • a) 3
    • b) 3.0
    • c) 3.3333333333
    • d) 3.5
  2. Which of the following is the correct operator to find the remainder of a division?
    • a) //
    • b) %
    • c) ^
    • d) &
  3. What is the result of 5 * 6 + 3 in Python?
    • a) 33
    • b) 33.0
    • c) 15
    • d) 18
  4. Which arithmetic operator is used for exponentiation in Python?
    • a) ^
    • b) **
    • c) %
    • d) //
  5. What does the expression 10 // 3 return in Python?
    • a) 3
    • b) 3.0
    • c) 3.333
    • d) 0

2. Comparison Operators

  1. Which of the following compares two variables to check if they are equal?
    • a) ==
    • b) !=
    • c) >
    • d) <
  2. What will the following expression return: 5 > 3?
    • a) False
    • b) True
    • c) Error
    • d) None
  3. What is the result of the expression 10 != 10?
    • a) True
    • b) False
    • c) Error
    • d) None
  4. Which of the following operators checks if a value is greater than or equal to another value?
    • a) >=
    • b) <=
    • c) >
    • d) ==
  5. Which operator is used to check if two values are not equal in Python?
    • a) ==
    • b) <=
    • c) !=
    • d) >=

3. Logical Operators

  1. Which logical operator represents “AND” in Python?
    • a) &&
    • b) or
    • c) and
    • d) not
  2. What will the expression True or False return in Python?
    • a) False
    • b) True
    • c) Error
    • d) None
  3. Which of the following logical operators is used to reverse the result of a condition?
    • a) not
    • b) and
    • c) or
    • d) nor
  4. What is the result of the expression False and True?
    • a) True
    • b) False
    • c) Error
    • d) None
  5. Which of the following will return True in Python?
    • a) True and False
    • b) False or True
    • c) not True
    • d) not False

4. Assignment Operators

  1. Which assignment operator is used to add a value to an existing variable?
    • a) =
    • b) +=
    • c) -=
    • d) *=
  2. What is the result of the following code: x = 5; x %= 2?
    • a) 1
    • b) 2
    • c) 3
    • d) 5
  3. Which of the following operators is used to assign a value only if the variable is not already initialized?
    • a) ==
    • b) :=
    • c) =
    • d) not
  4. Which of the following will increment the value of x by 1?
    • a) x++
    • b) x += 1
    • c) x = x + 1
    • d) All of the above
  5. What will the expression x = 5; x *= 2 result in?
    • a) 10
    • b) 5
    • c) 2
    • d) 25

5. Bitwise Operators

  1. Which of the following operators performs a bitwise AND operation?
    • a) &
    • b) |
    • c) ^
    • d) ~
  2. What does the ^ operator do in Python?
    • a) Bitwise AND
    • b) Bitwise OR
    • c) Bitwise XOR
    • d) Bitwise NOT
  3. What is the result of 5 << 1 in Python?
    • a) 10
    • b) 3
    • c) 5
    • d) 2
  4. Which operator is used for bitwise negation in Python?
    • a) &
    • b) |
    • c) ~
    • d) ^
  5. What does the >> operator do in Python?
    • a) Bitwise AND
    • b) Bitwise OR
    • c) Right shift
    • d) Left shift

6. Membership and Identity Operators

  1. Which operator is used to check if a value exists in a list in Python?
    • a) in
    • b) is
    • c) not in
    • d) both a and c
  2. What does the is operator do in Python?
    • a) Checks if two objects have the same value
    • b) Checks if two objects are the same object in memory
    • c) Checks if a value exists in a list
    • d) Checks if two lists are equal
  3. What is the result of x = [1, 2, 3]; y = x; x is y?
    • a) False
    • b) True
    • c) None
    • d) Error
  4. What does the not in operator do in Python?
    • a) Checks if a value is not in a sequence
    • b) Checks if two objects are not the same
    • c) Checks if two variables are not equal
    • d) Checks if two objects are not in memory
  5. Which of the following checks if two variables refer to the same object in memory?
    • a) is
    • b) ==
    • c) not in
    • d) in

Answer Table:

QnoAnswer
1b) 3.0
2b) %
3a) 33
4b) **
5a) 3
6a) ==
7b) True
8b) False
9a) >=
10c) !=
11c) and
12b) True
13a) not
14b) False
15b) False or True
16b) +=
17a) 1
18b) :=
19b) x += 1
20a) 10
21a) &
22c) Bitwise XOR
23a) 10
24c) ~
25c) Right shift
26d) both a and c
27b) Checks if two objects are the same object in memory
28b) True
29a) Checks if a value is not in a sequence
30a) is

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top