Quiz Space

Programming in Python · End Term · 10 May 2026 · January 2026 term · Set 2

Question 9: Consider the following class : Consider an implementation…

Question 9

+4 marksOne correct option

Consider the following class :

Consider an implementation of a linked list where each node is created using the given class . Suppose it has a variable that points to the first node of the linked list.

Suppose we want to perform the following operations on the linked list containing nodes: Insertion of a new node at the first position of the linked list1. Insertion of a new node at the last position of the linked list2. Deletion of the first node of the linked list3. Deletion of the last node of the linked list4. Using the most efficient algorithm, which of the following options correctly represents the time complexity of the above operations respectively?

Consider the following class  :
Consider the following class  :
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • B

    —

Question 9 of 24 in the IIT Madras BS Programming in Python (Python) End Term paper sat on 10 May 2026, in the January 2026 term (Programming In Python 06 May 26). It carries 4 marks.

More questions from this paper

  1. Q1Consider the following function: If the function is called as: What value will the function return?
  2. Q2In a binary tree, the total number of nodes is 28. It is known that 10 nodes have exactly two children. How many nodes …
  3. Q3While inserting the elements 60, 30, 50, 55, 80, 90, 65, 70, and 10 into an empty binary search tree (BST) in the seque…
  4. Q4An entire message is created using characters from the set The probability of occurrence of each character is given in …
  5. Q5In a list , two elements and form a significant inversion if and . The total number of significant inversions for is _ .
  6. Q6Arrange the above functions in increasing order of asymptotic complexity.
  7. Q7A list of strings, each of length is sorted in lexicographical order using the Merge Sort algorithm. What is its time c…
  8. Q8Consider that Quick sort is applied on a list of size which is sorted in reverse order . What will be the asymptotic ru…
  9. Q10Consider the following undirected graph . Run BFS starting from vertex A. If multiple adjacent vertices exist, they are…
  10. Q11Consider a connected, directed graph on which DFS is executed. and numbering is used in the DFS algorithm on the graph.…
  11. Q12The Bellman-Ford algorithm cannot be used if a graph has negative cycles. This is because:
  12. Q13While inserting the elements 8, 4, 1, 3, 9, 2, and 11 in an empty AVL tree in the given sequence, the leaf elements are.
  13. Q14Consider the following activities . We can execute one activity at a time. Each activity has activity duration , which …
  14. Q15Consider the following recurrence relation for an algorithm: with base case . The complexity of this algorithm is _
  15. Q16Consider four matrices and of dimensions and respectively. If and , then which of the following takes the least time fo…
  16. Q17Assume there are teachers and 2n subjects. Each teacher has to teach exactly 2 subjects. Their preferences are modelled…
  17. Q18A factory produces two types of gadgets A and B. The profit earned is Rs. 6 per unit of A and Rs. 4 per unit of B. Each…
  18. Q19Let G be a simple graph with 25 vertices and 50 edges. The size of the minimum vertex cover of G is 10. What is the siz…
  19. Q20A hash table of size 10 uses open addressing with linear probing and the hash function After inserting 6 keys into an e…
  20. Q21A technology training institute offers an advanced certification program consisting of 10 modules. The program is divid…
  21. Q22There are stones, numbered . For each , the height of Stone is . There is a frog who is initially on Stone . He will re…
  22. Q23Consider the following graph. Which of the following options correctly represents the shortest distances from node 0 to…
  23. Q24Consider the graph G given below. Let Minimum Spanning Trees (MSTs) of the graph be constructed using algorithms such a…