Explanation: built-in functions and user defined ones. the built-in functions are part of the python language. examples are: dir(), len() or abs(). the user defined functions are functions created with the def keyword.
Problem Solving and Python Programming MCQs | Page - 21
Dear candidates you will find MCQ questions of Problem Solving and Python Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Explanation: functions can be defined inside a module, a class or another function.
Explanation: each object in python has a unique id. the id() function returns the object’s id.
Explanation: functions that are always available for usage, functions that are contained within external modules, which must be imported and functions defined by a programmer with the def keyword.
Explanation: a function is created to do a specific task. often there is a result from such a task. the return keyword is used to return
Explanation: python supports the creation of anonymous functions (i.e. functions that are not bound to a name) at runtime, using a construct called lambda. lambda functions are restricted to a single expression. they can be used wherever normal functions can be used.
Explanation: the lambda keyword creates an anonymous function. the x is a parameter, that is passed to the lambda function. the parameter is followed by a colon character.
Explanation: lambda definition does not include a return statement. it always contains an expression which is returned. also note that we can put a lambda definition anywhere a function is expected. we don’t have to assign it to a variable at all.
Explanation: lambda is an anonymous function in python. hence this statement is false.
Explanation: the value of a variable defined outside all function definitions is referred to as a global variable and can be used by multiple functions of the program.
Jump to