Lists — NCERT Solutions
CBSE · Class 11 · Computer Science
NCERT Solutions for Lists, CBSE Class 11 Computer Science: 22 textbook questions solved step by step. Covers Exercise and Programming Problems.
Interactive on Super Tutor
Studying Lists? Get the full interactive chapter.
Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for NCERT solutions and more.
Free trial, no card needed.
The first 11 solutions are open to read. The other 11 are free with a Super Tutor account.
Exercise
1(i)What will be the output of the following statements?
list1 = [12,32,65,26,80,10]
list1.sort()
print(list1)Show solution
Given: A list list1 = [12,32,65,26,80,10]
Concept: list1.sort() sorts the list in-place in ascending order and modifies the original list.
Working:
- Original list:
[12, 32, 65, 26, 80, 10] - After
list1.sort(): elements are arranged in ascending order →[10, 12, 26, 32, 65, 80] print(list1)prints the modified list.
Output:
[10, 12, 26, 32, 65, 80]1(ii)What will be the output of the following statements?
list1 = [12,32,65,26,80,10]
sorted(list1)
print(list1)Show solution
Given: A list list1 = [12,32,65,26,80,10]
Concept: sorted(list1) returns a new sorted list but does not modify the original list. The result is not stored in any variable, so list1 remains unchanged.
Working:
sorted(list1)creates a new sorted list[10, 12, 26, 32, 65, 80]but it is discarded since it is not assigned to any variable.list1still holds its original values.print(list1)prints the original unmodified list.
Output:
[12, 32, 65, 26, 80, 10]1(iii)What will be the output of the following statements?
list1 = [1,2,3,4,5,6,7,8,9,10]
list1[::-2]
list1[:3] + list1[3:]Show solution
Given: list1 = [1,2,3,4,5,6,7,8,9,10]
Concept: Slicing creates a new list but does not modify the original. Since the results are not printed or assigned, there is no output from these statements.
Working:
list1[::-2]→ traverses from end to start with step , giving[10, 8, 6, 4, 2]. But this is not printed or stored.list1[:3] + list1[3:]→[1,2,3] + [4,5,6,7,8,9,10]=[1,2,3,4,5,6,7,8,9,10]. But this is also not printed or stored.
Output:
(No output — neither expression is printed)1(iv)What will be the output of the following statements?
list1 = [1,2,3,4,5]
list1[len(list1)-1]Show solution
Given: list1 = [1,2,3,4,5]
Concept: len(list1) returns 5. So list1[len(list1)-1] = list1[4] which is the last element. However, since this expression is not passed to print(), there is no output.
Working:
len(list1)=list1[5 - 1]=list1[4]=- The value is computed but not printed.
Output:
(No output — the expression is not printed)Note: If it were print(list1[len(list1)-1]), the output would be 5.
2Consider the following list myList. What will be the elements of myList after the following two operations:
myList = [10,20,30,40]
i. myList.append([50,60])
ii. myList.extend([80,90])Show solution
Given: myList = [10, 20, 30, 40]
Concept:
append(x)addsxas a single element (even ifxis a list) at the end.extend(iterable)adds each element of the iterable individually at the end.
Working:
i. After myList.append([50,60]):
[50, 60]is added as a single element (a nested list).myListbecomes:[10, 20, 30, 40, [50, 60]]
ii. After myList.extend([80,90]) (applied on the result of step i):
80and90are added individually.myListbecomes:[10, 20, 30, 40, [50, 60], 80, 90]
Final Answer:
After append: [10, 20, 30, 40, [50, 60]]
After extend: [10, 20, 30, 40, [50, 60], 80, 90]3What will be the output of the following code segment:
myList = [1,2,3,4,5,6,7,8,9,10]
for i in range(0,len(myList)):
if i%2 == 0:
print(myList[i])Show solution
Given: myList = [1,2,3,4,5,6,7,8,9,10]
Concept: The loop iterates over indices from to . The condition i % 2 == 0 is true for even indices: .
Working:
| Index | ? | myList[i] printed |
|---|---|---|
| 0 | Yes | 1 |
| 1 | No | — |
| 2 | Yes | 3 |
| 3 | No | — |
| 4 | Yes | 5 |
| 5 | No | — |
| 6 | Yes | 7 |
| 7 | No | — |
| 8 | Yes | 9 |
| 9 | No | — |
Output:
1
3
5
7
94(a)What will be the output of the following code segment:
myList = [1,2,3,4,5,6,7,8,9,10]
del myList[3:]
print(myList)Show solution
Given: myList = [1,2,3,4,5,6,7,8,9,10]
Concept: del myList[3:] deletes all elements from index to the end of the list.
Working:
- Indices to correspond to elements .
- After deletion, only elements at indices remain: .
Output:
[1, 2, 3]4(b)What will be the output of the following code segment:
myList = [1,2,3,4,5,6,7,8,9,10]
del myList[:5]
print(myList)Show solution
Given: myList = [1,2,3,4,5,6,7,8,9,10]
Concept: del myList[:5] deletes all elements from the beginning up to (but not including) index .
Working:
- Indices to correspond to elements .
- After deletion, elements at indices to remain: .
Output:
[6, 7, 8, 9, 10]4(c)What will be the output of the following code segment:
myList = [1,2,3,4,5,6,7,8,9,10]
del myList[:2]
print(myList)Show solution
Given: myList = [1,2,3,4,5,6,7,8,9,10]
Concept: del myList[:2] deletes elements from the beginning up to (but not including) index .
Working:
- Indices and correspond to elements and .
- After deletion, elements at indices to remain: .
Output:
[3, 4, 5, 6, 7, 8, 9, 10]5Differentiate between append() and extend() functions of list.Show solution
Concept: Both append() and extend() are used to add elements to a list, but they work differently.
| Feature | append(x) | extend(iterable) |
|---|---|---|
| Purpose | Adds x as a single element at the end | Adds each element of the iterable individually at the end |
| Argument | Any object (integer, string, list, etc.) | Must be an iterable (list, tuple, string, etc.) |
| Effect on length | Length increases by 1 | Length increases by the number of elements in the iterable |
| Nested list | If a list is passed, it becomes a nested list | If a list is passed, its elements are added individually |
Example:
list1 = [1, 2, 3]
list1.append([4, 5])
print(list1) # Output: [1, 2, 3, [4, 5]]
list2 = [1, 2, 3]
list2.extend([4, 5])
print(list2) # Output: [1, 2, 3, 4, 5]Conclusion: append() adds the argument as one element, while extend() unpacks the iterable and adds each element separately.
6Consider a list: list1 = [6,7,8,9]
What is the difference between the following operations on list1:
a. list1 * 2
b. list1 *= 2
c. list1 = list1 * 2Show solution
Given: list1 = [6, 7, 8, 9]
**a. list1 * 2**
- Concept: The
*operator creates and returns a new list by repeatinglist1twice. The originallist1is not modified. - Result: A new list
[6, 7, 8, 9, 6, 7, 8, 9]is created but since it is not assigned,list1remains[6, 7, 8, 9].
**b. list1 = 2*
- Concept: This is an in-place repetition. It modifies
list1directly (same object in memory) by repeating its elements twice. - Result:
list1becomes[6, 7, 8, 9, 6, 7, 8, 9]. The same list object is updated.
**c. list1 = list1 * 2**
- Concept:
list1 * 2creates a new list[6, 7, 8, 9, 6, 7, 8, 9], and thenlist1is reassigned to point to this new list object. - Result:
list1now refers to a new list[6, 7, 8, 9, 6, 7, 8, 9].
Summary of Differences:
| Operation | Modifies original? | Creates new list? | list1 after operation |
|---|---|---|---|
list1 * 2 | No | Yes (discarded) | [6,7,8,9] |
list1 *= 2 | Yes (in-place) | No | [6,7,8,9,6,7,8,9] |
list1 = list1 * 2 | No | Yes (reassigned) | [6,7,8,9,6,7,8,9] |
Write Python statements to retrieve:
a) Percentage of the student
b) Marks in the fifth subject
c) Maximum marks of the student
d) Roll no. of the student
e) Change the name of the student from 'Raman' to 'Raghav'
Free with a Super Tutor account
Programming Problems
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Note: The median value of a list of values is the middle one when they are arranged in order. If there are two middle values then take their average.
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
11 more solved questions in Lists
They are free with a Super Tutor account, along with practice quizzes and flashcards for this chapter. Free to start, no card needed.
Frequently Asked Questions
What are the important topics in Lists for CBSE Class 11 Computer Science?
Are these NCERT Solutions for Lists free?
How should I revise Lists for Class 11 exams?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Lists
Practice Quiz
Test yourself with a quick quiz
Important Questions
Exam-style questions with answers
Revision Notes
Key points for last-minute revision
Formula Sheet
The chapter's formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect
Study Plan
Step-by-step plan for this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
For serious students
Get the full Lists chapter — start free.
Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 11 Computer Science. Free to start, no card needed.