SplitPDFFile 29 To 36
SplitPDFFile 29 To 36
Sl. Learning
Question
No Objective
MULTIPLE CHOICE QUESTIONS (1-15)
1 What is the process of inserting data into a stack called?
A. Create
B. Insert Knowledge
C. Push
D. Evaluate
2 What is the process of deleting data from a stack called?
A. Drop
B. Delete Knowledge
C. Erase
D. Pop
3 Which pointer is associated with a stack?
A. First
B. Front Knowledge
C. Rear
D. Top
4 Assume a stack has size 4. If a user tries to push a fifth element
to a stack, which of the mentioned condition will arise?
A. Underflow
Understanding
B. Overflow
C. Crash
D. Successful Insertion
5 If a user tries to pop an empty stack, which of the mentioned
condition will arise?
A. Empty data Understanding
B. Overflow
C. Underflow
D. No error
6 Assume a stack Stk implemented as a list. Predict the output
of the following code.
def push_char(ch):
Stk.append(ch)
def display_stk():
strdata=""
if len(Stk)==0:
print("Empty Stack")
else:
for i in Stk:
strdata+=i
print(strdata[::-1])
push_char('c') Analysis
push_char('b')
push_char('s')
push_char('e')
push_char('2')
push_char('0')
push_char('2')
push_char('1')
A. 1202esbc
B. cbse2021
C. 1
D. s
7 Which of these is not an application of stack? Application
A. Parenthesis Balancing program
B. Evaluating Arithmetic Expressions
C. Reversing Data
D. Data Transfer between Process
def insert_data(stk,num):
stk.append(num)
stk=[2,3,4]
insert_data(stk,10)
print(stk)
A. [2,3,4,10]
B. [10,2,3,4]
C. Overflow
D. Underflow
A. 200
B. 100
C. -1
D. 4
10 Stack data structure works on the following principle. Knowledge
(A) LILO
(B) DIFO
(C) FIFO
(D) LIFO
11 Which of the following is not an application of stack in real- Understanding
life. Application
Incomplete code:
#Creating stack Cricket_Stack=[]
def AddPlayer(player,runs): if runs>50:
Cricket_Stack ____ # statement 2
print(Cricket_Stack) def
DeletePlayer():
if len(Cricket_Stack) ==0: print("Empty
Stack,Cant pop") return -1
else:
pop_item=Cricket_Stack[-1] Cricket_Stack
______________ #statement3
return pop_item
getPlayer= _ ("Enter the player name:") # stat. 1
getruns=int(input("Enter the runs scored by player:"))
AddPlayer(getPlayer,getruns)
print(DeletePlayer())
(Based on the data given above, answer Question No. 21 to 25)
21 Which function will be used in statement 1 to get the player Application
name from the user? and Analysis
A. read()
B. input()
C. get()
D. pop()
22 Identify the missing code to complete the statement 2: Application
A. insert(player) and Analysis
B. push(player)
C. append(player)
D. player(append)
23 Identify the missing code to complete the statement 3: Application
A. delete() and Analysis
B. pop()
C. pop(0)
D. append(-1)
24 Assume the current stack position as ['Azhar','Sachin']. If Application
the function AddPlayer() is called with the arguments and Analysis
('Karan',30) what will be the stack data after the function call?
A. ['Azhar','Sachin','Karan']
B. ('Azhar','Sachin','Karan')
C. ['Azhar','Sachin']
D. ('Azhar','Sachin')
25 Assume the current stack position as ['Don','Virat','Jeff']. If the Application
function DeletePlayer() is invoked ,What will be the data in the and Analysis
stack after the function call?
A. ['Don','Virat']
B. ['Virat','Jeff']
C. ['Virat','Jeff']
D. ['Don', 'Virat','Jeff']
TRUE / FALSE QUESTIONS (26-30)
28 The top operation does not modify the contents of a stack. Analysis
A. True
B. False