Chapter 4 Working with Lists and Dictionaries — Online MCQ Test
INFORMATICS PRACTICES · Grade 11 · CBSE(NCERT)
Practice Chapter 4 Working with Lists and Dictionaries with a free chapter-wise online MCQ test.
This chapter covers: Explains Python collection data types including lists and dictionaries. Covers creating and modifying collections indexing slicing traversal built-in methods nested structures muta....
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter 4 Working with Lists and Dictionaries — Important Questions & Answers
Which of the following is a Python list?
- A. (1, 2, 3)
- B. [1, 2, 3]
- C. {1, 2, 3}
- D. "1, 2, 3"
Answer: B. [1, 2, 3]
Square brackets are used to create a list in Python. Lists are ordered and mutable.
Square brackets are used to create a list in Python. Lists are ordered and mutable.
Which data type in Python stores key-value pairs?
- A. list
- B. tuple
- C. dictionary
- D. string
Answer: C. dictionary
A dictionary stores data in key-value pairs. It is useful for fast lookup using keys.
A dictionary stores data in key-value pairs. It is useful for fast lookup using keys.
What is the output of: print([1, 2, 3][1])?
- A. 1
- B. 2
- C. 3
- D. Error
Answer: B. 2
Index 1 refers to the second element in the list, which is 2.
Index 1 refers to the second element in the list, which is 2.
What will be the output of: nums = [5, 10, 15] nums[1] = 20 print(nums)
- A. [5, 10, 15]
- B. [5, 20, 15]
- C. [20, 10, 15]
- D. Error
Answer: B. [5, 20, 15]
Lists are mutable, so the value at index 1 can be changed.
Lists are mutable, so the value at index 1 can be changed.
What will be the output of: d = {'a': 1} d['b'] = d.get('a', 0) + 5 print(d)
- A. {'a': 1, 'b': 5}
- B. {'a': 1, 'b': 6}
- C. {'a': 5, 'b': 1}
- D. Error
Answer: B. {'a': 1, 'b': 6}
d.get('a', 0) returns 1, so 'b' gets the value 6.
d.get('a', 0) returns 1, so 'b' gets the value 6.