/  Python-Tuples-Quiz

This Quiz contains totally 10 Questions each carry 1 point for you.

1.What will be the output of the following Python code?
t=(a,b,c,d)
t[1:3]
(a, b)
(a, b, d)
(b, c)
(b, d, c)

Correct!

Wrong!

2.Select the right way to access value 20 from the following tuple
aTuple = ("Orange", [10, 20, 30], (5, 15, 25))
aTuple[1:2][1]
aTuple[1:2](1)
aTuple[1:2][:1]
aTuple[1][1]

Correct!

Wrong!

3.Choose the correct option with respect to Python
Both tuples and lists are immutable.
Tuples are immutable while lists are mutable.
Both tuples and lists are mutable.
Tuples are mutable while lists are immutable.

Correct!

Wrong!

4.What will be the output of below Python code?
tuple1=(5,1,7,6,2)
tuple1.pop(2)
print(tuple1)
Error
(5,1,6,2)
(5,1,7,6)
(5,1,7,6,2)

Correct!

Wrong!

5.What is the data type of (1)?
Tuple
Integer
List
Both tuple and integer

Correct!

Wrong!

6.What will be the output of the following Python code?
a=("Check")*3
a
(‘Check’,’Check’,’Check’)
* Operator not valid for tuples
(‘CheckCheckCheck’)
Syntax error

Correct!

Wrong!

7.What is the output of the following code
aTuple = (100, 200, 300, 400, 500)
print(aTuple[-2])
print(aTuple[-4:-1])
IndexError: tuple index out of range
400; (200, 300, 400)
200; (500, 400, 300)
400; (400, 300, 200)

Correct!

Wrong!

8.Is the following Python code valid?

a,b=1,2,3

 
Yes, this is an example of tuple unpacking. a=1 and b=2
Yes, this is an example of tuple unpacking. a=(1,2) and b=3
Yes, this is an example of tuple unpacking. a=1 and b=(2,3)
No, too many values to unpack

Correct!

Wrong!

9.What is the output of the following program?
tuple1 = (1, 2, 4, 3) 
tuple2 = (1, 2, 3, 4)
print(tuple1 < tuple2)
Error
True
False
Unexpected

Correct!

Wrong!

10.What is the output of the following program?
tuple = (1, 2, 3) 
print(2 * tuple)
(1, 2, 3, 1, 2, 3)
(1, 2, 3, 4, 5, 6)
(3, 6, 9)
Error

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

Python-Tuples-Quiz

You got %%score%% of %%total%% right

%%description%%

%%description%%

Where to go ?

Quizzes

Loading...