uiz Space

January 2026 term · Programming, Data Structures and Algorithms using Python · BSCS2002

Programming, Data Structures and Algorithms using Python Quiz 1: 15 March 2026 (January 2026 term)

The IIT Madras BS Programming, Data Structures and Algorithms using Python (PDSA) Quiz 1 paper sat on 15 Mar 2026, in the January 2026 term: 17 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
17
Marks
50
Duration
120 min
Written
5
MSQ
6
MCQ
6

Updated

Official paper: Programming, Data Structures And Algorithms Using Python 15 Mar 26 · No negative marking.

Question 1

+3 marksWritten answer

What is , given the definition of above?

What is  , given the definition of  above?
Show answer

A written answer, not marked automatically.

Question 2

+3 marksWritten answer

Consider the following implementation for selection sort:

Suppose a list is used as an input parameter to the above selection sort. How many times will the condition evaluate to true?

Consider the following implementation for selection sort:
Show answer

A written answer, not marked automatically.

Question 3

+3 marksWritten answer

Suppose each node of the linked list is an object of class Node. Variable head points to the first node of the linked list, and the list initially contains the following elements: 8 → 3 → 6 → 1 → 9 → 4 → 7 Consider the following function:

What will be the output of the given function if it is called on the head node of the given linked list?

Suppose each node of the linked list is an object of class Node.  Variable head points to the first node of the linked l
Suppose each node of the linked list is an object of class Node.  Variable head points to the first node of the linked l
Show answer

A written answer, not marked automatically.

Question 4

+3 marksWritten answer

Linear probing is an open addressing scheme for resolving hash collisions in tables. Linear probing takes the original hash index and increments the value by 1 until a free slot is found. A hash table contains 8 buckets indexed from 0 to 7 and uses linear probing to resolve collisions. The hash function used is: The following keys are inserted into the hash table in the given order: 18, 10, 12, 21 After all these insertions, the key value 42 is inserted. At which index will the key 42 be placed?

Show answer

A written answer, not marked automatically.

Question 5

+3 marksWritten answer

A directed acyclic graph has 6 vertices. If it is guaranteed to have a unique topological sort, what is the maximum number of edges this graph can have?

Show answer

A written answer, not marked automatically.

Question 6

+3 marksOne or more correct options

Consider the following functions: • • • Which of the following is/are false?

Select all that apply.

  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answers

  • A

    —

  • D

    —

Question 7

+3 marksOne or more correct options

Consider the following implementation of Merge Sort:

Which of the following is/are true about Merge Sort?

Consider the following implementation of Merge Sort:

Select all that apply.

  1. A

    The function preserves the relative order of equal elements.

  2. B

    The worst-case time complexity of is .

  3. C

    The best-case time complexity of is .

  4. D

    Replacing with in the condition of the function will make the algorithm unstable.

Show answer

Correct answers

  • A

    The function preserves the relative order of equal elements.

  • B

    The worst-case time complexity of is .

  • D

    Replacing with in the condition of the function will make the algorithm unstable.

Question 8

+3 marksOne or more correct options

Which of the following statements is/are true about the Quicksort algorithm? Assume that the first element of the list is always chosen as the pivot.

Select all that apply.

  1. A

    If the input list is already sorted in ascending order, the time complexity will be .

  2. B

    If the input list is already sorted in descending order, the time complexity will be .

  3. C

    It is a stable sorting algorithm.

  4. D

    The average-case time complexity is .

Show answer

Correct answers

  • A

    If the input list is already sorted in ascending order, the time complexity will be .

  • D

    The average-case time complexity is .

Question 9

+3 marksOne or more correct options

Consider a singly linked list implemented using the above class. Assume that: • variable points to the first node of the linked list, • variable points to the last node of the linked list, • the linked list contains nodes where , Which of the following operations cannot be guaranteed to run in constant time?

Consider a singly linked list implemented using the above  class. Assume that: • variable  points to the first node of t

Select all that apply.

  1. A

    Inserting a new node at the front of the linked list.

  2. B

    Inserting a new node at the end of the linked list.

  3. C

    Deleting the first node of the linked list.

  4. D

    Deleting the last node of the linked list.

  5. E

    Accessing the second last node of the linked list.

