C-Storage Class Question and Answer
C-Storage Class Question and Answer
21. Find the output
void main ( )
{
int i=3;
while (i<5)
{
static int j=2;
printf ('5d", j++);
i++;
}
}
void main ( )
{
int i=3;
while (i<5)
{
static int j=2;
printf ('5d", j++);
i++;
}
}
- 2 2
- 3 2
- 2 3
- 3 3
22. Find the incorrect one for 'typedef' storage class
- Permits descriptive names for datatypes.
- Renaming existing datatype
- Modification of the program is easier when host machine is changed.
- All of the above
23. In which of the storage class, initialization is done only once ?
- Static
- Auto
- Extern
- Typedef
24. Which of the following is used to call a C module in C++.
- extern "C"
- extern "C++"
- iostream.h
- None of these
25. Find the output
void main ( )
{
int i;
static int j=0;
for (i=1; i<5;i++)
call (j);
}
call (int j)
{
j++;
printf (%d", j);
}
void main ( )
{
int i;
static int j=0;
for (i=1; i<5;i++)
call (j);
}
call (int j)
{
j++;
printf (%d", j);
}
- 1 2 3 4
- 1 1 1 1
- 0 1 2 3
- None of these
26. Which storage class variable is best suited for loop counter ?
- Auto
- Static
- Register
- Typedef
27. A variable having bloc scope is known as
- Local variable
- private variable
- Public variable
- Internal variable
28. Which of the following storage class creates a file scoping ?
- Auto
- Register
- Static
- Extern
29. If the CPU fails to keep the variable in CPU register, in that case the variables are assumed to be
- Automatic
- Static
- External
- None of these
30. Which of the following storage class creates a program scoping ?
- Auto
- Register
- Static
- Extern