Python Build-in Function Quiz -50 Questions

Here you will get 50+ questions of Python Build-in Function that will be randomly generated and you will get 4 answers among them you have to select the correct one.

After solving the quiz you will see the score that you solve and you will get mail and you can generate your certificated.

Contents

1. Which of the following functions is a built-in function in python?

a) seed()
b) sqrt()
c) factorial()
d) print()

Answer: (d)

2. What will be the output of the following Python expression?

round(4.576)

a) 4.5
b) 5
c) 4
d) 4.6

Answer: (b)

3. The function pow(x,y,z) is evaluated as:

a) (x**y)**z
b) (x**y) / z
c) (x**y) % z
d) (x**y)*z

Answer: (c)

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

all([2,4,0,6])

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

Answer: (c)

5. What will be the output of the following Python expression?

round(4.5676,2)?

a) 4.5
b) 4.6
c) 4.57
d) 4.56

Answer: (c)

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

any([2>8, 4>2, 1>2])

a) Error
b) True
c) False
d) 4>2

Answer: (b)

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

import math

abs(math.sqrt(25))

a) Error
b) -5
c) 5
d) 5.0

Answer: (d)

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

sum(2,4,6)

sum([1,2,3])

a) Error, 6
b) 12, Error
c) 12, 6
d) Error, Error

Answer: (a)

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

all(3,0,4.2)

a) True
b) False
c) Error
d) 0
Answer: c

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

min(max(False,-3,-4), 2,7)

a) 2
b) False
c) -3
d) -4

Answer: b

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

chr(‘97’)

chr(97)

a)

  • a
  • Error

b)

  • ‘a’
  • a

c)

  • Error
  • a

d)

  • Error
  • Error

Answer: (c)

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

complex(1+2j)

a) Error
b) 1
c) 2j
d) 1+2j

Answer: (d)

13. What is the output of the function complex()?

a) 0j
b) 0+0j
c) 0
d) Error

Answer: (a)

14. 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)
Answer: b

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

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)

Answer: (c)

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

a) True
b) False

c) Both a and b

d) None

Answer: (a)

17. 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)]

Answer: (c)

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

x=3

eval('x^2')

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

Answer: (b)

19. 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

Answer: b

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

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

Answer: (c)

21. Which of the following functions accepts only integers as arguments?

a) ord()
b) min()
c) chr()
d) any()

Answer: (c)

22. Suppose there is a list such that: l=[2,3,4]. If we want to print this list in reverse order, which of the following methods should be used?

a) reverse(l)
b) list(reverse[(l)])
c) reversed(l)
d) list(reversed(l))

Answer: (d)

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

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)

Answer: (b)

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

ord(65)

ord(‘A’)

a)

  • A
  • 65

b)

  • Error
  • 65

c)

  • A
  • Error

d)

  • Error
  • Error

Answer: (b)

25. 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

Answer: (a)

26. 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()
Answer: (d)

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

hex(15)

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

Answer: (d)

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

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

Answer: (b)

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

len(["hello",2, 4, 6])

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

Answer: (a)

30. 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

Answer: (c)

31.__________ represent, returns the absolute value of a number.

a) abs()
b) all()
c) any()
d) bin()

Answer: (a)


32.__________ represent, returns true if all items in an iterable object are true.

 a) abs()
b) all()
c) any()
d) bin()

Answer: (b)

33.___________ represent, returns true if any item in an iterable object is true.

 a) abs()
b) all()
c) any()
d) bin()

Answer: (c)

34.___________ represent, returns the binary version of a number.

a) abs()
b) all()
c) any()
d) bin()

Answer: (d)

35.___________ represent, Returns the boolean value of the specified object

a) bool()
b) bytes()
c) char()
d) bin()

Answer: (a)

36.___________ represent, returns a bytes objects.

a) bool()
b) bytes()
c) char()
d) bin()

Answer: (b)

37.___________ represent, returns a character from the specified Unicode.

a) bool()
b) bytes()
c) char()
d) bin()

Answer: (a)

38.___________ represent, returns an array of bytes.

a) bool()
b) bytearray()
c) char()
d) bin()

Answer: (b)

39.___________ represent, returns the specified source as an object, ready to be executed.

a) bool()
b) bytearray()
c) char()
d) compile()

Answer: (d)

40.___________ represent, returns true if the specified object is callable, otherwise false.

a) bool()
b) bytearray()
c) callable()
d) compile()

Answer: (c)

41.___________ represent, returns a complex number.

a) bool()
b) complex()
c) callable()
d) compile()

Answer: (b)

42.___________ represent, returns a dictionary.

a) dict()
b) dir()
c) callable()
d) compile()

Answer: (a)

43.___________ represent, evaluates and executes an expression.

a) eval()
b) filter()
c) float()
d) format()

Answer: (a)

44.___________ represent, returns a floating point number.

a) eval()
b) filter()
c) float()
d) format()

Answer: (c)

45.___________ represent, formats a specified value.

a) eval()
b) filter()
c) float()
d) format()

Answer: (d)

46.___________ represent, returns a frozen set objects

a) eval()
b) frozenset()
c) float()
d) format()

Answer: (b)

47.___________ represent, allowing user input.

a) input()
b) id()
c) int()
d) help()

Answer: (a)

48.___________ represent, returns an integer number.

a) input()
b) id()
c) int()
d) help()

Answer: (c)

49.___________ represent, returns the id of an object.

a) input()
b) id()
c) int()
d) help()

Answer: (b)

50.___________ represent, executes the built-in help system.

a) input()
b) id()
c) int()
d) help()

Answer: (d)

Pramod Kumar Yadav is from Janakpur Dham, Nepal. He was born on December 23, 1994, and has one elder brother and two elder sisters. He completed his education at various schools and colleges in Nepal and completed a degree in Computer Science Engineering from MITS in Andhra Pradesh, India. Pramod has worked as the owner of RC Educational Foundation Pvt Ltd, a teacher, and an Educational Consultant, and is currently working as an Engineer and Digital Marketer.



Leave a Comment