Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations

CUET PG MCA Previous Year Questions (PYQs)

CUET PG MCA Data Structures PYQ


CUET PG MCA PYQ
Which of the following is not an application of DFS?





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

  • Topological Sort → Can be done using DFS (by finishing times). ✅

  • Strongly Connected Components (SCCs) → Kosaraju’s and Tarjan’s algorithms use DFS. ✅

  • Solving Maze Problem → DFS is a valid approach to explore paths in a maze. ✅

  • Finding minimum distance in an unweighted graph → This requires Breadth First Search (BFS), not DFS, because BFS ensures the shortest path in an unweighted graph. ❌


CUET PG MCA PYQ
In a binary search tree, the worst case time complexity of inserting and deleting a key is:





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

Insertion: To insert, we first locate the correct position. This requires searching the tree = height \(h\). Worst case: tree is skewed (\(h=n\)) → \(O(n)\).

Deletion: To delete, we also search for the node (\(O(h)\)) and adjust pointers (constant). Worst case: \(h=n\). So, time = \(O(n)\).

✅ Therefore: \[ \text{Insertion: } O(n), \quad \text{Deletion: } O(n) \]

CUET PG MCA PYQ
In __________the search time is independent of the number of elements n.





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

We need to find the search method where the search time is independent of the number of elements \(n\).

Binary Search: Time complexity \(O(\log n)\). Depends on \(n\). ❌
Hashing: Average case \(O(1)\). Independent of \(n\) (worst case \(O(n)\)). ✅
Linear Search: Time complexity \(O(n)\). Depends on \(n\). ❌
Jump Search: Time complexity \(O(\sqrt{n})\). Depends on \(n\). ❌

Therefore: \[ \text{Correct Answer: Hashing (Option 2).} \]

CUET PG MCA PYQ
The statements of pseudocode for searching the first element with key k in the linked list L are given below. 
Arrange them in the correct order. 

(A) while (x!=NIL and x.key != k) 

(B) x=L.head 

(C) x=x.next 

(D) return x 

Choose the correct answer from the options given below: 





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

Given statements:
(A) \(\; \text{while }(x \neq NIL \;\wedge\; x.key \neq k)\)
(B) \(\; x = L.head\)
(C) \(\; x = x.next\)
(D) \(\; \text{return } x\)

Correct order:
1. Initialize pointer: \((B)\) → \(x = L.head\)
2. Loop until end or key found: \((A)\) → \(\text{while}(x \neq NIL \;\wedge\; x.key \neq k)\)
3. Move to next node: \((C)\) → \(x = x.next\)
4. Return result: \((D)\) → \(\text{return }x\)

✅ Therefore, the correct sequence is: \[ (B), (A), (C), (D) \]

CUET PG MCA PYQ
Arrange the following time complexities in increasing order.
(A). Bubble sort (worst case) 

(B). Deleting head node in singly linked list 

(C). Binary search 

(D). Worst case of merge sort 

Choose the correct answer from the options given below: 
1. (A), (B), (C), (D) 
2. (B), (C), (D), (A) 
3. (B), (A), (D), (C) 
4. (C), (B), (D), (A)





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

Step 1: Note the time complexities
(A) Bubble Sort (worst case): \(O(n^2)\)
(B) Deleting head node in singly linked list: \(O(1)\)
(C) Binary Search: \(O(\log n)\)
(D) Merge Sort (worst case): \(O(n \log n)\)

Step 2: Arrange in increasing order
\[ O(1)\;<\;O(\log n)\;<\;O(n \log n)\;<\;O(n^2) \] So: \[ (B)\;<\;(C)\;<\;(D)\;<\;(A) \]

CUET PG MCA PYQ
The Quicksort and randomized Quicksort procedures differ in: 
1. Selection of Pivot element 
2. Worst case time complexity 
3. Best case time Complexity 
4. Final Output





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

The difference between Quicksort and Randomized Quicksort lies mainly in the way the pivot element is chosen. Let’s analyze each option:

  1. Selection of Pivot element ✅

    • Quicksort: Pivot is chosen deterministically (e.g., always first element, last element, or middle element).

    • Randomized Quicksort: Pivot is chosen randomly (uniformly among available elements).
      → This is the key difference.

  2. Worst case time complexity ❌

    • For both, the worst case is still O(n²).

    • Randomization only reduces the chance of hitting the worst case often, but it does not eliminate it.

  3. Best case time Complexity ❌

    • Both have the same best case: O(n log n) (when pivot splits the array evenly).

    • Randomization doesn’t change the best case.

  4. Final Output ❌

    • Both produce the same sorted output.

    • Randomization only affects the process, not the final result.


CUET PG MCA PYQ
In case of Binary search tree which of the following procedure's running time is distinct among all 

1. TREE-SUCCESSOR (finds successor of the given node) 
2. TREE-MAXIMUM (finds the node with maximum value) 
3. INORDER- WALK (prints all elements of a tree in inorder manner) 
4. TREE-MINIMUM (finds the node with minimum value)





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

