Python Numbers MCQ Questions and Answers

1. What is the output of 5 ** 2 in Python?

a) 25
b) 10
c) 7
d) 2.5

2. Which of the following is used for integer division in Python?

a) /
b) //
c) %
d) **

3. How do you represent a hexadecimal number 1A in Python?

a) 0x1A
b) 1Ax
c) 1A
d) #1A

4. What is the result of the expression 8 % 3 in Python?

a) 2
b) 2.67
c) 5
d) 1

5. What data type is the number 5.5 in Python?

a) int
b) float
c) decimal
d) double

6. What is the type of the number 3+4j in Python?

a) int
b) float
c) complex
d) str

7. What is the result of the expression int(7.8) in Python?

a) 7
b) 8
c) 7.8
d) Error

8. Which function in Python is used to generate a range of numbers?

a) range()
b) xrange()
c) numbers()
d) list()

9. What does the expression float('inf') represent in Python?

a) A large integer value
b) Infinity
c) An error
d) Zero

10. How is scientific notation represented in Python for the number 0.000123?

a) 123e-6
b) 0.000123e0
c) 1.23e-4
d) 123e-4

Comments