Question 1
Find the output of the following program:
nameList = ['Harsh', 'Pratik', 'Bob', 'Dhruv']
print (nameList[1][-1])
Question 2
Find the output of the following program:
geekCodes = [1, 2, 3, 4]
geekCodes.append([5,6,7,8])
print(geekCodes)
Question 3
Find the output of the following program:
def addToList(listcontainer):
listcontainer += [10]
mylistContainer = [10, 20, 30, 40]
addToList(mylistContainer)
print (len(mylistContainer))
Question 4
Find the output of the following program:
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)
Question 5
Find the output of the following program:
def gfg(x,l=[]):
for i in range(x):
l.append(i*i)
print(l)
gfg(3,[3,2,1])
Question 6
Find the output of the following program:
# statement 1
list1 = range(100, 110)
# statement 2
print (list1.index(105))
Question 7
Find the output of the following program:
list1 = [1, 2, 3, 4, 5]
list2 = list1
list2[0] = 0;
print( list1)
Question 8
Find the output of the following program:
list1 = [1998, 2002]
list2 = [2014, 2016]
print ((list1 + list2)*2)
Question 9
Find the output of the following program:
list1 = ['physics', 'chemistry', 1997, 2000]
print (list1[1][-1])
Question 10
Find the output of the following program:
list = [1, 2, 3, None, (1, 2, 3, 4, 5), ['Geeks', 'for', 'Geeks']]
print(len(list))
There are 24 questions to complete.