VITyarthi Python Essentials Module 7 Quiz Answer

Question 1

Let list1 =[1,2,3,4,5,6]. How to access the last element?

  1. list1[-1]
  2. list1[5]
  3. Both
  4. None
  1. list1[-1]

Question 2

Let list1 =[1,2,3,4,5,6]. What is the output of list1[:2]

[1, 2]

Question 3

Let list1 =[1,2,3,4,5,6]. What is the output of list1[-4:-1]

[3, 4, 5]

Question 4

A Tuple is immutable: Say True or False

  1. True
  2. False
  1. True

Question 5

Which are all applicable statements to tuple data structure?

  1. We can’t add/delete elements to/from a tupleTuples are faster than lists.
  2. Tuples are useful for secured data transfer.
  3. All the above

3. All the above

Question 6

What will be the output of the following Python code? t=(10,20,40,30) print(t[1:-1])

[20, 40]

Question 7

What will be the output of the following Python code? t = (10, 20) 2 * t

(10, 20, 10, 20)

Question 8

Will the given Python code get executed? trial = (10, 20, 30, 40) trial.append( (5, 6, 7) ) print(len(trial))

  1. True
  2. False

2. False

Question 9

1. 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

Question 10

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

  1. set([[10,20],[30,40]])
  2. set([10,20,20,30,40])
  3. set((10,20,30,40))
  4. {10,20,30,40}

set([[10,20],[30,40]])

Question 11

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

  1. { }
  2. set()
  3. [ ]
  4. ( )

2. set()

Question 12

Which of the following command is used to find the number of entries in the given dictionary? dic = {“course”:”Python”, “year”:2021}

  1. dic.size()
  2. len(dic)
  3. size(dic)
  4. dic.len()

2. len(dic)

Question 13

Which one of the following is correct?

  1. In Python, a dictionary can have two same keys with different values.
  2. In Python, a dictionary can have two same values with different keys
  3. In Python, a dictionary can have two same keys or same values but cannot have two same key-value pair
  4. In python, a dictionary can neither have two same keys nor two same values.

3. In Python, a dictionary can have two same keys or same values but cannot have two same key-value pair

Question 14

Which of these about a frozenset is not true?

  1. Mutable data type
  2. Allows duplicate values
  3. Data type with unordered values
  4. Immutable data type
  1. Mutable data type

If you find anything wrong in this Answer Key, feel free to reach us in the comment section.

Sharing Is Caring:

Leave a Comment