Built in Functions Python: Python Functions MCQs

Built in Functions Python. Multiple Choice Questions related to Built in Functions in Python Programming Language.

 

Built in Functions Python

 

 

What will be the output of the following Python function ??

oct(7)
oct(‘7’)

a) Error
07

b) 0o7
Error

c) 0o7
Error

d) 07
0o7

 

Which of the following functions does not necessarily accept only iterables as arguments ??

a) enumerate()
b) all()
c) chr()
d) max()

 

What will be the output of the following Python function ??

len([“hello”,2, 4, 6])

a) 4
b) 3
c) Error
d) 6

 

What will be the output of the following Python functions ??

float(‘1e-003’)
float(‘2e+003’)

a) 3.00
300

b) 0.001
2000.0

c) 0.001
200

d) Error
2003

 

Built in Functions Python

 

Which of the following functions does not throw an error ??

a) ord()
b) ord(‘ ‘)
c) ord(”)
d) ord(“”)

 

What will be the output of the following Python functions ??

x=3
eval(‘x^2’)

a) Error
b) 1
c) 9
d) 6

 

What will be the output of the following Python ??

hex(15)

a) f
b) 0xF
c) 0Xf
d) 0xf

 

What will be the output of the following Python function ??

list(enumerate([2, 3]))

a) Error
b) [(1, 2), (2, 3)]
c) [(0, 2), (1, 3)]
d) [(2, 3)]

 

Built in Functions Python

 

Which of the following functions will not result in an error when no arguments are passed to it ??

a) min()
b) divmod()
c) all()
d) float()

 

The function complex(‘2-3j’) is valid but the function complex(‘2 – 3j’) is invalid ??

a) True
b) False

 

What will be the output of the following Python function ??

float(‘-infinity’)
float(‘inf’)

a) –inf
inf

b) –infinity
inf

c) Error
Error

d) Error
Junk value

 

What will be the output ??

divmod(10.5,5)
divmod(2.4,1.2)

a) (2.00, 0.50)
(2.00, 0.00)

b) (2, 0.5)
(2, 0)

c) (2.0, 0.5)
(2.0, 0.0)

d) (2, 0.5)
(2)

 

Built in Functions Python

 

What will be the output ??

ord(65)
ord(‘A’)

a) A
65

b) Error
65

c) A
Error

d) Error
Error

 

The function divmod(a,b), where both ‘a’ and ‘b’ are integers is evaluated as ??

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

 

What will be the output ??

float(‘ -12345\n’) (Note that the number of blank spaces before the number is 5)

a) -12345.0 (5 blank spaces before the number)
b) -12345.0
c) Error
d) -12345.000000000…. (infinite decimal places)

 

Read More

Leave a Comment

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

error: Content is protected !!