PYTHON Built-In Functions MCQs

  1. Which built in function returns the length of an object?
    a) len()
    b) size()
    c) count()
    d) length()
    View Answer

    Correct answer: A — len()

  2. What will be printed?
    1 python
    2 print(len("Eduinq"))
    a) 6
    b) 7
    c) Error
    d) None
    View Answer

    Correct answer: A — 6

  3. Which built in function returns the sum of elements?
    a) sum()
    b) add()
    c) total()
    d) reduce()
    View Answer

    Correct answer: A — sum()

  4. What is the output of print(sum([1,2,3]))?
    a) 6
    b) 123
    c) Error
    d) None
    View Answer

    Correct answer: A — 6

  5. Which built in function returns the maximum value?
    a) max()
    b) maximum()
    c) high()
    d) top()
    View Answer

    Correct answer: A — max()

  6. What will be printed?
    1 python
    2 print(max([1,5,3]))
    a) 5
    b) 3
    c) 1
    d) Error
    View Answer

    Correct answer: A — 5

  7. Which built in function returns the minimum value?
    a) min()
    b) low()
    c) least()
    d) bottom()
    View Answer

    Correct answer: A — min()

  8. What is the output of print(min("Eduinq"))?
    a) E
    b) d
    c) Error
    d) None
    View Answer

    Correct answer: A — E

  9. Which built in function converts to integer?
    a) int()
    b) float()
    c) str()
    d) bool()
    View Answer

    Correct answer: A — int()

  10. What will be printed?
    1 python
    2 print(int("5")+2)
    a) 7
    b) 52
    c) Error
    d) None
    View Answer

    Correct answer: A — 7

  11. Which built in function converts to float?
    a) float()
    b) int()
    c) str()
    d) bool()
    View Answer

    Correct answer: A — float()

  12. What is the output of print(float("3.5"))?
    a) 3.5
    b) Error
    c) None
    d) 35
    View Answer

    Correct answer: A — 3.5

  13. Which built in function converts to string?
    a) str()
    b) int()
    c) repr()
    d) None
    View Answer

    Correct answer: A — str()

  14. What will be printed?
    1 python
    2 print(str(123)+"Eduinq")
    a) 123Eduinq
    b) Eduinq123
    c) Error
    d) None
    View Answer

    Correct answer: A — 123Eduinq

  15. Which built in function converts to boolean?
    a) bool()
    b) int()
    c) str()
    d) None
    View Answer

    Correct answer: A — bool()

  16. What is the output of print(bool(""))?
    a) False
    b) True
    c) Error
    d) None
    View Answer

    Correct answer: A — False

  17. Which built in function returns absolute value?
    a) abs()
    b) fabs()
    c) math.abs()
    d) None
    View Answer

    Correct answer: A — abs()

  18. What will be printed?
    1 python
    2 print(abs(-10))
    a) 10
    b) -10
    c) Error
    d) None
    View Answer

    Correct answer: A — 10

  19. Which built in function returns power?
    a) pow()
    b) exp()
    c) power()
    d) None
    View Answer

    Correct answer: A — pow()

  20. What is the output of print(pow(2,3))?
    a) 8
    b) 6
    c) Error
    d) None
    View Answer

    Correct answer: A — 8

  21. Which built in function returns rounded value?
    a) round()
    b) floor()
    c) ceil()
    d) None
    View Answer

    Correct answer: A — round()

  22. What will be printed?
    1 python
    2 print(round(3.14159,2))
    a) 3.14
    b) 3.14159
    c) Error
    d) None
    View Answer

    Correct answer: A — 3.14

  23. Which built in function returns sorted list?
    a) sorted()
    b) sort()
    c) order()
    d) arrange()
    View Answer

    Correct answer: A — sorted()

  24. What is the output of print(sorted([3,1,2]))?
    a) [1,2,3]
    b) [3,2,1]
    c) Error
    d) None
    View Answer

    Correct answer: A — [1,2,3]

  25. Which built in function returns reversed iterator?
    a) reversed()
    b) reverse()
    c) invert()
    d) None
    View Answer

    Correct answer: A — reversed()

  26. What will be printed?
    1 python
    2 print(list(reversed("Eduinq")))
    a) ['q','n','i','u','d','E']
    b) Eduinq
    c) Error
    d) None
    View Answer

    Correct answer: A — ['q','n','i','u','d','E']

  27. Which built in function returns enumeration?
    a) enumerate()
    b) list()
    c) zip()
    d) None
    View Answer

    Correct answer: A — enumerate()

  28. What is the output of below code?
    1 python
    2 for i,v in enumerate("Eduinq"):
    3 if i==0: print(v)
    a) E
    b) Eduinq
    c) Error
    d) None
    View Answer

    Correct answer: A — E

  29. Which built in function returns zipped iterator?
    a) zip()
    b) enumerate()
    c) map()
    d) None
    View Answer

    Correct answer: A — zip()

  30. What will be printed?
    1 python
    2 print(list(zip([1,2],[3,4])))
    a) [(1,3),(2,4)]
    b) [(1,2),(3,4)]
    c) Error
    d) None
    View Answer

    Correct answer: A — [(1,3),(2,4)]

  31. Which built in function applies function to iterable?
    a) map()
    b) filter()
    c) reduce()
    d) None
    View Answer

    Correct answer: A — map()

  32. What is the output of below code?
    1 python
    2 print(list(map(str,[1,2,3])))
    a) ['1','2','3']
    b) [1,2,3]
    c) Error
    d) None
    View Answer

    Correct answer: A — ['1','2','3']

  33. Which built in function filters iterable?
    a) filter()
    b) map()
    c) reduce()
    d) None
    View Answer

    Correct answer: A — filter()

  34. What will be printed?
    1 python
    2 print(list(filter(lambda x:x>2,[1,2,3,4])))
    a) [3,4]
    b) [1,2]
    c) Error
    d) None
    View Answer

    Correct answer: A — [3,4]

  35. Which built in function returns all attributes of object?
    a) dir()
    b) vars()
    c) help()
    d) None
    View Answer

    Correct answer: A — dir()

  36. What is the output of print("Eduinq".dir()==dir("Eduinq"))?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  37. Which built in function returns documentation?
    a) help()
    b) doc()
    c) info()
    d) None
    View Answer

    Correct answer: A — help()

  38. What will be printed?
    1 python
    2 print(help(len))
    a) Documentation string
    b) len
    c) Error
    d) None
    View Answer

    Correct answer: A — Documentation string

  39. Which built in function returns object type?
    a) type()
    b) isinstance()
    c) id()
    d) None
    View Answer

    Correct answer: A — type()

  40. What is the output of print(type(5))?
    a) <class 'int'>
    b) int
    c) Error
    d) None
    View Answer

    Correct answer: A — <class 'int'>

  41. Which built in function checks instance?
    a) isinstance()
    b) type()
    c) issubclass()
    d) None
    View Answer

    Correct answer: A — isinstance()

  42. What will be printed?
    1 python
    2 print(isinstance("Eduinq",str))
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  43. Which built in function checks subclass?
    a) issubclass()
    b) isinstance()
    c) type()
    d) None
    View Answer

    Correct answer: A — issubclass()

  44. What is the output of print(issubclass(bool,int))?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  45. Which built in function returns unique id of object?
    a) id()
    b) hash()
    c) type()
    d) None
    View Answer

    Correct answer: A — id()

  46. What will be printed?
    1 python
    2 x = "Eduinq"
    3 print(id(x)!=0)
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  47. Which built in function returns hash value?
    a) hash()
    b) id()
    c) type()
    d) None
    View Answer

    Correct answer: A — hash()

  48. What is the output of print(hash("Eduinq")!=0)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  49. Which built in function evaluates expression?
    a) eval()
    b) exec()
    c) compile()
    d) None
    View Answer

    Correct answer: A — eval()

  50. What will be printed?
    1 python
    2 print(eval("2+3"))
    a) 5
    b) 23
    c) Error
    d) None
    View Answer

    Correct answer: A — 5

Quick Links to Explore