0% found this document useful (0 votes)
54 views37 pages

Data Structure

The document contains a series of questions related to data structures, specifically focusing on stacks and queues, along with their operations and applications. It includes multiple-choice questions that assess knowledge, understanding, and analysis of stack-related concepts. Additionally, it provides answers to the questions and details about the vetter and institution associated with the document.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views37 pages

Data Structure

The document contains a series of questions related to data structures, specifically focusing on stacks and queues, along with their operations and applications. It includes multiple-choice questions that assess knowledge, understanding, and analysis of stack-related concepts. Additionally, it provides answers to the questions and details about the vetter and institution associated with the document.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Name of the Chapter- DATA STRUCTURE

Question Question Content Learning Objective(if


No Provided)
Sl.No Question Learning Objective
1 What is the process of inserting data into a stack called? Knowledge
A. Create
B. Insert
C. Push
D. Evaluate
2 What is the process of deleting data from a stack called? Knowledge
A. Drop
B. Delete
C. Erase
D. Pop
3 Which data structure works on the principle of LIFO? Knowledge
A. Linear List
B. Stack
C. Queue
D. Tree
4 Which pointer is associated with a stack? Knowledge
A. First
B. Front
C. Rear
D. Top

5 Assume a stack has size 4. If a user tries to push a fifth Understanding


element to a stack, which of the mentioned condition will
arise?
A. Underflow
B. Overflow
C. Crash
D. Successful Insertion
6 If a user tries to pop an empty stack, which of the Understanding
mentioned condition will arise?
A. Empty data
B. Overflow
C. Underflow
D. No error

7 Which of the following condition is necessary for Analysis


checking a stack st is full in Python?
A. Top ==len(st)
B. Top ==len(st)-1
C. Top < len(st)
D. Top ==st
8 Assume a stack Stk implemented as a list. Predict the Analysis
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')
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

9 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
10 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

11 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

12 The contents of a stack st are as shown in the figure. Analysis


Mention the value of Top after a series of these
operations:
Push(st,9)
Pop()
Pop()
Pop()
Push(st,-1)

A. 1
B. 2
C. 3
D. 4
13 Choose correct output for the following sequence of Analysis
operations.
push(5)
push(8)
pop
push(2)
push(5)
pop
pop
pop
push(1)
pop
A. 8 5 2 51
B. 8 5 5 2 1
C. 8 2 5 5 1
D. 8 1 2 5 5
14 What is the value of the postfix expression 6 3 2 4 + – *? Evaluation
A. -18
B. 1
C. 40
D. 72
15 Which is the correct way to create a stack of numbers Creation
with contents 8,10 and 100, in Python?
A. Stack=(8,10,100)
B. Stack =[8,10,100]
C. Stack( 8,10,100)
D. None of the above
16 Stack data structure works on the following principle. Knowledge
(A) LILO
(B) DIFO
(C) FIFO
(D) LIFO

17 Which of the following is not an application of stack in Understanding


real-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

18 Which of the following operation is used to remove the Knowledge


top most element of the stack?
(A) PUSH
(B) DISPLAY
(C) POP
(D) INSERT

19 What is the name of a data structure in which insertion Knowledge


and deletion is done from one end only, usually referred Understanding
to as TOP.
(A) QUEUE
(B) STACK
(C) LISTS
(D) DICTIONARY
20 A defines a mechanism to store, Knowledge
organise and access data along with operations Understanding
(processing) that can be efficiently performed on the data.
(Fill in the blank)
(A) Data Structure
(B) Data Tree
(C) Data Store
(D) Data Organizer

21 Which of the following statement is not correct in respect Knowledge


of Stack? Understanding
(A) Stack is a linear data structure.
(B) Stack is ordered.
(C) Stack does not follow LIFO rule
(D) None of the above.

22 Which of the following exception results when we try to Knowledge


add an element to a full stack? Understanding
(A) Underflow
(B) Commonflow
(C) Downflow
(D) Overflow

