Python Programming Multiple Choice Question - Functions
This section focuses on the "Functions" of the Python programming. These Multiple Choice Questions (mcq) should be practiced to improve the Python programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which keyword is use for function?
Explanation: Keyword def marks the start of function header.
2. Which of the following items are present in the function header?
Explanation: function header consist of function name and parameter list.
3. What is called when a function is defined inside a class?
4. If return statement is not used inside the function, the function will return:
5. What is a recursive function?
Explanation: Recursive functions are the functions which calls itself.
6. Which of the following is the use of id() function in python?
Explanation: The id() function returns identity of the object. This is an integer which is unique for the given object and remains constant during its lifetime.
7. Which of the following function headers is correct?
Explanation: All required parameters must be placed before any default arguments. Simply because they are mandatory, whereas default arguments are not. Syntactically, it would be impossible for the interpreter to decide which values match which arguments if mixed modes were allowed. A SyntaxError is raised if the arguments are not given in the correct order.
8. In which part of memory does the system stores the parameter and local variables of funtion call?
Explanation: Stack, where variables are stored, along with information that is saved each time a function is called. Each time a function is called, the address of where to return to and certain information about the caller’s environment, such as some of the machine registers, are saved on the stack.
Also check :