Data Structure in Python || Preeti Arora || Class 12 || Unsolved Question || Computer science || Solution



Q1. What is Stack? Why is it called LIFO data structure?



Q2. List two ways to implement Stack.



Q3. Write applications of Stack.



Q4. Can a Stack be used to convert a decimal number into a binary number?



Q5. Write an algorithm to push an element into the Stack.




Q6. Write an algorithm to pop an element from the Stack.



Q7. Write an interactive menu-driven program implementing Stack using list. The list is storing numeric data.



Q8. Write an interactive menu-driven program to implement Stack using list. The list contains the names of students.



Q9. Give the necessary declaration of a list implemented Stack containing float type numbers. Also, write a user-defined function to pop a number from this Stack.



Q10. A linear Stack called Directory contains the following information:

-- Pin code of city
-- Name of city

Write add(Directory) and delete(Directory) methods in Python to add and remove contacts using append() and pop() operations in Stack.




Q11. Write add(Book) and delete(Books) methods in Python to add Books and Remove Books considering them to act as append() and pop() operations in Stack.



Q12. Write AddClient(Client) and DeleteClient(Client) methods in Python to add a new client and delete a client from a list client name, considering them to act as insert and delete operations of the Queue data structure.



Q13. Write Addscore(Game) and Delscore(Game) methods in Python to add new Score in the list of score in a game and remove a score from a list of score of a game considering these methods to act as PUSH and POP operation of data structure Stack.



Q14. Write a Python program to sort a Stack in ascending order without using an additional Stack.



Q15. A Stack STK and Queue QUE is being maintained. Their maximum size is the same:

(i) Check whether they have the same size, i.e., have the same number of elements.
(ii) Check for equality of Stack and Queue, i.e.
(a) Retrieve an element from the Stack and one element from the Queue.
(b) Compare the two.
(c) Stop and report if elements are different.




Q16. Write an algorithm to insert element into (i) Stack as a list (ii) Queue as a list.



Q17. Write a program that, depending upon the user's choice, either adds or removes an element from a Stack.



Q18. Write a program that, depending upon the user's choice, either pushes or pops an element in a Stack. The elements are shifted towards the right so that the top always remains at 0th (zeroth) index.



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



Q20. Write a program to perform insert and delete operations on a Queue containing Members' details as given in the following definition of item node:

Member No - Integer
Member Name - String
Age - Integer

def isEmpty (Qu) :
    if Qu == [ ] :
        return True
    else :
        return False

def Enqueue (Qu, item) :
# Write the code to insert member details using Queue.

def Dequeue (Qu) :
# Write the code to delete a member using Queue.




Q21. Write AddCustomer(Customer) and DeleteCustomer( Customer) methods in Python to add a new Customer and delete a Customer from a List of CustomerNames, considering them to act as push and pop operations of the stack data structure.

 

 

5 Comments

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

  1. Thanks❤����

    ReplyDelete
  2. question no. 10 and 11 are combined in this listing and on clicking the link its opening the 11 ans.

    ReplyDelete
    Replies
    1. where is the 10 ans.

      Delete
    2. All things are correct Please click on question 10.

      Delete

Post a Comment

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

Previous Post Next Post