C-Storage Class Question and Answer
C-Storage Class Question and Answer
61. Find the output
void main ( )
{
static int i=i++, j=j++;
printf('%c", s);
}
printf("%d", s);
}
void main ( )
{
static int i=i++, j=j++;
printf('%c", s);
}
printf("%d", s);
}
- 11
- Garbage value
- Compilation error
- None of these
62. Find the output
void main ( )
{
static int i=i++, j=j++;
printf("%d%d", i, j);
}
void main ( )
{
static int i=i++, j=j++;
printf("%d%d", i, j);
}
- 11
- Garbage value
- Compilation error
- None of these
63. Find the output
char s;
void main ( )
{
s='a}';
{
static char s='b';
printf ('%c",s);
}
char s;
void main ( )
{
s='a}';
{
static char s='b';
printf ('%c",s);
}
- b97
- b0
- b49
- Compilation error
64. The extern storage class can be used to
- Access a variable from another file.
- Access a global variable.
- Both a and b
- None of these
65. Find the output
void main ( )
{
show ( );
dis ( );
}
show ( )
{
extern int x;
x--;
printf("%d", x);
}
int x=10;
dis ( )
{
{
x++;
printf('%d", x);
}
void main ( )
{
show ( );
dis ( );
}
show ( )
{
extern int x;
x--;
printf("%d", x);
}
int x=10;
dis ( )
{
{
x++;
printf('%d", x);
}
- 10 11
- Garbage 11
- 9 10
- Compilation error
66. Find the output
void main ( )
{
extern int a;
a=10;
printf("5d", sizeof (a));
}
void main ( )
{
extern int a;
a=10;
printf("5d", sizeof (a));
}
- 2
- 0
- Compilation error
- None of these
67. Find the output
int a=6;
void main ( )
{
static int *x=&a;
printf('5d", *x);
}
int a=6;
void main ( )
{
static int *x=&a;
printf('5d", *x);
}
- 6
- 0
- Compilation error
- None of these
68. State the incorrect statement
- Memory for a static variable is not deallocated until the entire program terminates.
- Memory for a static variable is allocated exactly once, at the very beginning of program execution.
- Static variable is visible throughout the function, but not outside.
- Static variable creates program scoping.
69. The disadvantages of external storage class is/are
- The storage for an external variable exists even when the variable is not needed
- The side effect may produce surprising output
- Modification of the program is difficult
- All of these
70. The advantages of external storage calss
- Persistent storage of a variable retains the latest value
- The value is globally available
- Generality of a program is affected
- Both a and b