9 topics · 163 Qs · 9.5 marks/paper · since 2011
In GATE CS, Programming in C is tested extensively through rigorous code tracing, pointer mechanics, and fundamental semantics rather than high-level syntax trivia. GATE tests Recu… Guide
Open a topic to browse, or practice it timed.
Jump to the first question from that paper.
Subject guide
In GATE CS, Programming in C is tested extensively through rigorous code tracing, pointer mechanics, and fundamental semantics rather than high-level syntax trivia. GATE tests Recursion primarily through direct execution tracing of recursive C code snippets, stack-unwinding behavior (pre-order vs. Binary Search Trees (BSTs) in GATE CS test a balance of traversal mechanics, structural properties, worst-case vs.
Pointer Subtraction
Used when computing the numerical result of subtracting two pointers pointing to elements of the same array.
2D Array Element Address Calculation
Used for mapping multi-dimensional array indices to flat memory offsets in row-major layout.
Array Subscript Equivalence
Used to resolve commutative and unorthodox array indexing expressions in C snippets.
Cyclomatic Complexity
Used to calculate McCabe's cyclomatic complexity where is the count of predicate/decision conditions in the control flow.
Integer Division Loop Invariant
Used to verify formal loop invariants in repeated subtraction integer division routines.
Euclidean Subtraction GCD
Used when analyzing recursive functions that reduce two numbers by repeated subtraction until equality or 1 is reached.
Total Invocations Recurrence
Used to count the total number of function activations including base cases (e.g., ).
Digit Sum in Base $r$
Used when recursive functions peel off least significant digits/bits via modulo and integer division.
Pointer Arithmetic and Multidimensional Array Indexing
common · mixed · 2 marks · 2026, 2025, 2024, 2022
Evaluating complex pointer expressions involving 1D/2D/3D arrays, array decaying, pointer subtraction, array subscript commutativity (), and double dereferencing ().
Storage Classes, Variable Scope, and Shadowing
common · NAT · 2 marks · 2026, 2023, 2020, 2019
Tracing code containing static local variables retaining state across multiple recursive or iterative function calls, global vs local variable shadowing, and lifetime vs scope distinctions.
Parameter Passing and Pointer Swapping Idioms
common · mixed · 1 marks · 2026, 2025, 2024, 2019
Testing the distinction between pass-by-value and pass-by-reference using pointers, including classic traps where pointer formal parameters are reassigned locally without dereferencing.
Short-Circuit Evaluation, Precedence, and Side Effects
common · mixed · 1 marks · 2024, 2022, 2021, 2017
Evaluating expressions involving logical operators (&&, ||) where side-effects like pre/post increment (++i, i++) or assignment are skipped due to short-circuiting, or custom operator precedence tables.
Loop Invariants, Algorithm Semantics, and Verification
occasional · MCQ · 2 marks · 2025, 2024, 2017, 2016
Formulating correct pre/post-conditions, identifying loop invariants (e.g., division by repeated subtraction, binary exponentiation), or filling missing loop termination/update guards.
String Manipulation and Null Termination Pitfalls
occasional · mixed · 1 marks · 2025, 2024, 2017, 2015
Tracing pointer-based string copies or scans that miss copying the null terminator '\0', unsigned size_t differences producing underflow, or ASCII arithmetic offsets.