🔍
What is the output when following code is executed ? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = names1  names3 = names1[:]  names2[0] = 'Alice'  names3[1] = 'Bob'  sum = 0  for ls in (names1, names2, names3):   if ls[0] == 'Alice':   sum += 1   if ls[1] == 'Bob':   sum += 10  print sum  a) 11  b) 12  c) 21  d) 22
0 like 0 dislike

1 Answer

d) 22
0 like 0 dislike

Related questions

What is the output when following code is executed ? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman'] >>>print(names[-1][-1]) a) A b) Daman c) Error d) n
Answer : b) Daman...

View solution
0 like 0 dislike
1 answer

What is the output of the following? i = 5 while True: if i%0O9 == 0: break print(i) i += 1 a) 5 6 7 8 b) 5 6 7 8 9 c) 5 6 7 8 9 10 11 12 13 14 15 …. d) error
Answer : d) error...

View solution
0 like 0 dislike
1 answer

What will be the output? numberGames = {} numberGames[(1,2,4)] = 8 numberGames[(4,2,1)] = 10 numberGames[(1,2)] = 12 sum = 0 for k in numberGames: sum += numberGames[k] print len(numberGames) + sum Page No 36 a) 30 b) 24 c) 33 d) 12
Answer : a) 30...

View solution
0 like 0 dislike
1 answer

What is the output when following statement is executed ? >>>print('new' 'line') a) Error b) Output equivalent to print ‘new\nline’ Page No 22 c) newline d) new line
Answer : c) newline...

View solution
0 like 0 dislike
1 answer

hat is the output when following code is executed ? >>>print r"\nhello" The output is a) a new line and hello b) \nhello c) the letter r and then hello d) error
Answer : d) error...

View solution
0 like 0 dislike
1 answer

50.5k questions

47.1k answers

240 comments

7.0k users