Worksheets › Class 11 › Tuples and Dictionaries

Class 11 · Computer Science worksheet

Tuples 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.

Open a printable sample sheet

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. 1.

    A tuple is:

    1. a set of key–value pairs
    2. an unordered collection
    3. a sequence that can be changed in place
    4. 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. 2.

    What does this program print? t = (57, 15, 39, 40, 36, 27) print(t[4:6])

    1. [36, 27]
    2. 36
    3. (27, 36)
    4. (36, 27)
    Answer

    (d) (36, 27)

    a slice of a tuple is a tuple; a one-item tuple prints with a comma

  3. 3.

    What does this program print? t = (52,) print(t * 2)

    1. [52, 52]
    2. (52, 52)
    3. 104
    4. (52,)
    Answer

    (b) (52, 52)

    * repeats the tuple

Section B · short answer

  1. 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.

  2. 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

  1. 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.

More Class 11 Computer Science