Data Structures || Important Questions || Sumita-Arora || Preeti-Arora || Computer Science || Class 12



Q. What is Data Structure?



Q. What is a Stack? What basic operations can be performed on them?



Q. Enlist some applications of Stacks.



Q. What are Queues? Why can all operations be performed on Queues?




Q. Enlist some applications of Queues.



Q. Describe the similarities and differences between Queues and Stacks.



Q. What is the situation called when an insertion is attempted in a full Stack?



Q. What is the situation called when read/deletion is attempted in an empty Queue?



Q . Is data structure related to a data type? Explain.



Q. What is the difference between an array and a stack housed in an array? Why stack is called a LIFO data structure? Explain how push and pop operations are implemented on a stack.



Q .What are input/output restricted queues?



Q. Write a function in Python, MakePush(Package) and Make Pip(Package), to add a new Package anddelete a Package from a List of Package Description, considering them to act as push and pop operations of the Stack data structure.



Q. Compare a data type with a Data structure.



Q. What are linear and nonlinear data Structures?



Q. Write a function in Python, INSERTQ(Arr, data) and DELETEQ(Arr) for performing insertion and deletion operations in a Queue. Arr is the list used for implementing queue and data is the value to be inserted.



Q.Write a program to insert or delete an element from a queue depending upon user's choice elements are not shifted after insertion or deletion.



Q. Write a function in python, MakePush(Package) and MakePop(Package) to add a new Package and delete a Package from a List of Package Description, considering them to act as push and pop operations of the Stack data structure.



Q. Write a program to implement input-restricted deque. (Both the operations i.e., insertions and deletion should be taken care of.




Q. In general, what common operations are performed on different Data Structures?


Q. What purpose Linear lists data structures are mostly used for?


Q. Consider the following similar codes (carefully go through these) and predict their outputs.
(i)
NList = [60, 32, 13, 'hello' ]
print (NList[1], NList[-2])
NList.append( 15 )
print(len (NList))
print( len(NList[3]))
NList.pop(3)
NList.sort()
NList.insert(2, [14, 15])
NList[3] += NList[4]
NList[3] += NList[2][1]
print (NList[3])
NList.pop()
NList[2].remove(14)
print (NList)
(ii)
NList = [ 60, 32, 13, 'hello']
print (NList[1], NList[-2])
NList.append( 15 )
print(len (NList) )
print(len (NList[3]))
NList.pop(3)
NList.insert (2, [14, 15])
NList[3] += NList[4]
NList[3] += NList[2][1]
print (NList[3])
NList[2].remove (14)
print (NList)




Q. What will be the output produced by following code ?

text = ['h', 'e', 'l', 'l', 'o']
print (text)
vowels = "aeiou"
newText = [x.upper() for x in text if x not in vowels ]
print (newText)



Q. Predict the output.
(i)
LA = [1, 4, 9, 16, 25, 36, 49, 64, 81, 168]
LB = [num/3 for num in LA if num % 3 == 0]
print (LB)
(ii)
[x + y for x in 'ball' for y in 'boy']
(iii)
li = [1, 2, 3, 4, 5, 6, 7, 8, 9]
k = [elem1*elem2 for elem1 in li if (elem1-4) > 1 for elem2 in li[:4]]
print (k)



Q. What is the difference between a regular 2D list and a ragged List?


Q. The Investiture Ceremony is a prestigious event in every school's calendar wherein the school formally entrusts responsibilities on the 'young student leaders.
At MySchool, the list STL stores the names of all the students of class XI who have applied for the various School Leaders posts. Out of these, school leaders will be selected.
Students need to register their name through an online application form available on school's website. Ideally the name should be in the form such that First name and Last name have their first letter capitalized and rest of the letters in lowercase.
But not all students are careful when entering their names, so the names can appear with incorrectly capitalized letters.

(i) selecting only those correctly entered entries where the first letters of the first name and last name are capitalized.
(ii) selecting only the incorrectly entered names.
(iii) returning a list with corrected names.




Q. An algorithm requires two stacks of sizes M and N that are to be maintained in the memory. Illustrate with an example how will you adjust two stacks in one dimensional array with M + N memory locations so that the overflow condition is minimised.


Q. Propose a data structure which supports the stack Push and Pop operations and a third operation FindMin, which returns the smallest element in the data structure.


Q. Consider an empty stack of integers. Let the numbers 1, 2, 3, 4, 5, 6 be pushed on to this stack only in the order they appeared from left to right. Let S indicates a push and X indicates a pop operation. Can they be outputted in to the order 325641 and order 154623 ?
(Hint. SSSSSSXXXXXX outputs 654321)



Q. Infopedia is an online encyclopaedia which stores detailed information about various countries. In order to provide efficient processing for retrieval and display of names of countries, it has to be digitized, which requires handling additions and deletions through data structures in Python, primarily stacks and queues.

Write a program constituting methods in Python to add, display and remove a name from a given stack of names of countries.



Q. FLYAIR Airlines has grown big and touches more than 140 destinations worldwide, offering excellent service to its passengers. To provide latest information to its customers at the click of a button, the company offers computerized processing of passenger details.

Write a Python program comprising methods / functions to add or delete a passenger's name from the list of passengers, considering them as insert and delete operations of the Queue data structure.

Post a Comment

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

Previous Post Next Post