Python List MCQ – 4

Q1) Find the output of the given Python program?

print(list('Hello'))

a) [Hello]
b) [‘Hello’]
c) [‘H’, ‘e’, ‘l’, ‘l’, ‘o’]
d) None of these

View Answer Answer:- c) [‘H’, ‘e’, ‘l’, ‘l’, ‘o’]

Q2) What is the output of the given below program?

print("Know Program".split())

a) ‘Know’, ‘Program’
b) (‘Know’, ‘Program’)
c) [‘Know’, ‘Program’]
d) {‘Know’, ‘Program’}

View Answer Answer:- c) [‘Know’, ‘Program’]

Q3) Find the output of the given Python program?

print(list("a*b*c*d".split('*')))

a) [‘a’, ‘*’, ‘b’, ‘*’, ‘c’, ‘*’, ‘d’]
b) [‘a’, ‘b’, ‘c’, ‘d’]
c) [‘abcd’]
d) [‘a*b*c*d’]

View Answer Answer:- b) [‘a’, ‘b’, ‘c’, ‘d’]

Q4) Find the output of the given Python program?

names = ['Hi', 'Hello', 'Know Program']
print(names[-1][-1])

a) H
b) i
c) o
d) m

View Answer Answer:- d) m

Q5) What is the output of the given below program?

l = [None] * 5
print(len(l))

a) 0
b) 1
c) 5
d) Error

View Answer Answer:- c) 5

Q6) What is the output of the given below program?

my_list = ["Know", "Program"]
print("-".join(my_list))

a) Know Program
b) Know-Program
c) KnowProgram-
d) -KnowProgram

View Answer Answer:- b) Know-Program

Q7) Find the output of the given Python program?

list1 = [1, 2, 3]
list2 = [1, 2, 3]
list3 = list1 < list2
print(list3)

a) True
b) False
c) None
d) Error

View Answer Answer:- b) False

Q8) What is the output of the given below program?

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

a) [2]
b) [3, 5]
c) [2, 5]
d) [2, 3, 5]

View Answer Answer:- c) [2, 5]

Q9) Find the output of the given Python program?

L=[1,2,3,4,5,[6,7,8]]
print(L[5])

a) 6
b) 6, 7, 8
c) [6, 7, 8]
d) Error

View Answer Answer:- c) [6, 7, 8]

Q10) Select the correct options to copy a list:

list1 = ['a', 'b', 'c', 'd']

a) newList = list1
b) newList.copy(list1)
c) newList = copy(list1)
d) newList = list1.copy()

View Answer Answer:- d) newList = list1.copy()

Also See:- Python Data Types MCQ

Leave a Comment

Your email address will not be published. Required fields are marked *