COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
345000
|
|
000345
|
|
000000345
|
|
345000000
|
Detailed explanation-1: -What will be the output of the following Python expression if X=345? Explanation: The above expression returns the output 000345. It adds the required number of zeroes before the given number in order to make the number of digits 6 (as specified in this case). 5.
Detailed explanation-2: -Explanation: The function round is used to round off the given decimal number to the specified decimal places. In this case, the number should be rounded off to two decimal places. Hence the output will be 4.57. 6.
Detailed explanation-3: -Explanation: The code shown above returns a new list containing only those elements of the list l which do not amount to zero. Hence the output is: [1, 2, ‘hello’].
Detailed explanation-4: -What will be the output of the following Python code snippet? x = ‘abcd’foriinrange(len(x)):i[x]. upper()print(x)a) abcdb) ABCDc) errord) none of the mentionedView AnswerAnswer: cExplanation: Objects of type int aren’t subscriptable.
Detailed explanation-5: -What will be the output of the following Python function? Explanation: The function max() is being used to find the maximum value from among-3, -4 and false. Since false amounts to the value zero, hence we are left with min(0, 2, 7) Hence the output is 0 (false).