23 While trying to delete an element from an empty stack Knowledge


which of the following exception results? Understanding
(A) Underflow
(B) Commonflow
(C) Downflow
(D) Overflow

24 Expand the following term: LIFO Knowledge


(A) Least in First Out
(B) Last in First Out
(C) Last in Fast Out
(D) Least in Fast Out

25 What will the output of the following Python code? Analysis


result=0 Evaluation
numberList=[10,20,30]
numberList.append(40)
result=result+numberList.pop()
result=result+numberList.pop()
print(result)
(A) 40
(B) 70
(C) 30
(D) 10

26 Which of the following data type/data structure can be Analysis


used to implement the stack in Python?
(A) integer
(B) tuple
(C) list
(D) sets

27 Which of the following is not an example of application Application


of stack in computer science?
(A) When we send print commands from multiple files
from the same computer or from different
computers using a shared printer.
(B) To reverse a string in Python.
(C) To redo/undo during editing of any text/image in
text/image editor.
(D) To convert an Infix expression into equivalent
Prefix/Postfix notation

28 Predict the output of the following Python code. Analysis


KV = list( ) Evaluation
KV.append('Chabua')
KV.append('Balasore')
KV1 = KV.pop()
KV2 =
KV.pop() KV3
= KV.pop()
print(KV1, KV2, KV3)
(A) ['Chabua', 'Balasore']
(B) Chabua
Balasore
(C) 'Chabua'
'Balasore'
''
(D) IndexError: pop from empty list
29 Predict the output of the following Python code. Analysis
answer=[]; Evaluation
answer.append('T')
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
30 Which of the following are two basic operations Knowledge
performed on a stack for insertion and deletion of Understanding
elements?
(A) INSERT and DELETE
(B) ADD and REMOVE
(C) PUSH and POP
(D) APPEND and DELETE

31 1.__________________is used to view elements


at the front of the queue, without
removing it from the queue.

a. Overflow
b. Peek
c. Front
d. Display

32 1.________________is used to check whether


any more elements can be added to the
queue or not, to avoid Overflow
exceptions while performing enqueue
operation.

a. IS EMPTY
b. PEEK
c. IS FULL
d. None of the above

33 1. Which method of Queue is used


in a function (enqueue) to insert
a new element at the end of
queue.

def enqueue(myQueue, element):


myQueue. (element)

a. add
b. join
c. insert
d. append
34 1. Which method of Queue is used in a
function (dequeue) to delete an
element
from the front of the queue. It has one
parameter - name of the queue and
returns the deleted element.

def dequeue(myQueue):
if not (isEmpty(myQueue)):
return
myQueue. (0)
else:
print(“Queue is empty”)
a. remove
b. pop
c. del
d. delete

35 1. In a deque, if insertion and deletion of


elements is done from the same
end, it will behave as
a. Queue
b. Stack
c. List
d. None of the above

36 1. Which method of Queue is used in a


function insertFront(), to insert an
element at the front of deque having
two parameters - name of deque and
element to be inserted.

def insertFront(myDeque, element):


myDeque. (0,element)

a. insert
b. append
c. add
d. join

37 1. At a train ticket purchasing counter, a


normal queue of people is formed for
purchasing a ticket. A person at the
front purchased the ticket and left the
counter. After a while they return back
to the counter to ask something. As
they have
already purchased a ticket, they may
have
the privilege to join the queue from the
front.
Which method is used in the above
problem.

a. Enqueue
b. Dequeue
c. Deque
d. Enque
What is the Full Form of Deque ?
a. Double Ended Queue
b. Delete from Queue
c. Declare queue
d. None of the above

38 1. When we need to reverse a string,


the string is traversed from the
last character till the first
character. i.e. characters are
traversed in the reverse order of
their appearance in the string.
Which data structure is used?
a. STACK
b. QUEUE
c. DEQUE
d. ENQUE

39 1. We use text/image editor for


