# Is the following Python code valid >>> a=(1,2,3) >>> b=a.update(4,)

1.  Yes, a=(1,2,3,4) and b=(1,2,3,4)

2.  Yes, a=(1,2,3) and b=(1,2,3,4)

3.  No because tuples are immutable

4.  No because wrong syntax for update() method

4

No because tuples are immutable

Explanation :
No Explanation available for this question

# What will be the output of the following Python code >>> a=[(2,4),(1,2),(3,9)] >>> a.sort() >>> a

1.  [(1, 2), (2, 4), (3, 9)]

2.  [(2,4),(1,2),(3,9)]

3.  Error because tuples are immutable

4.  Error, tuple has no sort attribute

4

[(1, 2), (2, 4), (3, 9)]

Explanation :
No Explanation available for this question

# Which of these about a set is not true

1.  Mutable data type

2.  Allows duplicate values

3.  Data type with unordered values

4.  Immutable data type

4

Immutable data type

Explanation :
No Explanation available for this question

# Which of the following is not the correct syntax for creating a set

1.  set([[1,2],[3,4]])

2.  set([1,2,2,3,4])

3.  set((1,2,3,4))

4.  {1,2,3,4}

4

set([[1,2],[3,4]])

Explanation :
No Explanation available for this question

# What will be the output of the following Python code nums = set([1,1,2,3,3,3,4,4]) print(len(nums))

1.  7

2.  Error, invalid syntax for formation of set

3.  4

4.  8

4

4

Explanation :
No Explanation available for this question

# What will be the output of the following Python code a = [5,5,6,7,7,7] b = set(a) def test(lst): if lst in b: return 1 else: return 0 for i in filter(test, a): print(i,end=" ")

1.  5 5 6

2.  5 6 7

3.  5 5 6 7 7 7

4.  5 6 7 7 7

4

5 5 6 7 7 7

Explanation :
No Explanation available for this question

# Which of the following statements is used to create an empty set

1.  { }

2.  set()

3.  [ ]

4.  ( )

4

set()

Explanation :
No Explanation available for this question

# What will be the output of the following Python code >>> a={5,4} >>> b={1,2,4,5} >>> a

1.  {1,2}

2.  True

3.  False

4.  Invalid operation

4

True

Explanation :
No Explanation available for this question

# If a={5,6,7,8}, which of the following statements is false

1.  print(len(a))

2.  print(min(a))

3.  a.remove(5)

4.  a=45

4

a=45

Explanation :
No Explanation available for this question

# If a={5,6,7}, what happens when a.add(5) is executed

1.  a={5,5,6,7}

2.  a={5,6,7}

3.  Error as there is no add function for set data type

4.  Error as 5 already exists in the set

4