BST Procedure Time Complexities (MathJax):

  • 1. TREE-SUCCESSOR: \( O(h) \)
  • 2. TREE-MAXIMUM: \( O(h) \)
  • 4. TREE-MINIMUM: \( O(h) \)
  • 3. INORDER-WALK: \( \Theta(n) \)

Since \(O(h)\) differs from \( \Theta(n) \) and INORDER-WALK always visits all \(n\) nodes,

\[ \boxed{\text{Distinct running time: INORDER-WALK (Option 3)}} \]


CUET PG MCA PYQ
Match List-I with List-II
 List-I List-II
 (Algorithm/ Application) (Data Structure Used)
 (A). BFS (1). Stack
 (B). DFS (II). B Trees
 (C). Heap sort (III). Priority Queue
 (D). Storage on secondary storages devices (IV). Queue
Choose the correct answer from the options given below:

1. (A) - (IV), (B)-(I), (C)-(III), (D) - (II) 
2. (A)-(I), (B)-(III), (C)-(II), (D-(IV) 
3. (A)-(I), (B)-(II), (C) - (IV), (D) (III) 
4.(A)-(II), (B)-(IV), (C)-(I) (D)-(II)





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

Match the pairs:

  • (A) BFS → Queue (IV)

  • (B) DFS → Stack (I)

  • (C) Heap Sort → Priority Queue (III)

  • (D) Storage on secondary storage devices → B-Trees (II)


CUET PG MCA PYQ
Given the index i of a node in a heap, we can not compute: 
1. Parent () 
2. Heap size 
3. Left (i) 
4. Right (i)





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

In a binary heap (array representation):

Parent(i) = \(\left\lfloor \tfrac{i}{2} \right\rfloor\),   Left(i) = \(2i\),   Right(i) = \(2i+1\)

All three can be computed directly from the index i.

But the heap size depends on the total number of elements \((n)\), which cannot be determined from i alone.

\(\therefore\) Correct Answer: (2) Heap size


CUET PG MCA PYQ
All the elements that hash to the same slot are placed into the same linked list in : 
1. Universal hashing 
2. Linear Probing 
3. Quadratic probing 
4. Chaining





Go to Discussion

CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

Solution

  • Linear Probing → collisions resolved by moving sequentially to next free slot.

  • Quadratic Probing → collisions resolved by quadratic jumps.

  • Universal Hashing → refers to a family of hash functions, not directly a collision handling method.

  • Chaining → collisions are handled by storing all elements in the same slot using a linked list (or another secondary structure).


  • CUET PG MCA PYQ
    Match List-I with List-II
     List-I List-II
     (Algorithm) (Recurrence relation)
    (A).Binary Search(I).  $T(n)=T(n/2)+c$ (where c is a constant)
     (B).Merge Sort (II). $T(n)=2T(n/2)+\Theta(n)$
     (C). Quick sort (worst case partitioning) (III). $T(n)=T(n-1)+\Theta$ (n)
     (D). Linear Search (IV). $T(n)=T(n-1)+c$ (where c is a constant)
    Choose the correct answer from the options given below:
    1. . (A) (I), (B) (II), (C) - (III), (D) - (IV)
    2.  (A) - (I), (B) - (III), (C) - (II), (D) - (IV)
    3.  (A) - (I), (B) - (II), (C)-(IV), (D)-III 
    4. (A) (III), (B) - (IV), (C) - (I), (D) - (II)





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

    Solution

    Binary Search → $T(n)=T(n/2)+c$ → (I)
    - Merge Sort → $T(n)=2T(n/2)+\Theta(n)$ → (II)
    - Quick Sort (worst case) → $T(n)=T(n-1)+\Theta(n)$ → (III)
    - Linear Search → $T(n)=T(n-1)+c$ → (IV)

    Correct Answer: Option (1)

    CUET PG MCA PYQ
    Which of the following statements are TRUE, where |E| represents the number of edges. 

    (A). In case of a directed graph, the sum of lengths of all the adjacency list is E 

    (B). For an undirected graph, the sum of the lengths of all the adjacency list is 2|E| 

    (C). For a dense graph, adjacency matrix representation is preferable 

    (D). The memory requirement of the adjacency matrix of a graph is dependent on the number of edges 

    Choose the correct answer from the options given below:
    1. (A), (B) and (D) only 
    2. (A), (B) and (C) only 
    3. (A), (B), (C) and (D) 
    4. (B), (C) and (D) only





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2025 PYQ

    Solution

    - (A) ✅ True: In a directed graph, each edge appears once in exactly one adjacency list ⇒ total length = \(|E|\).
    - (B) ✅ True: In an undirected graph, each edge appears twice (both endpoints) ⇒ total length = \(2|E|\).
    - (C) ✅ True: For dense graphs \((|E| \approx \Theta(V^2))\), adjacency matrix is preferable (fast \(O(1)\) lookups, storage \(O(V^2)\)).
    - (D) ❌ False: Adjacency matrix memory depends only on \(V^2\), not on \(|E|\).

    Final Answer: Option (2) — (A), (B) and (C) only

    CUET PG MCA PYQ
    Consider implementation of database. Among the following options, choose the most appropriate data structure for this





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution

    When implementing a database, the most appropriate data structure depends on what part of the database you’re focusing on. Among common options, the standard and most suitable choice is:

    B-Tree (or B+ Tree)

    • Used by almost all modern databases (MySQL, PostgreSQL, Oracle, etc.) to implement indexes.

    • Provides efficient search, insert, delete, and range queries in O(log n) time.

    • Optimized for disk storage and block reads, making it ideal for large datasets.


    Other data structures used in databases:

    1. Hash Tables

      • Used for hash indexes and quick equality lookups (e.g., WHERE id = 100).

      • Very fast for exact matches but not good for range queries.

    2. Heaps

      • Used to store unsorted table data.

      • Simple structure but inefficient for searches without indexes.

    3. Linked Lists

      • Used internally for things like transaction logs and some in-memory structures.

    4. Trie / Radix Trees

      • Sometimes used for full-text search or prefix matching.


    CUET PG MCA PYQ
    Each node is having a successor node in ________________:





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution

    Each node is having a successor node in a Linked List.

    • In a linked list, every node contains data and a pointer (or reference) to its successor node (the next node in the sequence).

    • The last node points to NULL (in a singly linked list) or back to the head (in a circular linked list).


    CUET PG MCA PYQ
    Consider a completely skewed (left / right) binary search tree with n elements. What is the worst case time complexity of searching an element in this tree?





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution

    A completely skewed BST (all nodes on one side) has height \(n\). Searching may traverse every node in the worst case.

    Worst-case time complexity: \(O(n)\)


    CUET PG MCA PYQ
    If we want to find last node of a singly linked list then the correct coding is





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution

    To find the last node of a singly linked list, we must keep moving until the link (next pointer) becomes NULL. This ensures we stop exactly at the last node.

    
    // Structure of node
    struct Node {
        int data;
        struct Node* link;
    };
    
    // Function to get last node
    struct Node* getLastNode(struct Node* head) {
        struct Node* temp = head;
    
        // Traverse until last node
        while (temp -> link != NULL) {
            temp = temp -> link;
        }
    
        return temp;  // Now temp points to last node
    }
      

    Explanation:

    • Initialize a pointer temp with head.
    • Keep moving forward using temp = temp → link while temp → link != NULL.
    • When loop ends, temp is pointing to the last node.

    Correct Code Logic: while (temp → link != NULL) temp = temp → link;


    CUET PG MCA PYQ
    Arrange the following in the increasing order of their asympotic complexities:
    (A) Insertion sort (best case)  
    (B) Bubble sort (worst case) 
    (C) Binary Search (worst case)
    (D) Merge sort (worst case)





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution


    CUET PG MCA PYQ
    The following integers are needed to be stored in ascending order using bubble sort.
    5, 8, 22, 18, 1
    Following are the results of various passes during the sorting process.





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution


    CUET PG MCA PYQ
    What are the ways to implement a priority Queue?
    (A) Arrays 
    (B) Fibonacci tree 
    (C) Heap Data Structure 
    (D) Linked list

    Choose the correct answer from the options given below:





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution

    Ways to Implement a Priority Queue

    The correct answer is:

    (A) Arrays, (C) Heap Data Structure, and (D) Linked List

    Explanation:

    • Arrays:
      • Unsorted Array: Insertion is O(1), Deletion is O(n).
      • Sorted Array: Insertion is O(n), Deletion is O(1).
    • Heap Data Structure:
      • Binary heaps are commonly used for efficient implementation.
      • Insertion and Deletion take O(log n) time.
    • Linked List:
      • Can be implemented as sorted or unsorted.
      • Efficiency depends on the choice of implementation.

    Why not Fibonacci Tree?

    Fibonacci trees are not used directly for priority queues. However, Fibonacci heaps (a separate data structure) can implement priority queues efficiently.


    CUET PG MCA PYQ
    Match List – I with List – II
     List - I (Algorithms) List - II (Complexity)
     (A) Bellman - Ford algorithm (with adjacencylist representation)  (I) $O(|V|^2)$
    (B) Dijkstra Algorithm   (II) O((V+E) logV)
    (C) Prim’s Algorithm  (III) O(mn)
    (D) Topological sorting (with adjacency list representation)  (IV) O(m+n)
    Choose the correct answer from the options given below:





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution


    CUET PG MCA PYQ
    Which of the following is not an applicaiton of Stack?





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution


    CUET PG MCA PYQ
    Consider the following tree. This is a / a _________________





    Go to Discussion

    CUET PG MCA Previous Year PYQ CUET PG MCA CUET 2024 PYQ

    Solution



    CUET PG MCA


    Online Test Series,
    Information About Examination,
    Syllabus, Notification
    and More.

    Click Here to
    View More

    CUET PG MCA


    Online Test Series,
    Information About Examination,
    Syllabus, Notification
    and More.

    Click Here to
    View More

    Ask Your Question or Put Your Review.

    loading...