Class 12 CS Chapter 9 Data Structures – I Linear Lists Solutions Sumita Arora New Syllabus / Uncategorized / By Neha Ex 9.1 Solutions 1. What do you mean by the following terms ? ...click here for answer 2. What do you understand by the following : (i) simple ...click here for answer 3. When would you go for linear search in an array and why ? ...click here for answer 4. State condition(s) when binary search is applicable. ...click here for answer 5. Name the efficient algorithm offered by Python to insert element in a sorted sequence. State condition(s) when binary search is applicable. ...click here for answer 6. What is a list comprehension ? ...click here for answer 7. What is a 2D list ? ...click here for answer 8. What is a nested list ? ...click here for answer 9. Is Ragged list a nested list ? ...click here for answer Back Exercise Part A 17. Consider the following code and show how internally the memory is assigned to these ...click here for answer 1. What are data structures ? Name some common data structures. ...click here for answer 2. Is data structure related to a data type ? Explain. ...click here for answer 3. What do you understand by linear and non-linear data structures ? ...click here for answer 4. Name some linear data structures. Is linked list a linear data structure ? ...click here for answer 5. What is the working principle of data structures stack and queues ? ...click here for answer 6. What is a linear list data structure ? Name some operations that you can perform on linear lists. ...click here for answer 7. Suggested situations where you can use these data structures: (i) linear lists , (ii) stacks, (iii) queues. ...click here for answer 8. What is a list comprehension ? How is it useful ? ...click here for answer 9. Enlist some advantages of list comprehensions. ...click here for answer 10. In which situations should you use list comprehensions and in which situations you should not use list comprehensions ? ...click here for answer 11. What is a nested list ? Give some examples. ...click here for answer 12. What is a two dimensional list ? How is it related to nested lists ? ...click here for answer 13. Suggest a situation where you can use a regular two dimensional list. ...click here for answer 14. What are ragged lists ? How are these different from two dimensional lists ? ...click here for answer 15. Suggest a situation where you can use ragged list ? ...click here for answer 16. How are lists internally stored ? How are 2D lists internally stored ? ...click here for answer Back Exercise Part B 1. Create a list SqLst that stores the doubles of elements of another list NumLst. Following code is trying to achieve this. Will this code work as desired ? What will be stored in SqLst after following code ? NumLst = ...click here for answer 2. Change the above code so that it works as stated in previous question. ...click here for answer 4. Consider a list ML = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. Write code using a list comprehension that takes the list ML and makes a new list that has only the even elements of this list in it. # Code ...click here for answer 5. Write equivalent list comprehension for the following code : ...click here for answer 6. Write equivalent for loop for the following list comprehension : ...click here for answer 7. Predict the output of following code if the input is : ...click here for answer 8. Predict the output : ...click here for answer 9. Predict the output : ...click here for answer 10. Predict the output : ...click here for answer 11. Predict the output : ...click here for answer 12. Predict the output. ...click here for answer 13. Find the Error. Consider the following code, which runs correctly at times but gives error at other times. Find the error and its reason. ...click here for answer 14. Suggest the correction for the error(s) in previous question’s code. ...click here for answer 15. Find the error. Consider the following code(s) and predict the error(s): ...click here for answer 16. Find the error in the following list comprehension : ...click here for answer 17. Suggest corrections for the errors in both the previous questions. ...click here for answer Back Exercise Part C 1. Write a program that uses a function called find_in_list() to check for the position o f the first occurrence of v in the list passed as parameter (1st) or -1 if not found. The header for the function is given below def find_in_list ...click here for answer 2. Implement the following function for a linear list, which find outs and returns the number of unique elements in the list ...click here for answer 3. Use a list comprehension to create a list, CB4. The comprehension should consist of the cubes of the numbers 1 through 10 only if the cube is evenly divisible by four. Finally, print that list to the console Note that in this case, the cubed num ber should be evenly divisible by 4, not the original number. ...click here for answer 4. Take two lists, say for example these two : ...click here for answer 5. Suppose we have a list V where each element represents the visit dates for a particular patient in the las* month. We want to calculate the highest number of visits made by any patient. Write a function MVisit(Lst) to do this. A sample ...click here for answer