List Manipulation || Type A || Sumita Arora || Class 11 || Computer science || Information practices || Solution


 1 = Discuss the utility and significance of Lists, briefly



2 = What do you understand by mutability? What does "in place" memory updation mean?



 3. Start with the list [8, 9, 10]. Do the following using list functions:(a) Set the second entry (index 1) to 17 (b) Add 4, 5 and 6 to the end of the list(c) Remove the first entry from the list(d) Sort the list(e) Double the list(f) Insert 25 at index 3 


4 = If a is [1, 2, 3] (a)what is the difference (if any) between a * 3 and [a, a, a]? (b) is a * 3 equivalent to a + a + a? (c) what is the meaning of a[1 : 1 ] = 9 ? (d) what's the difference between a[1:2] 4 and a[1:1]

 

5. What's  a[1 : 1]   if a is a string of at least two characters? And what if string is shorter?



Q6. How are the statements Ist = Ist + 3 and Ist += [3] different, where Ist is a list? Explain.



Q7. How are the statements Ist = += "xy" and Ist = Ist + "xy" different, where Ist is a list? Explain.


Q8. What's the purpose of the del operator and pop method? Try deleting a slice.


Q9. What does each of the following expressions evaluate to ? Suppose that L is the list ["These", ["are", "a", "few", "words"], "that", "we", "will", "use"]. (a) L[1][0::2] (b) "a" in L[1] [0] (c) L[:1] + L[1] (d) L[2: :2] (e) L[2][2] in L[1]



Q10. What are list slices? What for can you use them? 


Q11. Does the slice operator always produce a new list?



Q12. Compare lists with strings. How are they similar and how are they different?




Q13. What do you understand by true copy of a list? How is it different from shallow copy? 

 


Q14. An index out of bounds given with a list name causes error, but not with list slices. Why?


Q15. What is the difference between appending a list and extending a list?

 

Q16. Do functions max(), min(), sum() work with all types of lists.




Q18. What is the difference between sort() and sorted()?

15 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post