GATE CS Programming & Data Structures Previous Year Questions

17 solved GATE CS questions on Programming & Data Structures, drawn from 1 exam year and grouped by year. Every question shows the official answer and a step-by-step solution.

GATE CS 202417 questions

  1. Set 1 Q17Given an integer array of size NN, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by…MCQ · +1 marks · Easy
  2. Set 1 Q18Consider the following C program: [code] Which one of the following statements is CORRECT?MCQ · +1 marks · Easy
  3. Set 1 Q19Consider the following C program: [code] Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the…MCQ · +1 marks · Medium
  4. Set 1 Q21In a B+B^+ tree, the requirement of at least half-full (50%) node occupancy is relaxed for which one of the following cases?MCQ · +1 marks · Easy
  5. Set 1 Q33Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below. | Operator | Precedence | Associativity…NAT · +1 marks · Medium
  6. Set 1 Q41An array [82,101,90,11,111,75,33,131,44,93][82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified…MCQ · +2 marks · Medium
  7. Set 1 Q43Consider a binary min-heap containing 105 distinct elements. Let kk be the index (in the underlying array) of the maximum element stored in the heap. The…MCQ · +2 marks · Medium
  8. Set 1 Q45Let GG be a directed graph and TT a depth first search (DFS) spanning tree in GG that is rooted at a vertex vv. Suppose TT is also a breadth first search…MSQ · +2 marks · Hard
  9. Set 1 Q48Consider the following C function definition. [code] Which of the following statements is/are TRUE about the above function?MSQ · +2 marks · Medium
  10. Set 1 Q60The number of edges present in the forest generated by the DFS traversal of an undirected graph GG with 100 vertices is 40. The number of connected components…NAT · +2 marks · Easy
  11. Set 2 Q13Consider the following C program. Assume parameters to a function are evaluated from right to left. [code] Which one of the following options is the CORRECT…MCQ · +1 marks · Medium
  12. Set 2 Q17Let AA be the adjacency matrix of a simple undirected graph GG. Suppose AA is its own inverse. Which one of the following statements is always TRUE?MCQ · +1 marks · Medium
  13. Set 2 Q33Consider the following C function definition. [code] Which of the following statements is/are TRUE?MSQ · +1 marks · Medium
  14. Set 2 Q36What is the output of the following C program? [code]MCQ · +2 marks · Medium
  15. Set 2 Q39You are given a set VV of distinct integers. A binary search tree TT is created by inserting all elements of VV one by one, starting with an empty tree. The…MCQ · +2 marks · Medium
  16. Set 2 Q42Consider an array XX that contains nn positive integers. A subarray of XX is defined to be a sequence of array locations with consecutive indices. The C…MCQ · +2 marks · Hard
  17. Set 2 Q48Let S1 and S2 be two stacks. S1 has capacity of 4 elements. S2 has capacity of 2 elements. S1 already has 4 elements: 100, 200, 300, and 400, whereas S2 is…MSQ · +2 marks · Hard

Other GATE CS topics

Practice Programming & Data Structures with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free