Worksheets › Class 11 › Tuples and Dictionaries
Class 11 · Computer Science worksheetTuples and Dictionaries
CBSE Computer Science. Tuple operations, one-item tuples, tuple assignment, dictionary access, methods and traversal, counting with a dictionary. Every sheet has 20 questions in three sections and an answer key, and the questions change every time.
Sample questions
Real questions from this chapter, as the app sets them. Tap Answer to see the answer and working.
Section A · multiple choice
- 1.
A tuple is:
- a set of key–value pairs
- an unordered collection
- a sequence that can be changed in place
- an ordered sequence that cannot be changed after it is made
Answer
(d) an ordered sequence that cannot be changed after it is made
- 2.
What does this program print? t = (57, 15, 39, 40, 36, 27) print(t[4:6])
- [36, 27]
- 36
- (27, 36)
- (36, 27)
Answer
(d) (36, 27)
a slice of a tuple is a tuple; a one-item tuple prints with a comma
- 3.
What does this program print? t = (52,) print(t * 2)
- [52, 52]
- (52, 52)
- 104
- (52,)
Answer
(b) (52, 52)
* repeats the tuple
Section B · short answer
- 4.
Give two differences between a list and a tuple.
Answer
A list is mutable and written in [ ]; a tuple is immutable and written in ( ); tuples can be dictionary keys and are a little faster.
- 5.
What does this program print? Give (a) the first line (b) the second. t1 = (26, 17) t2 = (42, 37) print(t1 + t2) print(len(t1 * 2 + t2))
Answer
(a) (26, 17, 42, 37); (b) 6
+ joins tuples into a new tuple; * repeats
Section C · long answer
- 6.
Write a program to make a dictionary of employees and their salaries, and print the names of those earning more than a given amount.
Answer
sal = {'Asha': 30000, …}; for name in sal: if sal[name] > limit: print(name).
Fresh sheets for your child
In the app, every Tuples and Dictionaries sheet is new: the app remembers the questions your child has already had and leaves them out. Print the sheet as a PDF, or use notebook mode and write the answers in a notebook.
Coming soon for Android and iPhone.