0% found this document useful (0 votes)
4 views3 pages

Storage Class - DPP

Uploaded by

livehappy979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Storage Class - DPP

Uploaded by

livehappy979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

GATE

Computer Science & Information Technology


Crash Course 2025
C - Programming DPP

Storage Classes

Q1 Consider the following C program: return 0;


#include<stdio.h> }
int x=12; The output of the program is ________
int f1() { int x = 25; x++; return x;}
Q3 The value of j at the end of the execution of the
int f2() {static int x = 50; x++; return x;}
following C program
int f3() { x *= 10; return x;}
#include<stdio.h>
int f4(int a, int b , int c , int d) { return a+b+c+d;}
int foo (int j)
int main()
{
{
static int x = 0;
int x=1;
x = x + j;
x += f4(f1(), f2() , f3() , f2());
return x;
printf("%d", x);
}
return 0;
int main ()
}
{
The output of the program is
int i,j;
(A) 229 (B) 250
for (i = 0; i <=4; i++)
(C) 230 (D) 228
{
Q2 #include<stdio.h> j = foo(i)+foo(i);
int x=12; }
int f1() { int x = 25; x++; return x;} return 0;
int f2() {static int x = 50; x++; return x;} }
int f3() { x *= 10; return x;}
Q4 Consider the following program
int f4(int a, int b , int c , int d)
#include<stdio.h>
{
int foo (int j)
static int x = 10;
{
x=x+10;
static int x = 0;
return x+a+b+c+d;
x = x + j;
}
return x;
int main()
}
{
int main ()
int x=1;
{
x += f4(f1(), f2() , f3() , f2());
int i,j;
x += f4(f1(), f2() , f3() , f2());
for (i = 0; i <=4; i++)
printf("%d", x);
{

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 1/3
GATE

j = foo(i)-foo(i); int x,y;


} x = foo(bar(10))+y;
printf("%d", j); y = foo(bar(11))+x;
return 0; printf("%d\n", (x+y));
} return 0;
The value printed by the program is }
Output of the program is _________
Q5 #include<stdio.h>
int foo(int y) Q7 #include<stdio.h>
{ int fun(int y)
static int x = 1; {
x++; static int x = 20;
return x+y; x++;
} return x;
int bar(int i) }
{ int main()
return ++i; {
} int x,y;
int main() x = fun(20);
{ y = fun(20);
int x,y; printf("%d\n", (x+y));
x = foo(bar(10))+y; return 0;
y = foo(bar(11))+x; }
printf("%d\n", (x+y)); Output of the program is _____.
return 0;
Q8 #include<stdio.h>
}
int fun(int y)
The output of the program is _____
{
Q6 #include<stdio.h> static int x = 20;
int foo(int y) x++;
{ return x;
static int x = 1; }
x++; int main()
return x+y; {
} int x,y,z;
int bar(int i) x = fun(20);
{ y = fun(22);
static int x =12; z = fun(23);
x++; printf("%d\n", (x+y+z));
return i+x; return 0;
} }
int main() Output of the program is ______
{

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 2/3
GATE

Answer Key
Q1 (B) Q5 41

Q2 1633 Q6 78

Q3 36 Q7 43

Q4 –4 Q8 66

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 3/3

You might also like