Class 11 Computer Science: Lists and Dictionaries
This worksheet tests your understanding of Python lists and dictionaries, covering creation, manipulation, and access methods. It includes multiple-choice, fill-in-the-blanks, and short answer questions.
Class 11CBSEComputer SciencemediumPractice
Preview · 10 questions
- Q1. Which of the following is an ordered collection of items, enclosed in square brackets, and mutable?
- Tuple
- Set
- List
- Dictionary
- Q2. What will be the output of the following Python code snippet? `my_list = [10, 20, 30] my_list.append(40) print(my_list)`
- [10, 20, 30, 40]
- [40, 10, 20, 30]
- [10, 20, 30]
- Error
- Q3. Dictionary keys must be '_____' and unique.
- Q4. Which method is used to remove a specific item from a list by its value?
- pop()
- del
- remove()
- clear()
- Q5. What is the correct way to access the value associated with the key 'city' from the dictionary `my_dict = {'name': 'Alice', 'age': 30, 'city': 'New York'}`?
- my_dict['city']
- my_dict.get('city')
- Both A and B
- my_dict('city')
+ 5 more in the printable PDF.