COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
0 1 2 3 0
|
|
0 1 2 0
|
|
0 1 2
|
|
Error
|
Detailed explanation-1: -From all these options 0 1 2 0 is answer. If you find any mistake in What is the output of the following program : i = 0 while i < 3: print i i += 1 else: print 0 then definitely tell us through comment, or new Write the answer.
Detailed explanation-2: -i = 0whilei < 5:print(i)i += 1ifi == 3:breakelse:print(0)a) 0 1 2 0b) 0 1 2c) errord) none of the mentionedView AnswerAnswer: bExplanation: The else part is not executed if control breaks out of the loop. Explanation: NameError, i is not defined.
Detailed explanation-3: -Answer: d) The answer of this question is 0.
Detailed explanation-4: -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-5: -Answer: The output for the given Python program is 001020340. Hence, the answer is 001020340.