• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Python List Quiz

Question 1

Find the output of the following program: 

Python3
nameList = ['Harsh', 'Pratik', 'Bob', 'Dhruv'] 
print (nameList[1][-1]) 
  • r

  • b

  • D

  • k

Question 2

Find the output of the following program: 

Python3
geekCodes = [1, 2, 3, 4] 
geekCodes.append([5,6,7,8]) 
print(geekCodes) 
  • [1,2,3,4,5,6,7,8]

  • [1,2,3,4]

  • [1,2,3,4,[5,6,7,8]]

  • [1,2,3,4][5,6,7,8]

Question 3

Find the output of the following program: 

Python3
def addToList(listcontainer): 
	listcontainer += [10] 
mylistContainer = [10, 20, 30, 40] 
addToList(mylistContainer) 
print (len(mylistContainer)) 
  • 4

  • 5

  • 6

  • 10

Question 4

Find the output of the following program: 

Python3
check1 = ['Learn', 'Quiz', 'Practice', 'Contribute'] 
check2 = check1 
check3 = check1[:] 

check2[0] = 'Code'
check3[1] = 'Mcq'

count = 0
for c in (check1, check2, check3): 
	if c[0] == 'Code': 
		count += 1
	if c[1] == 'Mcq': 
		count += 10

print (count) 
  • 4

  • 5

  • 11

  • 12

Question 5

Find the output of the following program: 

Python3
def gfg(x,l=[]): 
	for i in range(x): 
		l.append(i*i) 
	print(l) 

gfg(3,[3,2,1]) 
  • [3, 2, 1, 0, 1, 4]

  • [0, 1, 0, 1, 4]

  • [0, 1]

  • [ ]

Question 6

Find the output of the following program: 

Python3
# statement 1
list1 = range(100, 110) 

# statement 2
print (list1.index(105))
  • 105

  • 5

  • 106

  • 104

Question 7

Find the output of the following program: 

Python3
list1 = [1, 2, 3, 4, 5] 
list2 = list1 
list2[0] = 0; 

print( list1)  
  • [1, 2, 3, 4, 5, 0]

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

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

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

Question 8

Find the output of the following program: 

Python3
list1 = [1998, 2002] 
list2 = [2014, 2016] 

print ((list1 + list2)*2)
  • [1998, 2002, 2014, 2016, 1998, 2002, 2014, 2016]

  • [1998, 2002, 2014, 2016]

  • [1998, 2002, 1998, 2002]

  • [2014, 2016, 2014, 2016]

Question 9

Find the output of the following program: 

Python3
list1 = ['physics', 'chemistry', 1997, 2000] 
print (list1[1][-1])
  • p

  • y

  • 7

  • 2

Question 10

Find the output of the following program: 

Python3
list = [1, 2, 3, None, (1, 2, 3, 4, 5), ['Geeks', 'for', 'Geeks']] 
print(len(list))
  • 12

  • 11

  • 6

  • 22

There are 24 questions to complete.

Last Updated :
Take a part in the ongoing discussion