∑GateAndNet
PlannerSign Up

Programming & Data Structures — Solved PYQ & Mock Arena

Topic-wise Programming & Data Structures previous-year GATE & UGC NET questions with step-by-step LaTeX solutions

Showing 15 questions in C & Data StructuresClick A / B / C / D for instant verification
Q1GATE CS 2024 Set-1Programming & Data StructuresMCQEASY
+1M • -0.33

In a Binary Max-Heap containing n=100n = 100 distinct elements stored in a 1-indexed array H[1..100], in which subarray index range MUST the minimum element reside?

⚡ Click an option above to verify instantly
Q2GATE CS 2025Programming & Data StructuresNATMEDIUM
+2M • 0 Neg

How many times is the printf statement executed when fun(6) is called for void fun(int n) { if (n <= 1) return; fun(n - 1); printf("*"); fun(n - 2); }?

Q3GATE CS 2017Programming & Data StructuresMCQMEDIUM
+2M • -0.67

The Preorder traversal of a Binary Search Tree (BST) is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which of the following is its Postorder traversal?

⚡ Click an option above to verify instantly
Q4GATE CS 2019Programming & Data StructuresMCQMEDIUM
+2M • -0.67

Keys 12, 18, 13, 2, 3, 23, 5, 15 are inserted in order into an initially empty hash table of size m=10m = 10 using h(k)=k mod 10h(k) = k \bmod 10 and Linear Probing. At which index is key 15 placed?

⚡ Click an option above to verify instantly
Q5GATE CS 2020Programming & Data StructuresNATMEDIUM
+2M • 0 Neg

What is the minimum number of nodes in a height-balanced AVL tree of height h=5h = 5 (where a single root node has height h=0h = 0)?

Q6GATE CS 2024 Set-2Programming & Data StructuresNATEASY
+2M • 0 Neg

Evaluate the postfix expression 10 5 + 60 6 / * 8 - using a standard operand stack.

Q7GATE CS 2022Programming & Data StructuresNATEASY
+1M • 0 Neg

Consider the C snippet int x = 0, y = 5, z = 10; int k = (x && ++y) || (z++ && ++x);. What is the value of y + z + x + k after execution?

Q8GATE CS 2023Programming & Data StructuresMCQMEDIUM
+2M • -0.67

In C, let int A[4][5] be stored in Row-Major order starting at base memory address 1000 with sizeof(int) = 4 bytes. What are the numerical address values of (A + 2) and (&A + 1) respectively?

⚡ Click an option above to verify instantly
Q9GATE CS 2024 Set-1Programming & Data StructuresNATMEDIUM
+2M • 0 Neg

What integer value is printed by the following C program?

c
#include <stdio.h>
int f(int n) {
    static int r = 0;
    if (n <= 0) return 1;
    if (n > 3) {
        r = n;
        return f(n - 2) + 2;
    }
    return f(n - 1) + r;
}
int main(void) {
    printf("%d", f(5));
    return 0;
}
Q10UGC NET / GATE DSAProgramming & Data StructuresMCQEASY
+1M • -0.33

Which open-addressing collision resolution technique eliminates both primary and secondary clustering?

⚡ Click an option above to verify instantly
Q11GATE CS DSAProgramming & Data StructuresMCQMEDIUM
+2M • -0.67

What is the minimum number of nodes in an height-balanced AVL tree of height h=4h = 4 (where a single root node has height 00)?

⚡ Click an option above to verify instantly
Q12GATE CS DSAProgramming & Data StructuresMCQEASY
+2M • -0.67

Evaluate the postfix (Reverse Polish) expression: 8 2 3 ^ / 2 3 * + 5 1 * - where ^ denotes exponentiation.

⚡ Click an option above to verify instantly
Q13GATE CS DSAProgramming & Data StructuresMCQMEDIUM
+2M • -0.67

What is the tight worst-case time complexity of building a Binary Max-Heap bottom-up (Build-Max-Heap) from an unsorted array of nn elements?

⚡ Click an option above to verify instantly
Q14GATE CS DSAProgramming & Data StructuresMCQEASY
+1M • -0.33

A binary tree has 2525 nodes with degree 22 (two children) and 1212 nodes with degree 11. How many leaf nodes (degree 00) does the binary tree contain?

⚡ Click an option above to verify instantly
Q15GATE CS C TraceProgramming & Data StructuresNATMEDIUM
+2M • 0 Neg

What integer value is returned by calling f(5) for the C function int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = n; return f(n - 2) + 2; } return f(n - 1) + r; }?