• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Python List Quiz

Question 11

Question 12: Find the output of the following program: 

Python3
list = ['python', 'learning', '@', 'Geeks', 'for', 'Geeks'] 
print(list[0:6:2])
  • ['python', '@', 'for']

  • [\'Geeks\', \'Geeks\', \'learning\']

  • [\'python\', \'learning\', \'@\', \'Geeks\', \'for\', \'Geeks\']

  • [\'python\', \'Geeks\']

Question 12

Find the output of the following program: 

Python3
d1 = [10, 20, 30, 40, 50] 
d2 = [1, 2, 3, 4, 5] 


subtracted = list()
for d1, d2 in zip(d1, d2):
    item = d1 -d2
    subtracted.append(item)

print(subtracted)
  • [10, 20, 30, 40, 50]

  • [1, 2, 3, 4, 5]

  • [10, 20, 30, 40, 50,-1, -2, -3, -4, -5]

  • 9, 18, 27, 36, 45

Question 13

Find the output of the following program: 

Python3
list = ['a', 'b', 'c', 'd', 'e'] 
print(list[10:] )
  • [\'a\', \'b\', \'c\', \'d\', \'e\']

  • [ \'c\', \'d\', \'e\']

  • [ ]

  • [\'a\', \'b\']

Question 14

Question 15: Find the output of the following program: 

Python3
list = ['a', 'b', 'c'] * -3
print(list)
  • [\'a\', \'b\', \'c\', \'a\', \'b\', \'c\', \'a\', \'b\', \'c\']

  • [\'c\', \'b\', \'a\', \'c\', \'b\', \'a\', \'c\', \'b\', \'a\']

  • [ ]

  • [\'a\', \'b\', \'c\']

Question 15

Find the output of the following program: 

Python3
data = [2, 3, 9] 
temp = [[x for x in[data]] for x in range(3)] 
print (temp) 
  • [[[2, 3, 9]], [[2, 3, 9]], [[2, 3, 9]]]

  • [[2, 3, 9], [2, 3, 9], [2, 3, 9]]

  • [[[2, 3, 9]], [[2, 3, 9]]]

  • None of these

Question 16

Find the output of the following program: 

Python3
data = [x for x in range(5)] 
temp = [x for x in range(7) if x in data and x%2==0] 
print(temp) 
  • [0, 2, 4, 6]

  • [0, 2, 4]

  • [0, 1, 2, 3, 4, 5]

  • Runtime error

Question 17

Find the output of the following program: 

Python3
temp = ['Geeks', 'for', 'Geeks'] 
arr = [i[0].upper() for i in temp] 
print(arr) 
  • [‘G’, ‘F’, ‘G’]

  • [‘GEEKS’, ‘FOR’, ‘GEEKS’]

  • [‘GEEKS’]

  • Compilation error

Question 18

Question 19: Find the output of the following program: 

Python3
temp = 'Geeks 22536 for 445 Geeks'
data = [x for x in (int(x) for x in temp if x.isdigit()) if x%2 == 0] 
print(data) 
  • [2, 2, 6, 4, 4]

  • Compilation error

  • Runtime error

  • [‘2’, ‘2’, ‘5’, ‘3’, ‘6’, ‘4’, ‘4’, ‘5’]

Question 19

Find the output of the following program: 

Python3
data = [x for x in (x for x in 'Geeks 22966 for Geeks' if x.isdigit()) if
(x in ([x for x in range(20)]))] 
print(data) 
  • [2, 2, 9, 6, 6]

  • [ ]

  • Compilation error

  • Runtime error

Question 20

Find the output of the following program: 

Python3
L1 = []
L1.append([1, [2, 3], 4]) 
L1.extend([7, 8, 9]) 
print(L1[0][1][1] + L1[2]) 
  • Type Error

  • 12

  • 11

  • 38

There are 24 questions to complete.

Last Updated :
Take a part in the ongoing discussion