Explanation: the function max() is being used to find the maximum value from among
Problem Solving and Python Programming MCQs | Page - 10
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: the built-in function complex() returns the argument in a complex form.
Explanation: the complex function returns 0j if both of the arguments are omitted, that is, if the function is in the form of complex() or complex(0), then the output will be 0j.
Explanation: the function divmod(a,b) is evaluated as a//b, a%b, if both ‘a’ and ‘b’ are integers.
Explanation: when converting from a string, the string must not contain any blank spaces around the + or – operator. hence the function complex(‘2 – 3j’) will result in an error.
Explanation: the functions enumerate(), all() and max() accept iterables as arguments whereas the function chr() throws an error on receiving an iterable as an argument. also note that the function chr() accepts only integer values.
Explanation: the function chr() accepts only integers as arguments. the function ord() accepts only strings. the functions min() and max() can accept floating point as well as integer arguments.
Explanation: the built-in function reversed() can be used to reverse the elements of a list. this function accepts only an iterable as an argument. to print the output in the form of a list, we use: list(reversed(l)). the output will be: [4,3,2].
Explanation: getopt parses options received from the command line.
Explanation: it is a list of elements.
Jump to