Python Programming - Functions
Exercise : Functions - General Questions
- Functions - General Questions
41.
How do you remove the last element from a list?
Answer: Option
Explanation:
The
list.pop()
method removes and returns the last element from a list.
42.
What is the purpose of the
round()
function?
Answer: Option
Explanation:
The
round()
function is used to round a floating-point number to the nearest integer.
43.
What is the purpose of the
*args
and **kwargs
parameters in a function definition?
Answer: Option
Explanation:
*args
is used to pass a variable number of positional arguments, and **kwargs
is used to pass a variable number of keyword arguments to a function.
44.
What is the purpose of the
decorator
?
Answer: Option
Explanation:
A decorator in Python is used to modify or extend the behavior of functions or methods.
45.
What is the purpose of the
enumerate
function?
Answer: Option
Explanation:
The
enumerate
function is used to iterate over a sequence and keep track of the index of the current item.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers