0% found this document useful (0 votes)
32 views8 pages

SplitPDFFile 29 To 36

Uploaded by

gnbdiva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views8 pages

SplitPDFFile 29 To 36

Uploaded by

gnbdiva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CLASS : XII SUBJECT: COMP. SCI.

UNIT – I TOPIC- Data Structure


……………………………………………………………………………………………………0

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

8 Predict the output of the following code: Application

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

9 Predict the output of the following code: Application


def push(stk,num):
stk.append(num)
def pop():
if len(stk)==0:
print(“Underflow”)
else:
stk.pop()
stk=[10,100,-1,2,4]
push(stk,200)
pop()
pop()
pop()
push(stk,4)
print(stk[-1])

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

(A) Pile of clothes in an almirah


(B) Multiple chairs in a vertical pile
(C) Persons buying movie tickets from a counter
(D) Bangles worn on wrist
12 What will the output of the following Python code? result=0 Analysis
numberList=[10,20,30] numberList.append(40) Evaluation
result=result+numberList.pop()
result=result+numberList.pop() print(result)
(A) 40
(B) 70
(C) 30
(D) 10
13 Predict the output of the following Python code. answer=[]; Analysis
answer.append('T') Evaluation
answer.append('A')
answer.append('M') ch=answer.pop()
print(answer)
(A) ['T', 'A']
(B) ['T', 'A', 'M']
(C) ['A']
(D) IndexError: pop from empty list

14 In Python, list is used for implementing a stack and its built-in-


functions___________ and __________ are used for insertion
and deletion, respectively.

(A) Insert, delete


(B) append, pop
(C) append, remove
(D) append, delete
15 In which data type stack is implemented in Python.
A. List
B. Tuple
C. Int
D. Dictionary

ASSERTIONS AND REASONS (16-20)


16 Assertion : The start index of a stack is -1 Understanding
Reason : Stack Data structure can be implemented through
list in Python
A. Both Assertion and reason are true and reason is
correct explanation of assertion
B. Assertion and reason both are true but reason is not
the correct explanation of assertion
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.
17 Assertion: If the size of a stack is 5 and a sixth element is Analysis
inserted, then Underflow happens
Reason: Overflow is a condition which occurs in bounded stack
A. Both Assertion and reason are true and reason is
correct explanation of assertion
B. Assertion and reason both are true but reason is not
the correct explanation of assertion
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.
18 Assertion: A stack has 2 elements in it. If the stack Analysis
undergoes 3 pop operations one after another
then Underflow occurs.
Reason: Underflow is a condition which occurs when deletion
happens on an empty stack.
A. Both Assertion and reason are true and reason is
correct explanation of assertion
B. Assertion and reason both are true but reason is not
the correct explanation of assertion
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.
19 Assertion: if a stack has the following data, then peek function Understanding
will return 4

Reason: Arithmetic expression can be evaluated using stack


A. Both Assertion and reason are true and reason is
correct explanation of assertion
B. Assertion and reason both are true but reason is not
the correct explanation of assertion
C. Assertion is true, reason is false.
D. Assertion is false, reason is true.

20 Assertion: Stack is a linear data structure. Understanding


Knowledge
Reason: A data structure in which elements are organized in a
sequence is called linear data structure.
(A) Both Assertion and reason are true and reason is correct
explanation of assertion.
(B) Assertion and reason both are true but reason is not the
correct explanation of assertion.
(C) Assertion is true, reason is false.
(D) Assertion is false, reason is true.

CASE STUDY BASED QUESTIONS (21-25)


Venkat loves to play cricket. His teacher has given him an Application
assignment on his favourite sport. He has to write 2 functions and Analysis
AddPlayer(player,runs) and DeletePlayer() to add and remove a
player from a stack which is implemented using a list. Adding a
player to a stack is only possible if the player has secured
more than 50 runs. Venkat needs your help in completing the
code.

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)

26 The peek operation refers to accessing/inspecting the top Understanding


element in the stack
A. True
B. False

27 The insert operation in stack is known as pop Knowledge


A. True
B. False

28 The top operation does not modify the contents of a stack. Analysis
A. True
B. False

29 Stack implementation can be performed using a list in Python Knowledge


A. True
B. False

30 For loop can be used for traversing a stack Understanding


A. True
B. False

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy