Tag: Tuples
-
Python Questions and Answers – Tuples-3
Python Multiple Choice Questions & Answers (MCQs) focuses on “Tuples – 3”. Q 1. Is the following Python code valid? >>> a,b,c=1,2,3>>> a,b,cA. Yes, [1,2,3] is printedB. No, invalid syntaxC. Yes, (1,2,3) is printedD. 1 is printed Show Answer Answer:-C. Yes, (1,2,3) is printed Explanation A tuple needn’t be enclosed in parenthesis. Q 2. What…
-
Python Multiple Choice Questions – Tuples
Python Multiple Choice Questions & Answers (MCQs) focuses on “Tuples”. Q 1. Which of the following is a Python tuple?A. [1, 2, 3]B. (1, 2, 3)C. {1, 2, 3}D. {} Show Answer Answer:-B. (1, 2, 3) Explanation Tuples are represented with round brackets. Q 2. Suppose t = (1, 2, 4, 3), which of the…
-
Python Questions and Answers – Tuples – 2
Python Multiple Choice Questions & Answers (MCQs) focuses on “Tuples – 2”. Q 1. What is the data type of (1)?A. TupleB. IntegerC. ListD. Both tuple and integer Show Answer Answer:-B. Integer Explanation A tuple of one element must be created as (1,). Q 2. If a=(1,2,3,4), a[1:-1] is _________A. [2,3]B. (2,3)C. (2,3,4)D. Error, tuple…