CBSE Class 12 Computer Science Question 24 of 44

Solved 2025 Sample Question Paper CBSE Class 12 Computer Science (083) — Question 3

Back to all questions
3
Question

Question 24

If L1 = [1, 2, 3, 2, 1, 2, 4, 2, ...], and L2 = [10, 20, 30, ...], then

(Answer using builtin functions only)

  1. (a) Write a statement to count the occurrences of 4 in L1.
    OR
    (b) Write a statement to sort the elements of list L1 in ascending order.

  2. (a) Write a statement to insert all the elements of L2 at the end of L1.
    OR
    (b) Write a statement to reverse the elements of list L2.

Answer
  1. (a) L1.count(4)
    OR
    (b) L1.sort()

  2. L1.extend(L2)
    OR
    (b) L2.reverse()