Programming and Data Structures (PDS) is the largest technical subject in GATE CS: about 10 marks per paper, or roughly 10.2% of the 100-mark paper. We counted every PDS question in all 23 official GATE CS papers from 2014 to 2026. PDS averaged 10.2 marks and ranged from 5 to 17. More than half of those marks come from one skill: tracing C code, especially recursion. PDS is also the most accessible subject: only 8 of its 153 questions are rated hard. This guide covers the official 2027 syllabus, topic-by-topic numbers, five worked questions from past papers and a study order based on that data.
How we counted: we classified all 1,495 GATE CS questions from 2014 to 2026 by subject and topic, using the official papers as reproduced on Success Tracker's GATE CS PYQ archive. We followed the official syllabus split. Questions on C and on data structures themselves (arrays, stacks, queues, linked lists, trees, BSTs, heaps, graph representations) are counted here. Hashing, searching, sorting and graph algorithms are counted under Algorithms. Software-engineering questions from 2014–2015, which are no longer in the syllabus, are excluded. A few questions appear twice in the 2015 papers on that archive, and we counted each of those only once. Confirm the syllabus on the official GATE 2027 syllabus page (IIT Madras).
GATE CS 2027 Programming and Data Structures Syllabus
Programming and Data Structures is Section 4 of the official GATE 2027 CS syllabus. The official text lists:
- Programming in C
- Recursion
- Arrays, stacks, queues, linked lists
- Trees, binary search trees, binary heaps
- Graphs
This is identical to the GATE 2026 CS syllabus. The programming language is C only: no C++, Java or Python. AVL trees are not named, but they have appeared twice as part of tree questions. For the full CS syllabus, see our GATE CS syllabus page.
How Many Marks Does PDS Carry in GATE CS?
The official question paper pattern fixes marks only for General Aptitude (15) and Engineering Mathematics (13). This is what PDS carried in each paper:
| Year | Marks per paper (set-wise) | % of the 100-mark paper | Questions |
|---|---|---|---|
| 2014 | 6 / 11 / 5 | 6% / 11% / 5% | 5 / 7 / 4 |
| 2015 | 10 / 7 / 17 | 10% / 7% / 17% | 7 / 5 / 11 |
| 2016 | 11 / 13 | 11% / 13% | 7 / 8 |
| 2017 | 11 / 12 | 11% / 12% | 7 / 8 |
| 2018 | 12 | 12% | 8 |
| 2019 | 12 | 12% | 7 |
| 2020 | 11 | 11% | 7 |
| 2021 | 6 / 8 | 6% / 8% | 4 / 6 |
| 2022 | 9 | 9% | 6 |
| 2023 | 9 | 9% | 6 |
| 2024 | 11 / 10 | 11% / 10% | 7 / 6 |
| 2025 | 9 / 14 | 9% / 14% | 6 / 9 |
| 2026 | 11 / 9 | 11% / 9% | 7 / 5 |
| Average (23 papers) | 10.2 | 10.2% (range 5–17%) | 6.7 |
What this means: PDS has the most questions of any technical subject, about 6 to 7 per paper. It has carried 9 marks or more in every paper since 2022. Together with Algorithms (7.9 marks per paper), it makes up about 18 marks, the largest block in the paper after General Aptitude. For how PDS compares with other subjects, see our GATE CSE subject-wise weightage analysis.
Topic-Wise Weightage: Where PDS Marks Come From
We grouped the 153 PDS questions by syllabus heading, with the average marks per paper across all 23 papers:
| Topic | Questions | Total marks | Avg marks per paper (23 papers) | Last asked |
|---|---|---|---|---|
| C programming and recursion | 76 | 122 | 5.3 | 2026 |
| Trees and binary search trees | 26 | 33 | 1.4 | 2026 |
| Binary heaps | 17 | 27 | 1.2 | 2026 |
| Stacks and queues | 12 | 20 | 0.9 | 2026 |
| Arrays (as a data structure) | 8 | 15 | 0.7 | 2024 |
| Graphs (representation and traversal) | 8 | 11 | 0.5 | 2025 |
| Linked lists | 6 | 6 | 0.3 | 2023 |
Within C programming, the most-asked topics were functions and recursion (27 questions, 42 marks; by question count, the most-asked topic in the whole CS paper), arrays and strings in C (21 questions, 33 marks) and control flow (14 questions, 24 marks). Among data structures, binary search trees led with 14 questions and 19 marks.
Three patterns stand out:
- C code tracing is about half of PDS. C programming and recursion carried 122 of 234 PDS marks (52%). Almost all of it is "what does this program print" or "what does this function return". That is a skill you build with practice, not a theory chapter.
- Stacks and queues have doubled, from 0.6 to 1.2 marks per paper. Recent questions combine stacks and queues, or set capacity limits, and are usually MSQs.
- Trees and heaps are steady, at about 2.7 marks per paper between them. Questions test properties (height, number of nodes, heap order) more than code.
Question Types in PDS
From 2021 to 2026, the 62 PDS questions split into 27 MCQs, 27 NATs and 8 MSQs, carrying 41, 42 and 13 marks respectively. NATs carried 44% of PDS marks. For a code-tracing NAT, you must get the exact output, with no options to check against. Wrong NAT and MSQ answers carry no penalty, while a wrong MCQ costs 1/3 or 2/3 mark (official marking rules).
Success Tracker rates 53 PDS questions as easy, 92 as medium and only 8 as hard, about 5%. Only DBMS and Digital Logic have a similarly low share of hard questions. With steady practice, PDS can give you a high score.
Topic by Topic: What GATE Asks and How to Prepare
1. C Programming and Recursion
What gets asked: the output of programs with recursion, static variables, pointer arithmetic, 2D arrays, string handling, operator precedence and parameter passing; what a recursive function computes; and how many times a call or a loop runs.
How to prepare: trace every program on paper with a table that has a column for each variable. For recursion, draw the call tree, or find the pattern on small inputs and generalise (worked example 1). Learn the C details that GATE tests repeatedly: static keeps its value between calls, arrays decay to pointers, a[i] is *(a + i), and integer division truncates.
Recent PYQs: output of a C program (2026, NAT), recursive function analysis (2026), pointer assignment trace (2026, NAT).
2. Trees and Binary Search Trees
What gets asked: the maximum and minimum height of binary trees, node and leaf counts, reconstructing a tree from traversals, BST insertion order and the resulting shape, and the number of BSTs possible.
How to prepare: learn the counting identities. A full binary tree with n nodes has (n + 1)/2 leaves and height at most (n − 1)/2 (worked example 4). A binary tree of height h has at most 2h+1 − 1 nodes. The inorder traversal of a BST is sorted. For traversal questions, the preorder or postorder sequence identifies the root and the inorder sequence splits the subtrees.
Recent PYQs: matching traversals (2026), insertion orders of 1 to 15 (2026), BST with n leaves (2026, MSQ).
3. Binary Heaps
What gets asked: the result of build-heap on an array, insert and extract-min/max, where the k-th smallest element can sit, heap height, and the cost of merging heaps.
How to prepare: practise bottom-up build-heap by hand. Start at the last internal node, index ⌊n/2⌋ − 1 with 0-based indexing, and sift down (worked example 3). A heap with n keys has height ⌊log2 n⌋. Build-heap is O(n), not O(n log n).
Recent PYQs: min-heap with odd n (2026, MSQ), meld operation costs (2025).
4. Stacks and Queues
What gets asked: sequences of push, pop, enqueue and dequeue with capacity limits, possible output orders, circular queue conditions, and evaluating infix and postfix expressions.
How to prepare: simulate operations one step at a time and write the full contents after each step. For "which output orders are possible", remember that if a, b and c are pushed in that order (with pops allowed in between), the stack can never output c, then a, then b.
Recent PYQs: stack and queue together (2026, MSQ), stack of records (2025, MSQ), operator precedence (2024, NAT).
5. Arrays, Linked Lists and Graphs
What gets asked: subarray and 2D-array index questions, linked-list deletion and reversal costs, and graph representations and traversal-based counts (connected components, DFS forest edges).
How to prepare: these are smaller topics. Learn the cost of each operation for each representation, for example deleting a node in a singly versus a doubly linked list, or checking an edge in an adjacency matrix versus a list. Then solve the PYQs.
Recent PYQs: graph algorithm trace (2025, NAT), edges in a DFS forest (2024, NAT), deleting from a singly linked list (2023).
Worked Examples from Official GATE CS Papers
Each answer below matches the official answer key, as reproduced on the linked question page.
Example 1: Nested recursion (GATE CS 2026 Set 1, Q61, 2 marks, NAT)
Question: bar(n) returns 0 if n = 1, else 1 + bar(n/2). foo(n) returns 1 if n = 1, else 1 + foo(bar(n)). What is the smallest n for which foo(n) = 5?
Solution: bar(n) = ⌊log2 n⌋. Work backwards. foo = 1 at n = 1. foo = 2 first at n = 2, since bar(2) = 1. foo = 3 first at n = 4, since bar(4) = 2. foo = 4 first at n = 16, since bar(16) = 4. foo = 5 needs bar(n) = 16, so the answer is n = 216 = 65536. Practise this question.
Example 2: Pointer trace (GATE CS 2026 Set 2, Q60, 2 marks, NAT)
Question: a = 5, b = 11, c = 20; ptr = &a; *ptr = c; ptr = &c; a = *(&b); c = *ptr − a; print c.
Solution: *ptr = c sets a to 20. ptr then points to c. a = *(&b) sets a to 11. Then c = *ptr − a = 20 − 11 = 9. Write the variables in a table and update them line by line. Don't track them in your head. Practise this question.
Example 3: Build-heap (GATE CS 2024 Set 1, Q41, 2 marks)
Question: [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified into a max-heap. What are the first three elements?
Solution: sift down from index 4 to index 0. Index 4 (111) is unchanged. Index 3 swaps 11 with 131. Index 2 (90) is unchanged. Index 1 swaps 101 with 131. Index 0 swaps 82 with 131, and then 82 sinks past 111 and then 93. The array starts with 131, 111, 90. Practise this question.
Example 4: Tallest full binary tree (GATE CS 2026 Set 1, Q33, 1 mark, NAT)
Question: what is the maximum height, in edges, of a full binary tree with 23 nodes?
Solution: in a full binary tree every node has 0 or 2 children. The tallest shape gives each internal node one leaf child, so each level adds 2 nodes. That gives n = 2h + 1, so h = (23 − 1) ÷ 2 = 11. Practise this question.
Example 5: Heap height (GATE CS 2025 Set 1, Q35, 1 mark, NAT)
Question: a min-heap stores 32 keys. What is its height, in edges?
Solution: a heap is a complete binary tree. Levels 0 to 4 hold 1 + 2 + 4 + 8 + 16 = 31 keys, so the 32nd key starts level 5. The height is ⌊log2 32⌋ = 5. Practise this question.
Study Order and Time Plan
PDS takes roughly 5 to 6 weeks at 2 hours a day, and code-tracing practice should keep going until the exam. Study it before Algorithms.
- C fundamentals (7–8 days): data types, operators, control flow, functions, scope and
static. - Pointers, arrays and strings (6–7 days): pointer arithmetic, 2D arrays and parameter passing.
- Recursion (5–6 days): call trees, return values, and finding patterns from small inputs.
- Stacks, queues and linked lists (4 days).
- Trees and BSTs (5 days): counting identities, traversals and insertion order.
- Heaps and graph representations (4 days).
- PYQ sweep and daily tracing (ongoing): all 153 PDS questions from 2014 to 2026 on the GATE CS PYQ archive, then two or three code-tracing questions a day until the exam.
For where PDS fits among all the subjects, see the GATE CSE 2027 month-by-month study plan.
Best Books for GATE CS PDS
| Book | Use it for |
|---|---|
| Kernighan & Ritchie, The C Programming Language (2nd ed.) | Exact C semantics: pointers, arrays, scope and storage classes. |
| Mark Allen Weiss, Data Structures and Algorithm Analysis in C | Stacks, queues, lists, trees, BSTs, heaps and graphs, all in C. |
| Yashavant Kanetkar, Let Us C | A gentler first pass if you are new to C. |
For other subjects, see our best books for GATE CSE 2027. The full course, covering all subjects with lectures and mock tests, is on the GATE CS course page.
Common Mistakes in GATE PDS
- Tracing code in your head. Write a variable table for every line that changes a value (Example 2).
- Forgetting that
staticvariables keep their value between function calls. - Getting the indexing base wrong in heaps: children are 2i + 1 and 2i + 2 with 0-based indexing, and 2i and 2i + 1 with 1-based.
- Mixing up height in edges and in levels. Every GATE question defines it, so read the definition.
- Assuming build-heap is O(n log n). Bottom-up build-heap is O(n).
Key Takeaways
- PDS averaged 10.2 marks per paper (10.2% of the paper) across 23 official GATE CS papers (2014–2026), the most of any technical subject.
- C programming and recursion carry 52% of PDS marks. Functions and recursion alone is the most-asked topic in the whole paper by question count.
- Stacks and queues doubled to about 1.2 marks per paper since 2021.
- Only about 5% of PDS questions are rated hard, so steady tracing practice pays off reliably.
Frequently Asked Questions
How many marks does Programming and Data Structures carry in GATE CS?
The official pattern does not fix marks per CS subject. Across all 23 official GATE CS papers from 2014 to 2026, PDS averaged 10.2 marks per paper, which is 10.2% of the 100-mark paper, with a range of 5 to 17. It is the largest technical subject.
Which programming language is used in GATE CS?
C. The official 2027 syllabus says "Programming in C", and code questions are written in C.
Which PDS topics are most important for GATE CS 2027?
C programming and recursion carry about half the subject's marks. After that come trees and BSTs, binary heaps, and stacks and queues, which have doubled since 2021.
Which book is best for PDS for GATE CS?
Kernighan and Ritchie's The C Programming Language for C, and Weiss's Data Structures and Algorithm Analysis in C for data structures.
How do I get better at C output questions?
Practise tracing on paper with a variable table, and solve every C question from past papers. There are 76 C programming and recursion questions from 2014 to 2026 on the GATE CS PYQ archive, which is enough for several weeks of daily practice.
Where can I practise GATE CS PDS PYQs?
Every GATE CS question from 2014 to 2026 is free on Success Tracker's GATE CS PYQ archive, with the official answer and a worked solution.
Next in This Series
- Algorithms for GATE CS 2027
- Computer Organization and Architecture for GATE CS 2027
- Operating System for GATE CS 2027
- GATE CSE subject-wise weightage
- GATE CS 2027 complete guide
Sources
- GATE 2027 CS Syllabus (PDF), IIT Madras: Section 4, Programming and Data Structures
- GATE 2026 CS Syllabus (PDF), IIT Guwahati
- GATE 2027 Question Paper Pattern, IIT Madras: marks distribution and negative marking
- Official GATE CS question papers and answer keys, 2014–2026 (23 papers), as reproduced on Success Tracker. Weightage figures are The ML Hub's own count, done on 25 October 2026.