Combine PDF
Combine PDF
Q4
Q3 .
.
Python Data Structure Practice Questions –
Test 1
Q1. What do you mean by data structure?
Ans . A data structure is a way of storing, organizing and retrieving data in a
computer.
Q2. Name any one linear data structure in python.
Ans . List
Q3. Python list are ______________ in Nature (static/dynamic)
Ans. Dynamic
Q4. “Lists are dynamic in nature” What do you mean by this statement?
Ans. This means that list can be grown or shrink in size means elements can
be deleted or added in list.
Q5. What do you mean by Stack?
Ans. A stack is a linear data structure where elements can be inserted or
deleted at one end.
Q6. Name the end where we add or remove element in stack.
Ans. Top
Q7. What is the full form of LIFO?
Ans. Last In First Out
Q8. Give two example of stack from daily life.
Ans. A pile of book, a stack of carom coins etc.
Q9. Name two operations performed in stack.
Ans. Push and Pop
Q10. What is the order of inserting elements in the following stack?
Ans.
MyStack=[]
def Push(rollno):
MyStack.append(rollno)
def Pop(MyStack):
if len(MyStack) > 0:
MyStack.pop()
else:
print("Stack is empty.")
Ans.
MyStack=[]
def add(bname):
MyStack.append(bname)
def delete(MyStack):
if len(MyStack) > 0:
MyStack.pop()
else:
print("Stack is empty. There is no book name")