15 extra multiple-choice questions for Lists, Tuples, Sets and Dictionary (12th Standard Computer Science, Samacheer Kalvi), beyond the ones printed in the textbook — each with the correct option highlighted and a clear, worked explanation. Free to read in English and Tamil.
Q1
Which of the following Python methods can be used to duplicate all items of a list into a new list without modifying the original list?
- A. list.dup()
- B. list.copy()Correct
- C. list.clone()
- D. list.backup()
Explanation. The copy() method of a list returns a shallow copy of the list. This duplicates all elements into a new list object without altering the original list.
Q2
If a Python list is defined as MyList = [2, 10, 15, 20, 10], what will be the output of MyList.index(10)?
- A. 1Correct
- B. 4
- C. 0
- D. 2
Explanation. The index() function returns the index of the first occurrence of the specified element in the list. Here, the first 10 is found at index 1.
Q3
In Python, creating a tuple with a single element is called a "Singleton" tuple. Which of the following is the correct way to define a singleton tuple with the value 50?
- A. T = (50)
- B. T = 50
- C. T = (50,)Correct
- D. T = [50]
Explanation. In Python, a tuple with a single element must include a trailing comma (like (50,)) so that Python identifies it as a tuple rather than an integer in parentheses.
Q4
Which of the following statement is true regarding the execution speed of iterating over Tuples compared to Lists in Python?
- A. Iterating lists is faster than tuples.
- B. Iterating tuples is faster than lists.Correct
- C. Both have identical iteration speeds.
- D. Iterating speed depends only on the length, not the data type.
Explanation. Tuples are immutable and have a fixed structure in memory. This makes iterating over a tuple faster than iterating over a mutable list.
Q5
Consider the Python expression: S = [x**3 for x in range(1, 5) if x % 2 == 0]. What will be the final contents of the list S?
- A. [1, 8, 27, 64]
- B. [8, 64]Correct
- C. [1, 27]
- D. [2, 4]
Explanation. The range is from 1 to 4. The condition x % 2 == 0 filters out odd numbers, leaving 2 and 4. The expression x**3 calculates their cubes, resulting in [8, 64].
Q6
What will be the output when the following Python code is executed?
S1 = {10, 20, 30}
S2 = {20, 30, 40}
print(S1 ^ S2)
- A. {20, 30}
- B. {10, 40}Correct
- C. {10, 20, 30, 40}
- D. {10, 20, 30}
Explanation. The caret ^ operator represents symmetric difference. It includes all elements that are in either of the sets, but not in their intersection, yielding {10, 40}.
Q7
Which Python list function removes all the elements of a list but retains the empty list structure itself?
- A. remove()
- B. pop()
- C. clear()Correct
- D. del
Explanation. The clear() function deletes all elements in a list, leaving the list object empty, whereas del can completely destroy the list variable from memory.
Q8
What is the output of the following dictionary deletion operation?
Dict = {'Reg_No': '1221', 'Name': 'Tamilselvi'}
Dict.clear()
print(Dict)
- A. None
- B. {'Reg_No': '', 'Name': ''}
- C. {}Correct
- D. NameError: name 'Dict' is not defined
Explanation. The clear() method of a dictionary removes all its key-value pairs, resulting in an empty dictionary {} without deleting the dictionary object itself.
Q9
Which of the following set operations is correctly paired with its corresponding Python operator?
- A. Union: &
- B. Intersection: |
- C. Difference: -Correct
- D. Symmetric Difference: *
Explanation. In Python, set union uses |, intersection uses &, set difference uses -, and symmetric difference uses ^. Therefore, difference is correctly paired with -.
Q10
If a Python list is Numbers = [10, 20, 30, 40, 50], what will be the result of the slice operation Numbers[-3:-1]?
- A. [30, 40, 50]
- B. [30, 40]Correct
- C. [20, 30, 40]
- D. [40, 50]
Explanation. The slice -3:-1 starts at index -3 (value 30) and goes up to, but excludes, index -1 (value 50). This results in the list [30, 40].
Q11
Which of the following statement is correct about dictionary keys in Python?
- A. Keys must be enclosed in square brackets and can be duplicated.
- B. Keys can be duplicated and are case-insensitive.
- C. Keys must be unique, are case-sensitive, and can be of any valid Python type.Correct
- D. Keys can only be integer values starting from zero.
Explanation. Keys in Python dictionaries must be unique and are case-sensitive. Unlike list indices, they do not have to be sequential integers and can be any valid immutable type.
Q12
What will be stored in x after executing the following Python code?
MyTuple = (10, 20, 30)
x = MyTuple + (40,)
- A. (10, 20, 30, 40)Correct
- B. (10, 20, 30, 40,)
- C. (10, 20, 30, (40,))
- D. TypeError: can only concatenate tuple to tuple
Explanation. In Python, you can join two tuples using the + operator. Since (40,) is a valid singleton tuple, they are successfully concatenated into (10, 20, 30, 40).
Q13
Which Python function can convert a List or a Tuple into a Set, thereby eliminating duplicate elements?
- A. to_set()
- B. set()Correct
- C. unique()
- D. cast_set()
Explanation. The built-in set() function takes an iterable (like a list or tuple) as an argument and returns a new set object containing its unique elements, removing duplicates.
Q14
What is the correct output when the following Python code is run?
list1 = [5] * 3
print(list1)
- A. [15]
- B. [5, 5, 5]Correct
- C. [[5], [5], [5]]
- D. TypeError: unsupported operand type for *
Explanation. Multiplying a list by an integer n repeats the list elements n times. Thus, [5] * 3 repeats the element 5 three times, producing [5, 5, 5].
Q15
Consider the following dictionary comprehension: Dict = {x: x * x for x in range(1, 4)}. What is the value of Dict[3]?
- A. 3
- B. 6
- C. 9Correct
- D. 1
Explanation. The dictionary comprehension generates {1: 1, 2: 4, 3: 9}. Accessing Dict[3] retrieves the value mapped to key 3, which is 9.