Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views1 page

Tuples Assign

The document consists of questions related to tuples in programming, covering topics such as immutability, tuple length, slicing, and differences between tuples and lists. It includes very short answer questions, short answer questions, and skill-based programming tasks. The skill-based questions focus on creating and manipulating tuples, including operations like adding elements and calculating averages.

Uploaded by

aksharabhandari6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Tuples Assign

The document consists of questions related to tuples in programming, covering topics such as immutability, tuple length, slicing, and differences between tuples and lists. It includes very short answer questions, short answer questions, and skill-based programming tasks. The skill-based questions focus on creating and manipulating tuples, including operations like adding elements and calculating averages.

Uploaded by

aksharabhandari6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Chapter – TUPLES

Very Short answer Type Questions

Q.1 What do you understand by immutability?

Q.2 What is the length of the tuple shown below?

T = ((((„a‟, 1), ‟b‟, ‟c‟), ‟d‟, 2), ‟e‟, 3)

Q.3 If a is (1, 2, 3), what is the difference (if any) between a*3 and [a, a, a]?

Q.4 If a is (1, 2, 3), is a *3 equivalent to a + a + a?

Q.5 If a is (1, 2, 3), what is the meaning of a [1:1] = 9?

Q.6 If a is (1, 2, 3), what is the meaning of a [1:2] = 4 and a [1:1] = 4?

Q.7 Does a slice operator always produce a new Tuple?

Q.8 How is an empty Tuple created?

Q.9 How is a tuple containing just one element created?

Q.10 What is the difference between (30) and (30,)?

Short Answer Type Questions

Q.1 How are Tuples different from Lists when both are sequences?

Q.2 Can tuples be nested?

Q.3 Discuss the utility and significance of Tuples. Q.6 How can you add an

extra element to a tuple?

Q.7 Find out the output generated by following code fragments:

(a) plane = (“Passengers”, ”Luggage”)

plane [1] = “Snakes”

(b) (a, b, c) = (1,2,3) (c) (a, b, c, d) = (1,2,3)

(d) a, b, c, d = (1,2,3) (e) a, b, c, d, e = (p, q, r, s, t) = t1

Skill Based Questions

Q.1 WAP that creates a tuple storing first 9 items of Fibonacci Series.

Q.2 WAP that creates a third tuple after adding two tuples. Add second after

first tuple.

Q.3 WAP to calculate the mean of the numbers of the tuple.

Q.4 WAP to calculate the average of the numbers of the tuple.

Q5 WAP to combine first 3 elements and last 3 elements from a tuple

If t1=(1,2,4,”a”,6,8,9, “y”,7,”L”)

Output

(1,2,4,”y”,7,”L”)

You might also like