Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
923 views
in Computer by (15.9k points)

Ankita is writing a program to perform some operations in Queue. She has created three Insert_in_Queue(Student), Delete_from_Queue(Student) and Print_Queue(Student) methods/functions in Python to add a new Student name, delete a Student name and print list of student from a queue, considering them to act as insert, delete and print operations of the Queue data structure. She is not getting the desired result. Help her to get the desired result from the given python code. 

def Insert_in_Queue(queue): 

a=input("enter student name: ") queue.____________    # Statement-1

def Delete_from_Queue (queue): if (____________):     # Statement-2 

print("Queue empty") 

else: 

print("Deleted element is: ",queue[0]) 

del queue[___]    #Statement-3 

def Print_Queue(queue): 

if not ________:    #Statement-4 

print(queue[__:___ ])    # Statement-5

i. What Ankita should write to complete the Statement-1 to store the student name? 

a. queue.append(a) 

b. queue=append(a) 

c. queue.append=a 

d. append(a).queue

ii. Fill in the blank in Statement-2 to check whether the queue is empty or not? 

a. isEmpty(Queue)

 b. isEmpty(q)

 c. Queue.isEmpty 

d. Empty.Queue 

iii. Fill in the blank in Statement-3 with index number.

a. delete(0) 

b. del queue[0] 

c. delete.queue(0) 

d. queue.delete[0] 

iv. Select the correct option to complete the statement at statement-4. 

a. isEmpty( ) 

b. Empty( ) 

c. len( ) = 0

v. Specify the range to print all queue elements in statement-5? 

a. print(queue=[0:len=(queue)]) 

b. print(queue[0:len(queue)]) 

c. print(queue[[0:len]]) 

d. print(queue[0=len(queue)])

Please log in or register to answer this question.

1 Answer

+1 vote
by (15.3k points)

i. Correct Answer: a queue.append(a)

ii. Correct Answer: a isEmpty(Queue)

iii. Correct Answer: b) del queue[0]

iv. Correct Answer : a isEmpty( )

v. Correct Answer : b. print(queue[0:len(queue)])

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...