MCQ on Tuple in Python – 3

Q1) Find the output of the given Python program?

tupl = ("annie","hena","sid")
print(tupl[-3:0])

a) (“annie”)
b) ()
c) None
d) Error as slicing is not possible in tuple.

View Answer Answer:- b) ()

Q2) Find the output of the given Python program?

t = (5, 4, 3, 2, 1)
x = [t[i] for i in range(0, len(t), 2)]
print(x)

a) (4, 2)
b) (3, 2, 1)
c) (5, 3, 1)
d) (5, 4, 3, 2, 1)

View Answer Answer:- c) (5, 3, 1)

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

my_tuple = (9,8,7,6,5)
x = my_tuple.append(3,2)
print(x)

a) (9, 8, 7, 6, 5, (3, 2))
b) (9, 8, 7, 6, 5, 3, 2)
c) (3, 2)
d) Error

View Answer Answer:- d) Error

Q4) Find the output of the given Python program?

t1 = (1,2)
t2 = (2,1)
x = (t1 == t2)
print(x)

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

View Answer Answer:- b) False

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

t1 = (1,2,3,4,5)
t2 = (5,4,3,2,1)
print(t1<t2)

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

View Answer Answer:- a) True

Q6) Find the output of the given Python program?

t1 = (1,2,3,(4,5))
t2 = (3,2,1,(4,5))
print(t1>t2)

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

View Answer Answer:- b) False

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

t1 = (1, 2)
t2 = (1.0, 2.0)
x = (t1 == t2)
print(x)

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

View Answer Answer:- a) True

Q8) Which of the following options will not result in an error when performed on tuples in Python where tupl=(5,2,7,0,3)?

a) tupl1=tupl+tupl
b) tupl.sort()
c) tupl[1]=2
d) tupl.append(2)

View Answer Answer:- a) tupl1=tupl+tupl

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

t1 = (1,2,3)
t2 = (4,5,6)
x = t1+t2
print(x)

a) (1, 2, 3, 4, 5, 6)
b) (1, 4, 2, 5, 3, 6)
c) (1, 2, 3) (4, 5, 6)
d) Error

View Answer Answer:- a) (1, 2, 3, 4, 5, 6)

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

x,y = 1,2
x,y = y,x
print(x,y)

a) (1, 2)
b) (2, 1)
c) None
d) Error

View Answer Answer:- b) (2, 1)

Q11) Find the output of the given Python program?

x,y = 1,2
x,y = y,x
print(y,x)

a) (1, 2)
b) (2, 1)
c) None
d) Error

View Answer Answer:- a) (1, 2)

Also See:- Python Pandas MCQ

Leave a Comment

Your email address will not be published.