MCQ Question Bank-Lists-10

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Practice Questions

Choose the correct answer:

1. What will be the output:

nameList = [‘Harsh’, ‘Pratik’, ‘Bob’, ‘Dhruv’]


print nameList[1][-1]

a) Pratik
b) Bob
c) D
d) k

2. Find the output:

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

a) [1,2,3,4,5,6,7,8]
b) [1,2,3,4]
c) [1,2,3,4,[5,6,7,8]]
d) [1,2,3,4][5,6,7,8]

3. Find the output:

list1 = [1, 2, 3, 4, 5]
list2 = list1
list2[0] = 0;
print( list1)

a) [1, 2, 3, 4, 5, 0]
b) [0,1, 2, 3, 4, 5]
c) [0, 2, 3, 4, 5]
d) [1, 2, 3, 4, 0]

4. Find the output:

list1 = [1998, 2002]


list2 = [2014, 2016]
print ((list1 + list2)*2)

a) [1998, 2002, 2014, 2016, 1998, 2002, 2014, 2016]


b) [1998, 2002, 2014, 2016]
c) [1998, 2002, 1998, 2002]
d) [2014, 2016, 2014, 2016]

5. Find the output:

list1 = [1, 2, 3, None, (1, 2, 3, 4, 5), [‘Hi’, ‘Hello’, ‘Bye’]]


print(len(list1))

a) 12
b) 11
c) 22
d) 6

6. Find the output :

list1 = [‘python’, ‘learning’, ‘@’, ‘cbse’, ‘python’, ‘.in’]


print(list1[0:6:2])

a) [‘python’, ‘@’, ‘python’]


b) [‘python’, ‘learning’, ‘@’]
c) [‘python’, ‘learning’, ‘@’, ‘python’, ‘in’]
d) [‘python’, ‘in’]

7. Find the output:

d1 = [10, 20, 30, 40, 50]


d2 = [1, 2, 3, 4, 5]
print( d1 – d1 )

a) [10, 20, 30, 40, 50]


b) [1, 2, 3, 4, 5]
c) [10, 20, 30, 40, 50,-1, -2, -3, -4, -5]
d) No Output

8. Find the output:

list = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’]


print(list[10:] )

a) [‘a’, ‘b’, ‘c’, ‘d’, ‘e’]


b) [ ‘c’, ‘d’, ‘e’]
c) [ ]
d) [‘a’, ‘b’]
9. Find the output :

L1 = [1, 2, 3, 4]
L2 = L1
L3 = L1.copy()
L4 = L1
L1[0] = [5]
print(L1, L2, L3, L4)

a) [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]


b) [[5], 2, 3, 4] [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4]
c) [5, 2, 3, 4] [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4]
d) [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] [[5], 2, 3, 4]

10. Find the output:

L = [1, 3, 5, 7, 9]
print(L.pop(-3), end = ‘ ‘)

a) 5
b) 9
c) 7
d) 3

11. What is the output:

myList = [“PYthon”, [4, 8, 12, 16]]


print(myList[0][1])
print(myList[1][3])

a) P 8
Y 16

b) P
12

c) Y
16

d) Python
8

12. What is the output:

myList= [5, 10, 15, 25]


print(myList[::-2])
a) [5,10]
b) [25,10]
c) [15,5]
d) [15,10,5]

You might also like