Learn with Yasir

Share Your Feedback

Python Built-in Functions MCQs – Multiple Choice Questions for Practice and Learning

Test your understanding of Python built-in functions with these multiple choice questions. Practice using functions like map(), filter(), len(), and more with beginner-friendly MCQs and detailed answers. Ideal for students and Python learners preparing for exams or interviews.

Topic: built-in-functions


📝 Multiple Choice Questions

🟢 Beginner

Q1. What does the built-in function `len()` return when used on a string?

  • 🟢 A. The number of characters in the string
  • 🔵 B. The number of unique characters
  • 🟠 C. The ASCII value of the first character
  • 🔴 D. The last character of the string
Answer

The number of characters in the string

`len()` returns the total count of characters in the string.


Q2. What is the return type of the `type()` function in Python?

  • 🟢 A. str
  • 🔵 B. int
  • 🟠 C. type
  • 🔴 D. object
Answer

type

`type()` returns the type of the given object, which itself is an instance of `type`.


Q3. Which built-in function converts an object to its string representation?

  • 🟢 A. str()
  • 🔵 B. repr()
  • 🟠 C. ascii()
  • 🔴 D. format()
Answer

str()

`str()` returns a readable string version of an object, often more user-friendly than `repr()`.


Q4. What does the `sorted()` function return?

  • 🟢 A. tuple
  • 🔵 B. list
  • 🟠 C. iterator
  • 🔴 D. dict
Answer

list

`sorted()` always returns a new list containing the sorted elements.


Q5. What does the `any()` function return when all elements of an iterable are `False`?

  • 🟢 A. True
  • 🔵 B. False
  • 🟠 C. None
  • 🔴 D. Error
Answer

False

`any()` returns `True` if at least one element is truthy; otherwise, it returns `False`.


Q6. Which built-in function returns the Unicode code point of a character?

  • 🟢 A. ord()
  • 🔵 B. chr()
  • 🟠 C. ascii()
  • 🔴 D. bytes()
Answer

ord()

`ord('A')` returns `65`, the Unicode code point for 'A'.


Q7. Which function can be used to find the smallest item in an iterable?

  • 🟢 A. max()
  • 🔵 B. min()
  • 🟠 C. sorted()
  • 🔴 D. filter()
Answer

min()

`min()` returns the smallest element from the iterable.


Q8. Which built-in function converts an integer to binary string?

  • 🟢 A. oct()
  • 🔵 B. bin()
  • 🟠 C. hex()
  • 🔴 D. format()
Answer

bin()

`bin(5)` returns `'0b101'`.


🟡 Intermediate

Q1. Which built-in function can be used to get the largest item from an iterable?

  • 🟢 A. min()
  • 🔵 B. max()
  • 🟠 C. sum()
  • 🔴 D. sorted()
Answer

max()

`max()` returns the largest item from an iterable based on natural ordering or a provided key.


Q2. Which function is used to convert a string into a list of its characters?

  • 🟢 A. list()
  • 🔵 B. tuple()
  • 🟠 C. set()
  • 🔴 D. str()
Answer

list()

`list('abc')` results in `['a', 'b', 'c']`.


Q3. Which function returns the absolute value of a number?

  • 🟢 A. round()
  • 🔵 B. abs()
  • 🟠 C. pow()
  • 🔴 D. math.fabs()
Answer

abs()

`abs()` returns the absolute value of integers, floats, or complex numbers.


Q4. Which built-in function combines elements from multiple iterables into tuples?

  • 🟢 A. map()
  • 🔵 B. zip()
  • 🟠 C. filter()
  • 🔴 D. reduce()
Answer

zip()

`zip()` pairs items from multiple iterables into tuples until the shortest iterable is exhausted.


Q5. Which built-in function applies a function to all items in an iterable and returns an iterator?

  • 🟢 A. filter()
  • 🔵 B. map()
  • 🟠 C. reduce()
  • 🔴 D. zip()
Answer

map()

`map()` applies the given function to every item in the iterable and returns an iterator.


Q6. What does the `enumerate()` function return?

  • 🟢 A. list of tuples
  • 🔵 B. iterator of tuples
  • 🟠 C. set of tuples
  • 🔴 D. dict of tuples
Answer

iterator of tuples

`enumerate()` returns an iterator of `(index, element)` tuples.


Q7. Which function is used to check if an object is an instance of a class?

  • 🟢 A. issubclass()
  • 🔵 B. type()
  • 🟠 C. isinstance()
  • 🔴 D. callable()
Answer

isinstance()

`isinstance(obj, Class)` checks whether `obj` is an instance of `Class` or its subclasses.


Q8. Which built-in function returns the sum of all elements in an iterable?

  • 🟢 A. reduce()
  • 🔵 B. sum()
  • 🟠 C. map()
  • 🔴 D. all()
Answer

sum()

`sum()` returns the arithmetic sum of all numeric elements in an iterable.


🔴 Advanced

Q1. What does the `zip()` function return in Python 3?

  • 🟢 A. list
  • 🔵 B. tuple
  • 🟠 C. iterator
  • 🔴 D. dict
Answer

iterator

In Python 3, `zip()` returns an iterator of tuples, unlike Python 2 which returned a list.


Q2. Which function can be used to dynamically execute a string as Python code?

  • 🟢 A. eval()
  • 🔵 B. exec()
  • 🟠 C. compile()
  • 🔴 D. globals()
Answer

exec()

`exec()` executes dynamic Python code, while `eval()` only evaluates expressions.


Q3. Which function can be used to create an iterable of numbers, but is not itself a built-in function?

  • 🟢 A. range()
  • 🔵 B. xrange()
  • 🟠 C. enumerate()
  • 🔴 D. count()
Answer

xrange()

`xrange()` was available in Python 2 but not in Python 3; `range()` in Python 3 behaves like `xrange()`.


Q4. Which built-in function returns the memory address of an object?

  • 🟢 A. id()
  • 🔵 B. hash()
  • 🟠 C. repr()
  • 🔴 D. globals()
Answer

id()

`id()` returns the unique identity of an object, which is its memory address in CPython.


Explore More Topics

📘 Learn Python

Tutorials, Roadmaps, Bootcamps & Visualization Projects

Python Fundamentals

Flow Control Statements


Python Functions


Fundamentals more ...




🧠 Python Advanced

Object-Oriented Programming in Python (OOP)

More...

🧠 Modules