Show answer

Correct answers

  • D

    Deleting the last node of the linked list.

  • E

    Accessing the second last node of the linked list.

Question 10

+3 marksOne or more correct options

Which of the following is/are possible degree sequence(s) of the vertices of a connected undirected graph with five vertices? Note: Degree sequence is a series of positive integers where each is the degree of the vertex of the graph.

Select all that apply.

  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

  5. E

    —

Show answer

Correct answers

  • B

    —

  • C

    —

  • D

    —

Question 11

+3 marksOne or more correct options

Which of the following statement(s) is/are true about Breadth First Search (BFS) in an unweighted graph ?

Select all that apply.

  1. A

    BFS goes deep along a path before visiting all neighbors at the same level.

  2. B

    BFS can be used to find the shortest path in a weighted graph with arbitrary positive edge weights without any modification in graph.

  3. C

    BFS uses a queue to keep track of vertices to be explored.

  4. D

    BFS traversal depends on the choice of the starting vertex.

  5. E

    BFS explores all neighbors of a vertex before moving to vertices at the next level.

Show answer

Correct answers

  • C

    BFS uses a queue to keep track of vertices to be explored.

  • D

    BFS traversal depends on the choice of the starting vertex.

  • E

    BFS explores all neighbors of a vertex before moving to vertices at the next level.

Question 12

+3 marksOne correct option

You are given a non-empty list of integers sorted in ascending order. Every element in the list appears exactly twice, except for one element that appears only once. For example, the list may look like , where the element 3 appears only once. What is the time complexity of the most efficient algorithm to find the element that appears only once?

  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • D

    —

Question 13

+3 marksOne correct option

You are implementing binary search on a sorted list L that may contain duplicate values. You need to find the index of the last occurrence of X . If an instance of X is found at L[mid] , how should the search proceed to find the last possible occurrence?

  1. A

    Store mid as a potential answer and continue searching in the left subarray by setting high = mid - 1 .

  2. B

    Immediately return mid , as binary search on a sorted array with duplicates will always find the last occurrence if multiple exist.

  3. C

    Store mid as a potential answer and continue searching in the right subarray by setting low = mid + 1 .

  4. D

    Discard mid and search both the left ( high = mid - 1 ) and right ( low = mid + 1 ) subarrays recursively.

Show answer

Correct answer

  • C

    Store mid as a potential answer and continue searching in the right subarray by setting low = mid + 1 .

Question 14

+3 marksOne correct option

Let be a stack and be a queue supporting the following operations: Assume that supports the standard stack operations and , and supports the standard queue operations and . Suppose the initial state of the queue where 12 is at the front and 18 is at the rear, and the stack S is empty initially. The following sequence of operations is performed:

After performing the given sequence of operations, what will be the front and rear elements in queue Q?

Let  be a stack and  be a queue supporting the following operations: Assume that  supports the standard stack operations
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • B

    —

Question 15

+3 marksOne correct option

For a connected undirected graph with 7 vertices, which of the following gives the correct minimum and maximum possible number of edges?

  1. A

    Min: 5 , Max: 21

  2. B

    Min: 6 , Max: 20

  3. C

    Min: 6 , Max: 21

  4. D

    Min: 7 , Max: 21

Show answer

Correct answer

  • C

    Min: 6 , Max: 21

Question 16

+3 marksOne correct option

Let G be a connected undirected graph with n vertices represented using an adjacency matrix. In the DFS implementation given below, assume that checking whether a vertex has already been visited takes time.

What is the tightest upper bound for the worst case time complexity of DFS?

Let G be a connected undirected graph with n vertices represented using an adjacency matrix.  In the DFS implementation
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • C

    —

Question 17

+2 marksOne correct option

Select the most appropriate data structure for the following operations:

Select the most appropriate data structure for the following operations:
  1. A

    1 - ii, 2 - i, 3 - iii, 4 - iv

  2. B

    1 - ii, 2 - i, 3 - iv, 4 - iii

  3. C

    1 - i, 2 - iii, 3 - ii, 4 - iv

  4. D

    1 - iii, 2 - ii, 3 - i, 4 - iv

Show answer

Correct answer

  • A

    1 - ii, 2 - i, 3 - iii, 4 - iv