Explanation: the elements of the tuple are accessed by their indices.
Problem Solving and Python Programming MCQs | Page - 20
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 arguments passed to the function format can be integers also.
Explanation: 2 is converted to binary, 10 to hexadecimal and 12 to octal.
Explanation: an integer is expected.
Explanation: the built-in functions min(), max(), divmod(), ord(), any(), all() etc throw an error when no arguments are passed to them. however there are some built-in functions like float(), complex() etc which do not throw an error when no arguments are passed to them. the output of float() is 0.0.
Explanation: the function ord() accepts a character. hence ord(), ord(”) and ord(“”)
Explanation: functions are reusable pieces of programs. they allow you to give a name to a block of statements, allowing you to run that block using the specified name anywhere in your program and any number of times.
Explanation: here, we define a function called printmax that uses two parameters called a and b. we find out the greater number using a simple if..else statement and then print the bigger number.
Explanation: the maximum function returns the maximum of the parameters, in this case the numbers supplied to the function. it uses a simple if..else statement to find the greater value and then returns that value.
Explanation: python has a nifty feature called documentation strings, usually referred to by its shorter name docstrings. docstrings
Jump to