68 solutions available
Question 1Assertion. A linear list refers to a named list of finite number of similar data elements.Reason. Similar type of elements grouped under...
Question 2Assertion. A list having one or more lists as its elements is called a nested list.Reason. Two or more lists as part of another data...
Question 3Assertion. A list having same-sized lists as its elements is a regular 2D list.Reason. When similar sequences such as tuples, dictionaries...
Question 4Assertion. A list having lists as its elements with elements being different-shaped make a ragged 2D list.Reason. A list having...
Question 1What do you mean by the following terms ?(i) raw data(ii) data item(iii) data type(iv) data structure
Question 2What do you understand by the following :(i) simple data structures(ii) compound data structures(iii) linear data structures(iv) non-linear...
Question 3When would you go for linear search in an array and why?
Question 4State condition(s) when binary search is applicable.
Question 5Name the efficient algorithm offered by Python to insert element in a sorted sequence.
Question 6What is a list comprehension ?
Question 7What is a 2D list ?
Question 8What is a nested list ?
Question 9Is Ragged list a nested list ?
Question 1A data structure is a named group of data of different data types which can be processed as a single unit.
Question 2In linear search, each element of the list is compared with the given item to be reached for, one-by-one.
Question 3A list comprehension is a concise description of a list creation for loop.
Question 4A nested list has lists as its elements.
Question 5A regular nested list has same shape of all its element-lists.
Question 1What will be the output of the following Python code ?a = [10,23,56,[78, 10]] b = list(a) a[3][0] += 17 print(b)[10, 23, 71, [95, 10]][10,...
Question 2What will be the output of the following Python code ?lst1 = "hello" lst2 = list((x.upper(), len(x)) for x in lst1) print(lst2)[('H', 1),...
Question 3What will be the output of the following Python code ?lst = [3, 4, 6, 1, 2] lst[1:2] = [7,8] print(lst)[3, 7, 8, 6, 1, 2]Syntax error[3,...
Question 4What will be the output of the following Python code snippet ?k = [print(i) for i in my_string if i not in "aeiou"]prints all the vowels in...
Question 5Which of the following is the correct expansion of list_1 = [expr(i) for i in list_0 if func(i)] ?(a)list_1 = [] for i in list_0: if...
Question 12D lists can only contain lists of same shapes.
Question 2Stacks can be implemented using lists.
Question 3Lists where controlled insertions and deletions take place such that insertions at the rear end and deletions from the front end, are...
Question 4A ragged list has same shape of all its elements.
Question 5A regular 2D list has same shape of all its elements.
Question 1What are data structures ? Name some common data structures.
Question 2Is data structure related to a data type ? Explain.
Question 3What do you understand by linear and non-linear data structures ?
Question 4Name some linear data structures. Is linked list a linear data structure ?
Question 5What is the working principle of data structures stack and queues ?
Question 6What is a linear list data structure ? Name some operations that you can perform on linear lists.
Question 7Suggested situations where you can use these data structures:(i) linear lists(ii) stacks(iii) queues
Question 8What is a list comprehension ? How is it useful ?
Question 9Enlist some advantages of list comprehensions.
Question 10In which situations should you use list comprehensions and in which situations you should not use list comprehensions ?
Question 11What is a nested list ? Give some examples.
Question 12What is a two dimensional list ? How is it related to nested lists ?
Question 13Suggest a situation where you can use a regular two dimensional list.
Question 14What are ragged lists ? How are these different from two dimensional lists ?
Question 15Suggest a situation where you can use ragged list ?
Question 16How are lists internally stored ? How are 2D lists internally stored ?
Question 1Create a list SqLst that stores the doubles of elements of another list NumLst. Following code is trying to achieve this. Will this code...
Question 2Change the above code so that it works as stated in previous question.
Question 3Modify your previous code so that SqLst stores the doubled numbers in ascending order.
Question 4Consider 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...
Question 5Write equivalent list comprehension for the following code :target1 = [] for number in source: if number & 1:...
Question 6Write equivalent for loop for the following list comprehension :gen = (i/2 for i in [0, 9, 21, 32]) print(gen)
Question 7Predict the output of following code if the input is :(i) 12, 3, 4, 5, 7, 12, 8, 23, 12(ii) 8, 9, 2, 3, 7, 8Code :s = eval(input("Enter a...
Question 8Predict the output :def h_t(NLst): from_back = NLst.pop() from_front = NLst.pop(0)...
Question 9Predict the output :ages = [11, 14, 15, 17, 13, 18, 25] print(ages) Elig = [x for x in ages if x in range(14, 18)] print(Elig)
Question 10Predict the output :L1= [x ** 2 for x in range(10) if x % 3 == 0] L2 = L1 L1.append(len(L1)) print(L1) print(L2)...
Question 11Predict the output :def even(n): return n % 2 == 0 list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] ev = [n for n in list1 if n % 2 == 0] evp = [n...
Question 12(i)Predict the output.b = [[9, 6], [4, 5], [7, 7]] x = b[:2] x.append(10) print(x)
Question 12(ii)Predict the output.b = [[9, 6], [4, 5], [7, 7]] x = b[:2] x[1].append(10) print(x)
Question 13Find the Error. Consider the following code, which runs correctly at times but gives error at other times. Find the error and its...
Question 14Suggest the correction for the error(s) in previous question's code.
Question 15(i)Find the error. Consider the following code and predict the error(s):y for y in range(100) if y % 2 == 0 and if y % 5 == 0
Question 15(ii)Find the error. Consider the following code and predict the error(s):(y for y in range(100) if y % 2 == 0 and if y % 5 == 0)
Question 16Find the error in the following list comprehension :["good" if i < 3: else: "better" for i in range(6)]
Question 17Suggest corrections for the errors in both the previous questions.
Question 1Write a program that uses a function called find_in_list() to check for the position of the first occurrence of v in the list passed as...
Question 2Implement the following function for a linear list, which find outs and returns the number of unique elements in the listdef unique(lst):...
Question 3Use 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...
Question 4Take two lists, say for example these two :a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]and...
Question 5Suppose we have a list V where each element represents the visit dates for a particular patient in the last month. We want to calculate the...