C-Storage Class Question and Answer
C-Storage Class Question and Answer
51. What is the storage class of function PRINT() and find the output?
void main ( )
{
auto PRINT();
PRINT();
}
PRINT ( )
printf('printing");
}
void main ( )
{
auto PRINT();
PRINT();
}
PRINT ( )
printf('printing");
}
- Auto, printing
- Extern, printing
- Static, printing
- Compilation error
52. Find the output
void main ( )
{
tuypedef int float;
float x=4;7;
printf('%d", sizeof(x));
}
void main ( )
{
tuypedef int float;
float x=4;7;
printf('%d", sizeof(x));
}
- 4
- 2
- Compilation error
- None of these
53. Find the output
void main ( )
{
extern i;
printf('%d\n",i);
{
nt i=20;
printf ('%d\n', i);
}
}
void main ( )
{
extern i;
printf('%d\n",i);
{
nt i=20;
printf ('%d\n', i);
}
}
- 20 20
- Garbage 20
- 0 20
- Linker Error
54. To ver come the dangling pointer which of the following is used ?
- Auto
- Register
- Static
- Extern
55. Find the output
void main ( )
{
goto next;
{
int i=10;
static j=20;
next:printf('5d %d", i, j);
}
void main ( )
{
goto next;
{
int i=10;
static j=20;
next:printf('5d %d", i, j);
}
- Garbage garbage
- Garbage 20
- Compile time error underdifined symbol
- Run time error undefined symbol
56. Find the output
int main ( )
{
static int i=5;
if (-i--)
{
main ( );
printf('5d",i);
}
return (0);
}
int main ( )
{
static int i=5;
if (-i--)
{
main ( );
printf('5d",i);
}
return (0);
}
- 000000
- -1-1-1-1-1
- 54321
- 543210
57. Find the output.
#define max 5typedef int arr1[max];
void main ( )
{
typedef char arr2{max];
arr1 list [2] ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
arr2 name [ ] ={"name"};
printf("%d %s", list [1], name);
}
#define max 5typedef int arr1[max];
void main ( )
{
typedef char arr2{max];
arr1 list [2] ={0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
arr2 name [ ] ={"name"};
printf("%d %s", list [1], name);
}
- Garbage name
- 1 name
- 5 name
- Compilation error
58. Find the output
void main ( )
{
register int a=5;
register int *b=&a;
printf("%d %d", a, *b);
}
void main ( )
{
register int a=5;
register int *b=&a;
printf("%d %d", a, *b);
}
- 5 5
- Garbage value
- Compilation error
- None of the above
59. Storage class to be allocated to the object during
- Declaration
- Definition
- Compilation
- Execution