Problem Solving and Python Programming MCQs | Page - 43
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 line of code shown above will result in a type error. this is because the operand ‘+’ is not supported when we combine the data types ‘int’ and ‘str’. sine this is exactly what we have done in the code shown above, a type error is thrown.
Explanation: the snippet of code shown above results in a value error. this is because there is an invalid literal for int() with base 10: ’65.43’.
Explanation: none output:
Explanation: execute in the shell to verify.
Python code?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
Explanation: -1 corresponds to the last index.
Explanation: string literal separated by whitespace are allowed. they are concatenated.
Jump to