Class 11 Computer Science Chapter 10 Question Bank CBSE Board Pattern

Section A — MCQs (10 questions, 1 mark each)

1. Which of the following is the correct way to create a tuple containing a single element 20?
(a) tuple1 = (20)
(b) tuple1 = 20
(c) tuple1 = (20,)
(d) tuple1 = [20]

2. What will be the output of the following code?
python tuple1 = (10, 20, 30, 40, 50) print(tuple1[2:5])
(a) (10, 20, 30)
(b) (30, 40, 50)
(c) (20, 30, 40)
(d) Error

3. Tuples are immutable. This means:
(a) Elements can be changed after creation
(b) Elements cannot be changed after creation
(c) Only the last element can be changed
(d) Tuples can store only integers

4. Which operator is used to repeat the elements of a tuple?
(a) +
(b) *
(c) in
(d) /

5. Assertion (A): tuple1 = (1, 2, 3) followed by tuple1[1] = 10 will raise a TypeError.
Reason (R): Tuples are immutable, so item assignment is not supported.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

6. What does tuple1.count(10) return when tuple1 = (10, 20, 30, 10, 40, 10)?
(a) 1
(b) 2
(c) 3
(d) 0

7. Assertion (A): A sequence without parentheses such as seq = 1, 2, 3 is treated as a tuple by default.
Reason (R): Python automatically creates a tuple when comma-separated values are assigned without parentheses.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

8. Which method returns a new sorted list from the elements of a tuple without modifying the original tuple?
(a) sort()
(b) sorted()
(c) index()
(d) min()

9. What will be the output of 'Green' in ('Red', 'Green', 'Blue')?
(a) True
(b) False
(c) Error
(d) None

10. Which of the following correctly creates a dictionary?
(a) dict1 = {1, 2, 3}
(b) dict1 = [1: 'One', 2: 'Two']
(c) dict1 = {1: 'One', 2: 'Two'}
(d) dict1 = (1: 'One', 2: 'Two')


Section B — Very Short Answer (6 questions, 2 marks each)

1. Define a tuple. How is a single-element tuple created? Give an example.

2. Differentiate between list and tuple with respect to mutability.

3. What is the output of the following code? Explain briefly.
python tuple1 = (5, 10, 15, 20) print(tuple1[-2])

4. What is tuple concatenation? Give an example using the + operator.

5. Write the output of the following:
python tuple1 = (10, 20, 30, 10, 40) print(tuple1.count(10)) print(tuple1.index(30))

6. What is the difference between dict.keys() and dict.values()? Give one example.


Section C — Short Answer (5 questions, 3 marks each)

1. Write the output of the following code and explain:
python tuple1 = (1, 2, 3, 4, 5) tuple2 = (6, 7) print(tuple1 + tuple2) print(tuple1 * 2)

2. Identify the error in the following code and write the corrected version:
python tuple1 = (20) print(type(tuple1))

3. Explain tuple slicing with any two examples using negative indexing and step size.

4. Write the output of the following code fragment:
python dict1 = {'Mohan': 95, 'Ram': 89, 'Suhel': 92} dict1['Meena'] = 78 dict1['Ram'] = 90 print(dict1) print(len(dict1))

5. What will be the output? Also state why the original tuple remains unchanged.
python tuple1 = (19, 12, 56, 18, 9) print(sorted(tuple1)) print(tuple1)


Section D — Long Answer (3 questions, 5 marks each)

1. Write a complete Python program to input n numbers from the user, store them in a tuple, and print the maximum and minimum number from the tuple. (Use concepts of tuple creation and built-in functions max() and min().)

2. Explain tuple assignment with the help of an example. Also show what happens when the number of variables on the left side does not match the number of elements on the right side.

3. Perform a dry-run of the following program using a trace table and show the final output:
python numbers = () n = 4 for i in range(n): num = int(input()) numbers = numbers + (num,) print(max(numbers)) print(min(numbers)) (Assume inputs: 9, 3, 12, 7)


Section E — Case/Source-Based (2 questions, 4 marks each)

Case 1: A school wants to store roll number, name and marks of students using a nested tuple. The structure is:
st = ((101, "Aman", 98), (102, "Geet", 95), (103, "Sahil", 87))

Sub-questions:

(a) How many students’ records are stored?
(b) Write the statement to print the name of the second student.
(c) Write a loop to display all records in tabular form (S_No, Roll_No, Name, Marks).
(d) What will be printed by st[1][2]?

Case 2: A dictionary employee = {} is created to store employee names as keys and salaries as values.

Sub-questions:

(a) Write statements to add two employees: “Tarun” with salary 12000 and “Amina” with salary 34000.
(b) Write the code to display all employee names and salaries using a for loop.
(c) Write the statement to check whether “Rahul” is present in the dictionary.
(d) What does employee.update({'Zoya': 25000}) do?


Answer Key Attempt all questions first,
then tap to reveal

Section A

  1. (c)
  2. (b)
  3. (b)
  4. (b)
  5. (a)
  6. (c)
  7. (a)
  8. (b)
  9. (a)
  10. (c)

Section B

  1. Tuple is an ordered sequence of elements of different data types enclosed in parentheses. Single-element tuple: t = (20,) (comma is necessary).
  2. List is mutable; tuple is immutable.
  3. Output: 15 (negative index -2 accesses second element from the end).
  4. Concatenation joins two tuples using + and creates a new tuple. Example: (1,2) + (3,4)(1, 2, 3, 4).
  5. 3 and 2 (count returns occurrences; index returns first position).
  6. keys() returns all keys; values() returns all values. Example: dict1.keys() gives dict_keys(['Mohan', 'Ram']).

Section C

  1. Output:
    (1, 2, 3, 4, 5, 6, 7)
    (1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
    (+ concatenates; * repeats the tuple).

  2. Error: tuple1 is treated as int. Corrected:
    python tuple1 = (20,) print(type(tuple1))

  3. Examples: tuple1[-3:] and tuple1[::2].

  4. Output:
    {'Mohan': 95, 'Ram': 90, 'Suhel': 92, 'Meena': 78}
    4

  5. Output:
    [9, 12, 18, 19, 56]
    (19, 12, 56, 18, 9)
    (sorted() returns a new list; original tuple is unchanged due to immutability.

Section D

  1. Complete program (see Program 10-4 style):
    python numbers = tuple() n = int(input("How many numbers? ")) for i in range(n): num = int(input()) numbers = numbers + (num,) print("Maximum:", max(numbers)) print("Minimum:", min(numbers))

  2. Tuple assignment example: (num1, num2) = (10, 20). Mismatch raises ValueError: not enough values to unpack.

  3. Trace table shows successive addition of inputs 9, 3, 12, 7. Final output:
    12
    3

Section E

Case 1

(a) 3
(b) st[1][1]
(c) Use for loop with len(st) and indexing as in Program 10-1.
(d) 95

Case 2

(a) employee['Tarun'] = 12000; employee['Amina'] = 34000
(b) for k in employee: print(k, employee[k])
(c) 'Rahul' in employee
(d) Adds the new key-value pair to the dictionary.

All questions are answerable from the NCERT chapter text. Reviewed by GFIS faculty.