C-Storage Class Question and Answer
C-Storage Class Question and Answer
91. Which storage class can retain values in between system calls ?
- auto
- static
- extern
- Global
92. The static storage class specifier can not be applied to
- Functions
- Function declarations within a block
- Anonymous unions
- All of these
93. Find the output.
void main (register int argc)
{
static int y;
y=argc;
printf("%d",y);
}
void main (register int argc)
{
static int y;
y=argc;
printf("%d",y);
}
- 0
- 1
- 2
- Compilation error
94. Find the output
int main (void);
int main ( )
{
unsigned int static main =4;
int (*p) ( );
p=(int *) main ;
(*p) ( );
printf("%d", main++);
return 0;
}
int main (void);
int main ( )
{
unsigned int static main =4;
int (*p) ( );
p=(int *) main ;
(*p) ( );
printf("%d", main++);
return 0;
}
- 4
- stack overflow
- Abnormal program termination
- Compilation error
95. Find the output
main ( )
{
static int a[5]={1, 2, 3, 4, 5};
static int b[5]={6, 7, 8, 9, 10};
int i;
for (i=0; i<10; i++)
printf("%d", a[i]);
}
main ( )
{
static int a[5]={1, 2, 3, 4, 5};
static int b[5]={6, 7, 8, 9, 10};
int i;
for (i=0; i<10; i++)
printf("%d", a[i]);
}
- 1, 2, 3, 4, 5, 0, 0, 0, 0, 0
- 1,2,3,4,5,6,7,8,9,10
- 1,2,3,4,5,garbage
- None of these
96. Choose the correct one
a.c
a) static char x[4000];
void main ( )
{
}
b.c
b) void main ( )
{
auto char x[4000];
}
a.c
a) static char x[4000];
void main ( )
{
}
b.c
b) void main ( )
{
auto char x[4000];
}
- Size of a is more than size of b
- size of b is more than size of a
- both a and b is same size
- None of the above
97. How many time the loop wil iterate ?
void main ( )
{
register char i=1;
while (i)
{
printf("%d", i);
i++;
}
}
void main ( )
{
register char i=1;
while (i)
{
printf("%d", i);
i++;
}
}
- infinite times
- 255 times
- 65535 times
- none of these