1.

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-1def 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-5i. 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).queueii. 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( ) = 0v. 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)])

Answer»

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)])



Discussion

No Comment Found

Related InterviewSolutions