Python Functions Questions and Answers
Python Programming - Functions Questions with Answers help understand how to structure code using reusable blocks. These Python Functions Questions are key for TCS, Accenture, and SSC exams to assess coding logic and modular design
Python Functions
Showing 10 of
25 questions
21. What is a pure function?
- A function with no parameters
- A function that doesn"t return anything
- A function with no side effects and deterministic output
- A function that only uses built-in features
22. What is a higher-order function?
- A function with high complexity
- A function that takes or returns another function
- A function defined in a high-level module
- A function with many parameters
23. Which built-in function is used to get a list of all attributes and methods of an object?
- help()
- dir()
- attrs()
- list()
24. What is function composition?
- Writing functions in a composed manner
- Combining functions to create new functions
- Documenting functions properly
- Creating functions with multiple purposes
25. What is the purpose of the map() function?
- To create a map of function names
- To apply a function to all items in an iterable
- To map variables to values
- To convert dictionaries to lists