Chapter 10 · Class 11 · CBSE · Science Computer Science
Tuples and Dictionaries
25 practice questions · 5 marks weightage
Topics in this chapter
- Tuple Structure and Operations
- Tuple Mutability and Hashability
- Dictionary Construction and Updates
- Dictionary Access and Traversal
- Dictionary Semantics and Applications
Cheat sheet
Cheat SheetPractice questions
- Question 1Q-663C98See the answer and solution
Consider the following Python code: d = {"a": 1, "b": 2}; d["a"] = d["b"]. What will be the value of d after execution?
- A.{"a": 1, "b": 2}
- B.{"a": 2, "b": 2}
- C.{"a": 2, "b": 1}
- D.{"a": 1, "b": 1}
- Question 2Q-506693See the answer and solution
Explain why t = (1, 2, [3, 4]) allows t[2].append(5) but does not allow t[2] = [3, 4, 5].
- Question 3Q-0FB868See the answer and solution
What is printed by the following Python code? d = {"a": 10, "b": 20}; d["c"] = d.pop("a"); print(d["c"], len(d))
- A.10 2
- B.20 3
- C.10 3
- D.a 2
- Question 4Q-27EFC4See the answer and solution
Why can a tuple sometimes be used as a dictionary key while a list cannot? Give one valid tuple-key example and one invalid list-key example.
- Question 5Q-C01B21See the answer and solution
What is printed by the following Python code? t = (4, 7, 9, 7); print(t.index(7), t.count(7))
- A.0 2
- B.1 2
- C.1 1
- D.2 1
20 more questions on Tuples and Dictionaries
Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed