Storage Classifiers

Storage Classifiers



Ques 1. what are stoagre classifiers in c?


options:
A. auto, static, register, extern 
B. auto, float, register, extern
C. char, static, register, extern
D. auto, static, register, int


Ques 2. what is the output for the below code?
#include <stdio.h>
#include <stdlib.h>
void fun();
int main()
{
fun();
}

void fun()
{
    static int x=4;
  if(x-- != 0 )
  {
    fun();
    printf("%d ",x);
  }
}

options:
A.  0 0 0 0
B. -1 -1 -1 -1 
C.  4 3 2 1
D.  infinite loop


Ques 3. what is the output for the below code?
#include <stdio.h>
#include <stdlib.h>
void fun();
int main()
{
fun();
}

void fun()
{
    static int x=4;
  if(x-- != 0 )
  {
    printf("%d ",x);
    fun();
  }
}

options:
A.  0 0 0 0
B. -1 -1 -1 -1 
C.  3 2 1 0
D.  infinite loo


Ques 4. what is the output for the below code?
#include <stdio.h>
#include <stdlib.h>
int main()
{
    auto int abc = 34;
    auto int * const ptr = &abc;
    *++ptr;
    printf("%d", abc);

    return 0;
}

options:
A. 34
B. 35
C. compiler error
D. run time error


Ques 5. what is the output for the below code?
#include <stdio.h>
#include <stdlib.h>
int main()
{
    auto int abc = 34;
    auto int * const ptr = &abc;
    ++*ptr;
    ++*ptr;
    --*ptr;
    printf("%d", abc);

    return 0;
}

options:
A. 34
B. 37
C. 36
D. 35


Ques 6. what is the output for the below code?
#include <stdio.h>
#include <stdlib.h>
int main()
{
    register int abc = 34;
    register int * const ptr = &abc;
    --*ptr;
    printf("%d", abc);

    return 0;
}

options:
A. 33
B. compiler error
C. 34
D. 35342


Ques 7. what is the output for the below code?
#include <stdio.h>
#include <stdlib.h>
int main()
{
    register int abc = 3;

    for(abc=3; ;)
    printf("%d", abc);

    return 0;
}

options:
A. infinite loop 
B. 3 3 3
C. compiler error
D. runtime error


Ques 8. what is the output for the below code?
int abc;
int main()
{
    int abc = 3;
    printf("%d\n ",abc);
    return 0;
}

options:
A. 0
B. 3
C. compiler error
D. runtime error


Ques 9. what is the output for the below code?
typedef static int abc ;

abc si=3;
int main()
{
    si++;
    printf("%d\n ",si);
    return 0;
}

options:
A. 4
B. runtime error
C. compiler error 
D. 3


Ques 10. what is the output for the below code?

typedef int abc ;

abc si=3;
int main()
{
    si++;
    si++;
    --si;
    printf("%d\n ",si);
    return 0;
}

options:
A. 6 
B. 5
C. 3
D. 4


Ques 11. what is the output for the below code?
int gi =332;
extern int gi ;

int main()
{
    printf("%d\n ",gi);
    return 0;
}

options:
A. 332
B. 0
C. compiler error
D. runtime error


Ques 12. what is the output for the below code?
volatile const int v =332;
int main()
{
    v += 4;
    printf("%d\n ",v);
    return 0;
}

options:
A. 336
B. compiler error
C. 332
D. runtime error


Ques 13. what is the output for the below code?
volatile int v =332;
int main()
{
    v += 4;
    printf("%d\n ",v);
    return 0;
}

options:
A. compiler error
B. 332
C. 336
D. runtime error


Ques 14. what is the output for the below code?
volatile int v =332;
int main()
{
    static int i=3;
    printf("%d ",v);

    {
     auto int p=89;
     i++;
     printf(" %d ", p);
    }
    {
        register int s=5;
        printf(" %d %d",s, i);
    }

    return 0;
}

options:
A. compiler error
B. run time error
C. 332 89 5 4
D. 332 89 5 3


Ques 15. what is the output for the below code?
volatile int v =32;
void fun();
int main()
{
    static int i=3;
    printf("%d ",v);

    {
     auto int p=89;
     i++;
     printf(" %d ", p);
    }
    {
        register int s=5;
        printf(" %d %d",s, i);
    }
fun();
    return 0;
}

void fun()
{
    v++;
 printf(" %d", v);
}

options:
A. 32 89 5 4 33
B. compiler error
C. run time error
D. 32 89 5 3 32


Answers

1. A 2. B 3. C 4. C 5. D 6. B 7. A 8. B 9. C 10. D 11. A 12. B 13. C 14. C 15. A