Is the following Python code valid >>> a=(1,2,3) >>> b=('A','B','C') >>> c=tuple(zip(a,b))

1.  Yes, c will be ((1, ‘A’), (2, ‘B’), (3, ‘C’))

2.  Yes, c will be ((1,2,3),(‘A’,’B’,’C’))

3.  No because tuples are immutable

4.  No because the syntax for zip function isn’t valid

4

Yes, c will be ((1, ‘A’), (2, ‘B’), (3, ‘C’))

Explanation :
No Explanation available for this question

Is the following Python code valid >>> a,b,c=1,2,3 >>> a,b,c

1.  Yes, [1,2,3] is printed

2.  No, invalid syntax

3.  Yes, (1,2,3) is printed

4.  1 is printed

4

Yes, (1,2,3) is printed

Explanation :
No Explanation available for this question

What will be the output of the following Python code a = ('check',) n = 2 for i in range(int(n)): a = (a,) print(a)

1.  Error, tuples are immutable

2.  (('check',),)((('check',),),)

3.  ((‘check’,)’check’,)

4.  (('check',)’check’,)((('check',)’check’,)’check’,)

4

(('check',),)
((('check',),),)

Explanation :
No Explanation available for this question

Is the following Python code valid >>> a,b=1,2,3

1.  Yes, this is an example of tuple unpacking. a=1 and b=2

2.  Yes, this is an example of tuple unpacking. a=(1,2) and b=3

3.  No, too many values to unpack

4.  Yes, this is an example of tuple unpacking. a=1 and b=(2,3)

4

No, too many values to unpack

Explanation :
No Explanation available for this question

What will be the output of the following Python code >>> a=(1,2) >>> b=(3,4) >>> c=a+b >>> c

1.  (4,6)

2.  (1,2,3,4)

3.  Error as tuples are immutable

4.  None

4

(1,2,3,4)

Explanation :
No Explanation available for this question

What will be the output of the following Python code >>> a,b=6,7 >>> a,b=b,a >>> a,b

1.  (6,7)

2.  Invalid syntax

3.  (7,6)

4.  Nothing is printed

4

(7,6)

Explanation :
No Explanation available for this question

What will be the output of the following Python code >>> import collections >>> a=collections.namedtuple('a',['i','j']) >>> obj=a(i=4,j=7) >>> obj

1.  a(i=4, j=7)

2.  obj(i=4, j=7)

3.  (4,7)

4.  An exception is thrown

4

a(i=4, j=7)

Explanation :
No Explanation available for this question

Tuples can’t be made keys of a dictionary.

1.  True

2.  False

2

False

Explanation :
No Explanation available for this question

Is the following Python code valid >>> a=2,3,4,5 >>> a

1.  Yes, 2 is printed

2.  Yes, [2,3,4,5] is printed

3.  No, too many values to unpack

4.  Yes, (2,3,4,5) is printed

4

Yes, (2,3,4,5) is printed

Explanation :
No Explanation available for this question

What will be the output of the following Python code >>> a=(2,3,1,5) >>> a.sort() >>> a

1.  (1,2,3,5)

2.  (2,3,1,5)

3.  None

4.  Error, tuple has no attribute sort

4