Python Numeric Types MCQs: Python Language MCQs

Python Numeric Types MCQs. Multiple Choice Questions related to Numeric Types in Python Programming Language. This set includes 20 Multiple Choice Questions with Answers on Expressions and Numeric Types in Python Language.

Python Numeric Types MCQs

 

What is the result of cmp(3, 1) ??

a) 1
b) 0
c) True
d) False

 

What does ~~~~~~5 evaluate to ??

a) +5
b) -11
c) +11
d) -5

 

What does ~4 evaluate to ??

a) -5
b) -4
c) -3
d) +3

 

Which of the following is not a complex number ??

a) k = 2 + 3j
b) k = complex(2, 3)
c) k = 2 + 3l
d) k = 2 + 3J

 

What will be the value of x in the following Python expression ??

x = int(43.55+2/2)

a) 43
b) 44
c) 22
d) 23

Python Numeric Types MCQs

 

Which of the following operators has its associativity from right to left in Python ??

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

 

What does 3 ^ 4 evaluate to ??

a) 81
b) 12
c) 0.75
d) 7

 

What is the result of round(0.5) – round(-0.5) ??

a) 1.0
b) 2.0
c) 0.0
d) Value depends on Python version

 

Which of the following is incorrect ??

a) float(‘inf’)
b) float(‘nan’)
c) float(’56’+’78’)
d) float(’12+34′)

 

Which of the following is incorrect ??

a) x = 0b101
b) x = 0x4f5
c) x = 19023
d) x = 03964

Python Numeric Types MCQs

 

What is the type of inf in Python ??

a) Boolean
b) Integer
c) Float
d) Complex

 

What is the output of print 0.1 + 0.2 == 0.3 ??

a) True
b) False
c) Machine dependent
d) Error

 

What is the value of the following expression ??

float(22//3+3/3)

a) 8
b) 8.0
c) 8.3
d) 8.33

 

What is the value of the following expression ??

8/4/2, 8/(4/2)

a) (1.0, 4.0)
b) (1.0, 1.0)
c) (4.0. 1.0)
d) (4.0, 4.0)

 

What are the values of the following Python expressions ??

2**(3**2)
(2**3)**2
2**3**2

a) 64, 512, 64
b) 64, 64, 64
c) 512, 512, 512
d) 512, 64, 512

Python Numeric Types MCQs

 

Which of the following is the truncation division operator ??

a) /
b) %
c) //
d) |

 

What is the value of the following expression ??

2+4.00, 2**4.0

a) (6.0, 16.0)
b) (6.00, 16.00)
c) (6, 16)
d) (6.00, 16.0)

 

Evaluate the expression given below if A = 16 and B = 15 ??

A % B // A

a) 0.0
b) 0
c) 1.0
d) 1

 

What will be the value of the following Python expression ??

4 + 3 % 5

a) 4
b) 7
c) 2
d) 0

 

The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same ??

a) True
b) False

 

Read More

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!