editing the text/image where we
have options to redo/undo the
editing done. When we click on the
redo /undo icon, the most recent
editing is redone/undone. In this
scenario, which data structure is
used to keep track of changes
made
?
a. STACK
b. QUEUE
c. DEQUE
d. ENQUE

40 1. 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
41 1._________________expression can be
represented in any of the three notations
viz. Infix, Prefix and Postfix.

a. Logical
b. Boolean
c. Arithmetic
d. Relational

42 1. While programming,_______notation is
used for writing an expression in
which binary operators are written in
between the operands.

a. Prefix
b. Infix
c. Postfix
d. None of the above

43 1._______________is a data structure to convert


an Infix expression into equivalent
Prefix/Postfix notation.

a. Queue
b. Stack
c. Tree
d. Graph

44 1. In which data type stack is


implemented in Python.
a. List
b. Tuple
c. Int
d. Dictionary

45 1. In which data type stack is


implemented in Python.
a. List
b. Tuple
c. Int
d. Dictionary
ANSWER

Question No Answer
1 C
2 D
3 B
4 D
5 B
6 C
7 B
8 A
9 D
10 A
11 D
12 B
13 A
14 A
15 B
16 D. LIFO
17 C. Persons buying movie tickets from a counter
18 C. POP
19 B. STACK
20 A. Data Structure
21 C. Stack does not follow LIFO rule
22 D. Overflow
23 A. Underflow
24 B. Last in First Out
25 B. 70
26 C. List
27 A. When we send print commands from multiple files from the
same computer or from different computers using a shared
printer.
28 D. IndexError: pop from empty list
29 A. ['T', 'A']
30 C. PUSH and POP
31 b)Peek

32 c) IS FULL

33 d) append

34 b) pop

35 b) Stack

36 a) insert

37 c) Deque

38 a) Double Ended Queue

39 a) Stack

40 a) Stack

41 b) append, pop

42 c) Arithmetic

43 b) Infix

44 b) Stack

45 a) List

Name of the vetter- KAMAL KANT

GUPTA Name of the KV- NO 2

KANCHRAPARA
Region- KOLKATA

Mobile No-9493887480

E-mail ID - [email protected]
Name of the Chapter-

Question Question Content Learning Objective(if


No Provided)
Sl.No Question Learning Objective
1 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.

2 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.
3 Assertion: A stack has 2 elements in it. If the Analysis
stack 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.
4 Assertion: Consider a set of numbers pushed in the order Application
1,2,3,4,5 and 6 (L->R). Six pop operations on stack will
give the output 6 5 4 3 2 1
Reason: Stack is based on LIFO Principle
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.

5 Assertion: if a stack has the following data, then peek Understanding


function 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.

6 Assertion: Stack follows LIFO principle. Understanding


