Subject analysis · 2017–2026
Programming in C
Every GATE CS question on Programming in C, with how the marks are spread across years and topics.
Questions
57
4 topics
Avg marks / year
9.0
90 marks over 10 years
Peak year
2017
19 marks
Trend
Rising
+23% last 3 yrs
Marks per year
Both shifts counted where there were two · peak highlighted
avg 9.0
19
4
10
5
11
5
5
11
11
9
'17'18'19'20'21'22'23'24'25'26
Topic share
Share of Programming in C's 90 marks
4
topics
- Functions, Parameter Passing, Scope Rules, Recursion48%
- Pointers, Multi-Dimensional Arrays, Structures28%
- Data Types, Syntax, Control Structures, Loops21%
- Dynamic Memory Allocation & File Handling3%
Topic × year heatmap
Marks from each topic in each year — darker is heavier. Topics that light up every column are the safest bets.
| '17 | '18 | '19 | '20 | '21 | '22 | '23 | '24 | '25 | '26 | |
|---|---|---|---|---|---|---|---|---|---|---|
| Functions, Parameter Passing, Scope Rules, Recursion | 8 | 1 | 5 | 4 | 6 | 5 | 4 | 4 | 6 | |
| Pointers, Multi-Dimensional Arrays, Structures | 3 | 3 | 3 | 1 | 3 | 3 | 3 | 4 | 2 | |
| Data Types, Syntax, Control Structures, Loops | 6 | 2 | 2 | 2 | 4 | 3 | ||||
| Dynamic Memory Allocation & File Handling | 2 | 1 |
All 57 Programming in C questions
2026 6 questions · 9 marks
- FN · Q34Consider the following program in C: c include <stdio.h> void func(int i, int j) if(i < j) int i = 0; while (i < 10) j += 2; i++; printf("%d", i); int main() i…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 1 mark
- FN · Q61Consider the recursive functions represented by the following code segment: c int bar(int n) if (n == 1) return 0; else return 1 + bar(n/2); int foo(int n) if…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
- AN · Q17In C runtime environment, which one of the following is stored in heap?Dynamic Memory Allocation & File Handling · MCQ · 1 mark
- AN · Q19Consider the following three ANSI-C programs, P1, P2 and P3 Which one of the following statements is true?Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 1 mark
- AN · Q60Consider the following ANSI-C program. c include <stdio.h> int main( ) int ptr, a, b, c; a=5; b=11; c=20; ptr=&a; ptr=c; ptr=&c; a= (&b); c= ptr-a; printf("%d"…Pointers, Multi-Dimensional Arrays, Structures · NAT · 2 marks
- AN · Q61Consider the following ANSI-C function. c int func(int start, int end) int length = end + 1 - start; if((length<1) (start < 0) (end<0)) return(0); if(length%3…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
2025 7 questions · 11 marks
- FN · Q34c include <stdio.h> void foo(int p, int x) p = x; int main( ) int z; int a = 20, b = 25; z = &a; foo(z, b); printf("%d", a); return 0; The output of the given…Pointers, Multi-Dimensional Arrays, Structures · NAT · 1 mark
- FN · Q61c include <stdio.h> int foo(int S[ ], int size) if(size == 0) return 0; if(size == 1) return 1; if(S[0] != S[1]) return 1 + foo(S + 1, size - 1); return foo(S…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
- FN · Q63Consider the following C program: c include <stdio.h> int gate (int n) int d, t, newnum, turn; newnum = turn = 0; t = 1; while (n >= t) t = 10; t /=10; while (…Data Types, Syntax, Control Structures, Loops · NAT · 2 marks
- AN · Q19Consider the following C program: c include <stdio.h> void stringcopy(char , char ); int main( ) char a[30] = "@ Hello World!"; stringcopy(a, a + 2); printf("%…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 1 mark
- AN · Q33c int x = 126, y = 105; do if(x > y) x = x - y; else y = y - x; while(x!=y); printf("%d", x); The output of the given C code segment is . (Answer in integer)Data Types, Syntax, Control Structures, Loops · NAT · 1 mark
- AN · Q62Consider the following C program: c include <stdio.h> int main( ) int a; int arr[5] = 30, 50, 10 ; int ptr; ptr = &arr[0] + 1; a = ptr; ( ptr)++; ptr++; printf…Pointers, Multi-Dimensional Arrays, Structures · NAT · 2 marks
- AN · Q63Consider the following C program: c include <stdio.h> int g(int n) return (n+10); int f(int n) return g(n 2); int main( ) int sum, n; sum=0; for (n=1; n<3; n++…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
2024 8 questions · 11 marks
- FN · Q18Consider the following C program: c include <stdio.h> int main( ) int a = 6; int b = 0; while (a < 10) a = a/12 + 1; a += b; printf("%d", a); return 0; Which o…Data Types, Syntax, Control Structures, Loops · MCQ · 1 mark
- FN · Q19Consider the following program: c include <stdio.h> void fx( ); int main( ) fx( ); return 0; void fx( ) char a; if ((a=getchar( )) != ' ') fx( ); if (a != ' ')…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 1 mark
- FN · Q33Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below. The value of the expression 3 + 1 + 5 2…Data Types, Syntax, Control Structures, Loops · NAT · 1 mark
- FN · Q48Consider the following C function definition. c int f (int x, int y) for (int i = 0; i < y; i++ ) x = x + x + y; return x; Which of the following statements is…Functions, Parameter Passing, Scope Rules, Recursion · MSQ · 2 marks
- AN · Q13Consider the following C program. Assume parameters to a function are evaluated from right to left. c include <stdio.h> int g(int p) printf ("%d", p); return p…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 1 mark
- AN · Q33Consider the following C function definition: c int fx(char a) char b = a; while ( b) b++; return b - a; Which of the following statements is/are TRUE?Pointers, Multi-Dimensional Arrays, Structures · MSQ · 1 mark
- AN · Q36What is the output of the following C program? c include <stdio.h> int main() double a[2]= 20.0,25.0 , p, q; p = a; q = p + 1; printf ("%d, %d",(int)(q - p),(i…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 2 marks
- AN · Q42Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices. The C code snip…Data Types, Syntax, Control Structures, Loops · MCQ · 2 marks
2023 3 questions · 5 marks
- FN · Q35The integer value printed by the ANSI-C program given below is c include<stdio.h> int funcp( ) static int x = 1; x++; return x; int main( ) int x, y; x = funcp…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 1 mark
- FN · Q36Consider the following program: c int main( ) f1( ); f1(2); f3( ); return (0); int f1( ) return(1); int f2(int X) f3( ); if (X == 1) return f1( ); else return…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 2 marks
- FN · Q47Consider the C function foo and the binary tree shown: c typedef struct node int val; struct node left, right; node; int foo(node p) int retval; if (p == NULL)…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 2 marks
2022 3 questions · 5 marks
- FN · Q21What is printed by the following ANSI C program? c include<stdio.h> int main(int argc, char argv[ ]) int x = 1, z[2] = 10, 11 ; int p = NULL; p = &x; p = 10; p…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 1 mark
- FN · Q43What is printed by the following ANSI C program? c include<stdio.h> int main(int argc, char argv[ ]) int a[3][3][3] = 1, 2, 3, 4, 5, 6, 7, 8, 9 , 10, 11, 12, 1…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 2 marks
- FN · Q44What is printed by the following ANSI C program? c include <stdio.h> int main(int argc, char argv[ ]) char a = 'P'; char b = 'x'; char c = (a & b) + ' '; char…Data Types, Syntax, Control Structures, Loops · MCQ · 2 marks
2021 7 questions · 11 marks
- FN · Q14Consider the following statements: S 1 : The sequence of procedure calls corresponds to a preorder traversal of the activation tree. S 2 : The sequence of proc…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 1 mark
- FN · Q47Consider the following ANSI C program: c include <stdio.h> int main( ) int i, j, count; count = 0; i = 0; for (j = -3; j <= 3; j++) if ((j >= 0) && (i++)) coun…Data Types, Syntax, Control Structures, Loops · MCQ · 2 marks
- FN · Q58Consider the following ANSI C function: c int SimpleFunction (int Y[ ], int n, int x) int total = Y[0], loopIndex; for (loopIndex = 1; loopIndex <= n - 1; loop…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
- AN · Q20Consider the following ANSI C program: c include <stdio.h> int main( ) int arr[4] [5] ; int i, j; for (i = 0; i < 4; i++) for (j = 0; j < 5; j++) arr[i] [j] =…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 1 mark
- AN · Q33Consider the following ANSI C function: c int SomeFunction(int x, int y) if ((x == 1) (y == 1)) return 1; if (x == y) return x; if (x > y) return SomeFunction(…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 1 mark
- AN · Q45Consider the following ANSI C program: c include <stdio.h> include <stdlib.h> struct Node int value; struct Node next; ; int main( ) struct Node boxE, head, bo…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 2 marks
- AN · Q59Consider the following ANSI C program: c include <stdio.h> int foo(int x, int y, int q) if ((x <= 0) (y <= 0)) return q; if (x <= 0) return foo(x, y - q, q) if…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
2020 3 questions · 5 marks
- FN · Q32Consider the following C program: c include <stdio.h> int main( ) int a[4][5] = 1, 2, 3, 4, 5 , 6, 7, 8, 9, 10 , 11, 12, 13, 14, 15 , 16, 17, 18, 19, 20 ; prin…Pointers, Multi-Dimensional Arrays, Structures · NAT · 1 mark
- FN · Q56Consider the following C functions: c int fun1(int n) static int i = 0; if (n > 0) ++i; fun1(n - 1); return(i); int fun2(int n) static int i = 0; if (n > 0) i…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
- FN · Q58Consider the following C functions: c int tob(int b, int arr) int i; for(i=0; b>0; i++) if(b%2) arr[i]=1; else arr[i]=0; b=b/2; return(i); int pp(int a, int b)…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
2019 6 questions · 10 marks
- FN · Q28Consider the following C program: c include <stdio.h> int jumble(int x, int y) x = 2 x + y; return x; int main ( ) int x = 2, y = 5; y = jumble(y, x); x = jumb…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 1 mark
- FN · Q34Consider the following C program: c include <stdio.h> int main ( ) int arr[ ] = 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5 , ip = arr + 4; printf ("%d ", ip[1]); re…Pointers, Multi-Dimensional Arrays, Structures · NAT · 1 mark
- FN · Q36Consider the following C function: c void convert (int n) if (n < 0) printf("%d", n); else convert (n/2); printf("%d", n % 2); Which one of the following will…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 2 marks
- FN · Q37Consider the following C program: c include<stdio.h> int r( ) static int num = 7; return num--; int main( ) for ( r( ); r( ); r( ) ) printf("%d", r( ) ); retur…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 2 marks
- FN · Q62Consider the following C program: c include <stdio.h> int main ( ) float sum = 0.0, j = 1.0, i = 2.0; while (i / j > 0.0625) j = j + j; sum = sum + i / j; prin…Data Types, Syntax, Control Structures, Loops · NAT · 2 marks
- FN · Q63Consider the following C program: c include <stdio.h> int main ( ) int a[ ] = 2, 4, 6, 8, 10 ; int i, sum = 0, b = a + 4; for (i = 0; i < 5; i++) sum = sum + (…Pointers, Multi-Dimensional Arrays, Structures · NAT · 2 marks
2018 3 questions · 4 marks
- FN · Q12Consider the following C program. c include<stdio.h> struct Ournode char x,y,z; ; int main() struct Ournode p = '1', '0', 'a'+2 ; struct Ournode q = &p; printf…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 1 mark
- FN · Q31Consider the following C program: c include <stdio.h> int counter = 0; int calc (int a, int b) int c; counter++; if (b==3) return (a a a); else c = calc(a, b/3…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 1 mark
- FN · Q39Consider the following C program: c include<stdio.h> void fun1(char s1, char s2) char tmp; tmp = s1; s1 = s2; s2 = tmp; void fun2(char s1, char s2) char tmp; t…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 2 marks
2017 11 questions · 19 marks
- FN · Q13Consider the following C code: c include <stdio.h> int assignval (int x, int val) x = val; return x; void main ( ) int x = malloc (sizeof(int)); if (NULL == x)…Dynamic Memory Allocation & File Handling · MCQ · 1 mark
- FN · Q35Consider the following two functions: c void fun1 (int n) if (n == 0) return; printf ("%d", n); fun2 (n - 2); printf ("%d", n); void fun2 (int n) if (n == 0) r…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 2 marks
- FN · Q36Consider the C functions foo and bar given below: c int foo (int val) int x = 0; while (val > 0) x = x + foo (val --); return val; int bar (int val) int x = 0;…Functions, Parameter Passing, Scope Rules, Recursion · MCQ · 2 marks
- FN · Q53Consider the following C program. c include <stdio.h> include <string.h> void printlength (char s, char t) unsigned int c = 0; int len = ((strlen(s) - strlen(t…Data Types, Syntax, Control Structures, Loops · NAT · 2 marks
- FN · Q55The output of executing the following C program is . c include <stdio.h> int total (int v) static int count = 0; while (v) count += v & 1; v >>= 1; return coun…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
- AN · Q2Match the following: List-I (P) static char var; (Q) m = malloc (10); m = NULL ; (R) char ptr[10]; (S) register int var1; List-II (i) Sequence of memory locati…Dynamic Memory Allocation & File Handling · MCQ · 1 mark
- AN · Q14Consider the following function implemented in C: c void printxy (int x, int y) int ptr; x = 0; ptr = &x; y = ptr; ptr = 1; printf ("%d, %d", x, y); The output…Pointers, Multi-Dimensional Arrays, Structures · MCQ · 1 mark
- AN · Q37Consider the C program fragment below which is meant to divide x by y using repeated subtractions. The variables x, y, q and r are all unsigned int. c while (r…Data Types, Syntax, Control Structures, Loops · MCQ · 2 marks
- AN · Q43Consider the following snippet of a C program. Assume that swap (&x, &y) exchanges the contents of x and y. c int main() int array[] = 3, 5, 1, 4, 6, 2 ; int d…Functions, Parameter Passing, Scope Rules, Recursion · NAT · 2 marks
- AN · Q54Consider the following C program c include <stdio.h> int main( ) int m = 10; int n, n1; n = ++m; n1 = m++; n--; --n1; n -= n1; printf("%d", n); return 0; The o…Data Types, Syntax, Control Structures, Loops · NAT · 2 marks
- AN · Q55Consider the following C program. c include <stdio.h> include <string.h> int main( ) char c = "GATECSIT2017"; char p = c; printf("%d", (int) strlen (c+2[p] - 6…Pointers, Multi-Dimensional Arrays, Structures · NAT · 2 marks

