Which of the following is a Python Tuple?

(A) (7, 8, 9)
(B) [7, 8, 9]
(C) {}
(D) {7, 8, 9}

Correct Answer: (A). (7, 8, 9)

Python program to Create a Tuple

Output

()
(4, 5, 9)
(1, ‘Hello’, 3.4)
(‘T4Tutorials’, [3, 1, 6], (7, 8, 2))


Which of the following are legal Python Tuples?

(A). a tuple with mixed datatypes

(B). nested tuple

(C). (4, 5, 9)

(D). All of these

Correct Answer: (D). All of these


Which of the following operator is used to access an item in a tuple, where the index starts from 0?

(A). [ ]

(B). ( )

(C). { }

(D). None of these

Correct Answer: (A). [ ]

Computer Science MCQs