Reason: Using LIFO an element inserted in the last will Knowledge
be the last one to be out.
(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.
7 Assertion: Stack is a linear data structure. Understanding
Reason: A data structure in which elements are organized Knowledge
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.

8 Assertion: PUSH adds a new element at the TOP of the Understanding


stack.
Reason: We can add elements to a stack until it is full.
(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.

9 Assertion: We use text/image editor for editing the Analysis


text/image where we have options to redo/undo the
editing done. When we click on the redo /undo icon, the
most recent editing is redone/undone.
Reason: To implement these option, the system uses a
stack to keep track of changes made.
(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.
10 Assertion: remove( ) removes the last element from the Knowledge
list.
Reason: In pop( ), if no parameter is given, then it returns
and removes the last element of the list.
(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.

11 Find the output of the following code:


result=0
numberList=[10,20,30]
numberList.append(40)
result=result+numberList.pop()
result=result+numberList.pop()
print(result)

Assertion : Output is 70
Reason : pop() returns the last
element of the List.

a. A is True but R is False


b. A and R both are True and
R is correct explanation of
A
c. A and R both are True and
R is not correct
explanation of A
d. A and R both are False
12 Convert the following infix notations to
postfix notations, showing stack and
string contents
at each
step. A * C
+ D/E
Assertion: Postfix expression is
AC*DE/+
Reason: In POSTFIX notation for
expression, operators are not placed after
operands .

a. A is True but R is False


b. A and R both are True and
R is correct explanation of A
c. A and R both are True and
R is not correct explanation
of A
d. A and R both are False
13 _____________Data structure is used to
maintain browser history (URL) because
once a
tab is closed and if you
press ctrl+shift+T, the most recently
closed URL is opened first.
As the number of URLs which
can be stored in history is fixed, so
when this list of URLs
becomes large, URLs from the
end of the list (i.e. which were least
visited) gets deleted.

Assertion: Stack data structure is


used for above program.
Reason: Because Stack is used to
pop elements in the reverse order.

a. A is True but R is False


b. A and R both are True and
R is correct explanation of A
c. A and R both are True and
R is not correct explanation
of A
d. A and R both are False
14 Evaluate following postfix expressions
while showing status of stack after
each operation given,
A=3, B=5, C=1, D=4

AB*C/D*

Assertion: Result of this


expression is
60.
Reason: Because postfix expression
is evaluated using BODMAS rule.

a. A is True but R is False


b. A and R both are True and
R is correct explanation of A
c. A and R both are True and
R is not correct explanation
of A
d. A and R both are False
15 Convert the following infix notations
to prefix notations, showing stack and
string contents
at each step.
A / B – C*E /F

Assertion: Prefix notation is


-/AB/*CEF.
Reason: Because while conversion
of an Infix notation to its equivalent Prefix
notation,
both operators
and operands are PUSHed onto
the Stack.

a. A is True but R is False


b. A and R both are True
and R is correct
explanation of A
c. A and R both are True
and R is not correct
explanation of A
d. A and R both are False
Question No Answer
1 D
2 D
3 A
4 A
5 B
6 C. Assertion is true, reason is false.
7 A. Both Assertion and reason are true and reason is correct
explanation of assertion.
8 B. Assertion and reason both are true but reason is not the
correct explanation of assertion.
9 A. Both Assertion and reason are true and reason is correct
explanation of assertion.
10 D. Assertion is false, reason is true.
11 1. b) A and R both are True and R
is correct explanation of A.
12
2. a) A is True but R is False
(Reason should be- In POSTFIX
notation for expression, operators are
placed after operands)

13 3. b) A and R both are True and R


is correct explanation of A

14 4. b) A and R both are True and R


is correct explanation of A

15
5. a) A is True but R is False

(Reason should be- Because


while
conversion of an
Infix notation to its equivalent
Prefix notation, only operators are PUSHed onto
the Stack. )
Name of the vetter- KAMAL KANT

GUPTA Name of the KV- NO 2

KANCHRAPARA Region- KOLKATA

Mobile No-9493887480

E-mail ID - [email protected]
Name of the Chapter- DATA STRUCTURE

CBQ NO Question Content Learning Objective(if


Provided)
1 Neha is assigned a stack program which has a function Application and Analysis
push_data() to push elements into a stack which is
divisible by 2. The program also has a function
pop_data() which will delete elements from a stack. She
has newly learnt Python Language and is facing some
difficulty in completing the code. Help her in completing
the code.
Incomplete Code:

def push_data(list_all):
for i in range(0,_________): # statement2
if i%2==0:
Stack________# statement 3
print(Stack) #statement 4
def pop_data():
if ==0: #statement5
print("Empty Stack,Cant pop")
return -1
else:
pop_item=Stack[-1]
Stack_______#statement6
return pop_item

#Creating stack
Stack=_______# statement1
# Pushing data into stack
push_data ([20,11,30,15,2])
#deleting element from the stack
print(pop_data())
a) Identify the missing code in statement 1:
A. {}
B. ()
C. []
D. None of the above
b) Identify the missing code in statement 2 for completing
the stop parameter in the for loop:
A. list_all
B. len(list_all)
C. max(list_all)
D. min(list_all)
c) Identify the missing function in statement 3 for inserting
data into the stack.
A. insert(i)
B. push(i)
C. append(i)
D. create(i)

d) What will be the contents of stack which will be printed


in statement 4?
A. [20,11,30,15,2]
B. [11,15]
C. [20,30,15]
D. [20,30,2]

e) Identify the missing code in statement 5 in pop_data()


function
A. Stack[len()]
B. Stack.len()
C. len(Stack)
D. empty(Stack)

f) Identify the missing code in statement 6 for popping the


element in the stack:
A. Stack.delete()
B. Stack.pop(-1)
C. Stack.pop(0)
D. Stack.append(-1)
2 Venkat loves to play cricket. His teacher has given him an Application and Analysis
assignment on his favourite sport. He has to write 2
functions 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:") # statement1


getruns=int(input("Enter the runs scored by player:"))
AddPlayer(getPlayer,getruns)
print(DeletePlayer())
a) Which function will be used in statement 1 to get the
player name from the user?
A. read()
B. input()
C. get()
D. pop()
b) Identify the missing code to complete the statement 2:
A. insert(player)
B. push(player)
C. append(player)
D. player(append)

c) Identify the missing code to complete the statement 3:


A. delete()
B. pop()
C. pop(0)
D. append(-1)
d) Assume the current stack position as ['Azhar','Sachin']. If
the function AddPlayer() is called with the arguments
('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')

e) Assume the current stack position as ['Don','Virat','Jeff'].


If the function DeletePlayer() is invoked ,What will be
the data in the stack after the function call?
A. ['Don','Virat']
B. ['Virat','Jeff']
C. ['Virat','Jeff']
D. ['Don', 'Virat','Jeff']

3 Sohan is developing a program in Computer Lab of his


school to perform some operations in Stack. He has
created push(Student_Name),
stack_Delete(Student_Name) and
display(Student_List) functions in Python to add a new
Student name, delete a Student name and print list of
student from a stack, considering them to function/work
as insert, delete and print operations of the Stack data
structure. He is not getting the desired result. Help him to
get the desired result from the given python code.

Student_List= list( ) #empty list


def push(Student_Name): #Push an element into the stack
Student_List. (Student_Name)
#Statement 1

def pop(): #Delete top element from the stack


if : #Statement 2
return ('Underflow')
else:
return Student_List. () #Statement
3

def display(): #Displaying the stack


for st_Name in : #Statement 4
(st_Name) #Statement 5
Fill the above statement based on given questions:
3.a Identify the suitable code for the blank of statement 1. Knowledge
(A) append Analysis
(B) insert Understanding
(C) extend
(D) push

3b Fill the statement 2, to check the stack is empty. Creation


(A) Student_List == 0 Evaluation
(B) len(Student_List) = = 0
(C) Student_List.empty( )
(D) Student_List is empty

3c Fill the statement 3, to delete an element from the stack. Knowledge


(A) pop(1) Analysis
(B) pop( ) Understanding
(C) del Student_List[1]
(D) delete( )

3d Identify the suitable code for the blank of statement 4. Knowledge


(A) Student Analysis
(B) List Understanding
(C) Student_List
(D) Print

3e Identify the suitable code for the blank of statement 5. Knowledge


(A) Student Analysis
(B) List Understanding
(C) Student_List
(D) print

4. Ritu is trying to understand the concept of stack using the


water glasses. She has created a stack of glasses assuming
that the each glass is numbered. She has also written few
incomplete functions to perform the following operations:
● To check if there is no glass in the stack– isEmpty
()
● To push glasses into the stack – push ( )
● To find the number of glasses in the stack– size ( )
● To delete/remove the topmost glass from the
stack – pop ( )

#Code
glassStack = [ ] #Empty glass stack
def isEmpty(glassStack): #To check if there is no
glass
if = = 0: #Statement
1
return True
else:
return False
def push(glassStack, element): # To push glasses
into the stack
glassStack. (element) #Statement
2

def size(glassStack): # To find the number of


glasses in the stack
return (glassStack) #Statement
3

def pop(glassStack):
if : #Statement
4
print('underflow')
return None
else:
return(glassStack. ) #Statement
5

4.a Which statement will be used in place of statement 1? Knowledge


(A) empty( ) Analysis
(B) len( ) Understanding
(C) size(glassStack)
(D) size()

4.b Help Ritu to fill up the appropriate function name in Knowledge


statement 2. Analysis
(A) append Understanding
(B) insert
(C) extend
(D) push

4.c Which of the following statement/function will be used in Knowledge


statement 3, to find the number of glasses in the stack. Analysis
(A) Len Understanding
(B) len
(C) size
(D) length

4.d Identify the suitable code for the blank of statement 4. Knowledge
(A) isEmpty(glassStack) Analysis
(B) isEmpty( ) Understanding
(C) len(glass)
(D) Len(glassStack)

4.e Help Ritu to identify the suitable code for the blank of Knowledge
statement 4. Analysis
(A) append Understanding
(B) remove
(C) delete
(D) pop

5 Fill in the blanks of following statements of


Queue Data structure.

def enqueue (queue,


item): queue
___________________
(item)
//Line-1
if len
(queue)==1:
front=rear=0
else:
rear=len(queue)-1

def dequeue(queue):
if isempty (queue):
return "underflow"
else:
item=queue.pop (______)
// Line-2
if len(queue)==0:
front=rear=None
return item

a) Choose the correct option in Line-1


a. extend
b. join
c. insert
d. append
b) Choose the correct option in Line-2
a. 0
b. None
c. 1
d. blank

ANSWER

CBQ NO Answer
1a) C
b) B
c) C
d) D
e) C
f) C
2 a) B
b) C
c) B
d) C
e) A
3
a) A. append
b) B. len(Student_List) = = 0

c) B. pop( )
d) C. Student_List
e) D. Print

4
a) C. size(glassStack)
b) A. append
c) B. len
d) A. isEmpty(glassStack)
e) D. pop
5 a) d. append
b) a. 0

Name of the vetter- KAMAL KANT

GUPTA Name of the KV- NO 2

KANCHRAPARA Region- KOLKATA

Mobile No-9493887480

E-mail ID - [email protected]
Name of the Chapter- DATA STRUCTURE

Question Question Content Learning Objective(if


No Provided)
1 The peek operation refers to accessing/inspecting the top Understanding
element in the stack
A. True
B. False
2 The insert operation in stack is known as pop Knowledge
A. True
B. False
3 The top operation does not modify the contents of a stack. Analysis
A. True
B. False
4 Stack implementation can be performed using a list in Knowledge
Python
A. True
B. False
5 For loop can be used for traversing a stack Understanding
A. True
B. False
6 Stack follows LIFO principle using which an element Knowledge
inserted in the last will be the first one to be out. Understanding
7 Trying to pop an element from an empty stack results into Understanding
a special condition overflow. Analysis
8 Stack is an ordered linear data structure, following FIFO Understanding
strategy. Analysis
9 Stack is a linear data structure. Knowledge

10 PUSH operation may result into underflow condition. Understanding


Analysis
11 Stack is a linear data structure.
12 Stack does not follow LIFO rule.
13 Front and Rear are used to indicate beginning
and end of queue.
14 In POSTFIX notation for expression, operators
are placed before operands.
15 Trying to pop an element from an empty stack
results into a special condition underflow.

ANSWER

Question No Answer
1 A
2 B
3 A
4 A
5 A
6 TRUE
7 FALSE
8 FALSE
9 TRUE
10 TRUE
11 TRUE

12 FALSE

13 TRUE

14
FALSE

15
TRUE

You might also like