Programming and Data Structures · Programming in C
Official IIT answer key · IIT Kanpur · Audited Aug 2026
GATE CSE 2015 Set 3 Q48 · NAT · 2 marks
#include<stdio.h>
int main( )
{
int i, j, k = 0;
j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5;
k -= --j;
for(i = 0; i < 5; i++)
{
switch(i + k)
{
case 1:
case 2: printf("
%d", i+k);
case 3: printf("
%d", i+k);
default: printf("
%d", i+k);
}
}
return 0;
}
The number of times printf statement is executed is _________.Key concept
No account needed
Sit 5 related Programming in CPYQs as a guest. We'll score the set and show which traps cost marks — sign in only if you want to save the run.
Topic notes
In GATE CS, Programming in C is tested extensively through rigorous code tracing, pointer mechanics, and fundamental semantics rather than high-level syntax trivia. Questions emphasize pointer arithmetic and multidimensional array decay, storage classes (especially static local variables), evaluation order, side effects of increment/decrement operators, parameter passing mechanisms (pass-by-value vs pass-by-reference), and recursive program state tracking. The topic features a nearly balanced split between NAT and MCQ items across 1-mark and 2-mark categories, demanding precise, bug-free execution traces without a compiler.
Full Programming in C guide →Consider the following C program: #include int main( ) int i, j, k = 0; j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5; k -= --j; for(i = 0; i The number of times printf statement is executed is …
Topic-wise GATE CS PYQs with verified steps
Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.
