Data Structure Quiz 02

Python Data Structures Quiz

Python Data Structures Quiz

Test your Python data structures knowledge with multiple-choice questions:

Time Remaining: 03:20

1. Which of the following are mutable in Python? (Select all that apply)

A) List B) Tuple C) Set D) String

2. Which methods can be used to add items to a list? (Select all that apply)

A) append() B) insert() C) add() D) extend()

3. Which of these are characteristics of a tuple? (Select all that apply)

A) Mutable B) Immutable C) Ordered D) Unordered

4. Which of the following are key-value pair data structures? (Select all that apply)

A) List B) Dictionary C) Set D) None of the above

5. Which operations are available for sets in Python? (Select all that apply)

A) Union B) Intersection C) Difference D) Concatenation

6. How can you access the last item in a list? (Select all that apply)

A) list[-1] B) list[len(list) - 1] C) list[-2] D) list[0]

7. Which functions return a copy of a list? (Select all that apply)

A) list.copy() B) list() C) sorted(list) D) list[:]

8. Which statements are correct for Python dictionaries? (Select all that apply)

A) Keys must be unique B) Values must be unique C) Dictionaries are unordered D) Keys can be mutable

9. Which of these are valid ways to create a set? (Select all that apply)

A) set([1, 2, 3]) B) {1, 2, 3} C) {1: "one", 2: "two"} D) set()

10. Which of these methods can remove items from a list? (Select all that apply)

A) remove() B) pop() C) delete() D) clear()