Python Programming - Functions

Exercise : Functions - General Questions
  • Functions - General Questions
61.
What does the callable function check for?
It checks if an object is an instance of a class.
It checks if an object is callable, i.e., can be called as a function.
It checks if an object is iterable.
It checks if an object is a string.
Answer: Option
Explanation:
The callable function in Python checks if an object is callable, i.e., can be called as a function.

62.
What does the chr function do?
It checks if an object is a character.
It converts an integer to a character.
It calculates the character length of a string.
It creates a character set.
Answer: Option
Explanation:
The chr function in Python converts an integer to the corresponding Unicode character.

63.
What does the __name__ attribute represent?
The name of the module.
The name of the function.
The name of the class.
The name of the variable.
Answer: Option
Explanation:
The __name__ attribute represents the name of the module in Python.

64.
What does the vars function do?
It returns the names of all variables in the local namespace.
It returns the values of all variables in the local namespace.
It returns the names and values of all variables in the local namespace.
It returns the attributes of an object.
Answer: Option
Explanation:
The vars function in Python returns a dictionary containing the names and values of all variables in the local namespace.

65.
What does the isinstance function check for?
It checks if an object is an instance of a specific class.
It checks if an object is iterable.
It checks if an object is callable.
It checks if an object is a string.
Answer: Option
Explanation:
The isinstance function in Python checks if an object is an instance of a specific class.