MCQ on C Storage Classes and Type Qualifiers

MCQ on Storage Classes in C with answers and explanations for placement tests and job interviews. These solved C MCQ on Storage Classes MCQ are useful for the campus placement for all freshers including Engineering Students, MCA students, Computer and IT Engineers, etc.

Our Storage Classes MCQ ( Storage Classes multiple Choice Questions ) focuses on all areas of the Storage Classes and their concept. We will regularly update the quiz and most interesting thing is that questions come in a random sequence. So every time you will feel new questions.

We have already published a blog post that contains short questions on storage classes. If you want you can also see this blog post “C Storage Classes specifiers“.

Guideline of MCQ on Storage Classes:

This MCQ on Storage Classes is intended for checking your Storage Classes knowledge. It takes 1 hour to pass the Storage Classes MCQ. If you don’t finish the MCQ on Storage Classes within the mentioned time, all the unanswered questions will count as wrong. You can miss the questions by clicking the “Next” button and return to the previous questions by the “Previous” button. Every unanswered question will count as wrong. MCQ on Storage Classes has features of randomization which feel you a new question set at every attempt.

In this MCQ on Storage Classes, we have also implemented a feature that not allowed the user to see the next question or finish the quiz without attempting the current storage Classes specifiers MCQ.

4 votes, 5 avg

You have 1 hours to take the C Storage Classes MCQs

Your time has been Over.


C MCQ on Storage Classes

C Programming Multiple Choice Questions And Answers

C MCQ on Storage Classes: C  Storage Classes Multiple Choice Questions and Answers

1 / 50

What is the output of the below code?

#include<stdio.h>

int init()
{
    return 10;
}

int main()
{
    static int data = init();
    printf(" value of data = %d", data);
    return 0;
}

 

2 / 50

What is the output of the below code,

#include <stdio.h>

int a, b, c = 0;

void prtFun (void)
{
    static int a = 2;
    int b = 1;
    a += ++b;
    printf ("\n %d %d ", a, b);
}

int main ()
{
    static int a = 1;
    prtFun();
    a += 1;
    prtFun();
    printf ( "\n %d %d ", a, b) ;
}

 

3 / 50

What is the output?

#include<stdio.h>

int main()
{
    typedef int i;

    i data = 0;

    printf("%d", data);

    return 0;
}

 

4 / 50

What is the output of the below code?

#include<stdio.h>

int main()
{
    extern int var;
    var = 10;
    printf("%d",var);

    return 0;
}
int var = 0;

 

5 / 50

What is the output of the below code?

#include <stdio.h>
#include <string.h>

char *fun()
{
    static char arr[1024];
    return arr;
}

int main()
{
    char *str = "Aticleworld.com";
    strcpy(fun(), str);
    str = fun();
    strcpy(str, "AticleworldMCQs");
    printf("%s", fun());
    return 0;
}

 

6 / 50

In C, static storage class cannot be used with:

7 / 50

What will be the output of the following code?

#include <stdio.h>

static int data = 5;

int main()
{
    int sum = 0;
    do
    {
        sum += data;
    }
    while(0 < data--);
    printf("sum of the series is %d", sum);

    return 0;
}

 

8 / 50

What is the output?

#include <stdio.h>

int main()
{
    int data = 5;

    int * const ptr = &data;

    ++(*ptr);

    printf("%d", data);

    return 0;
}

 

9 / 50

Which is not a storage class?

10 / 50

What is the output?

#include <stdio.h>

int main()
{
    register int i = 10;
    int *ptr = &i;
    printf("%d", *ptr);
    return 0;
}

 

11 / 50

What is the output of the following program?

#include<stdio.h>

int main()
{
    static int a = 7;

    printf("%d", a --);

    return 0;
}

 

12 / 50

What will be the output of the following code?

#include<stdio.h>

void test();

int main()
{
    goto abc;

    printf("hello\n");

    return 0;
}

void test()
{
abc:
    printf("world\n");
}

 

13 / 50

In case of a conflict between the names of a local and global variable what happens?

14 / 50

Which of the following statement are correct?

(i) The value stored in the CPU register can always be accessed faster than that stored in memory.
(ii) A register storage class variable will always be stored in a CPU register.

15 / 50

Which of the following is not a storage class specifier in C?

16 / 50

What is the output of the below code?

#include <stdio.h>

int main()
{
    int data = 10;
    const int *ptr = &data;
    *ptr = 100;
    printf("data = %d\n", data);

    return 0;
}

 

17 / 50

What will be the output of the following code?

#include<stdio.h>

int main()
{
    extern int a;
    static char j = 'E';
    printf("%c %d", ++j, ++a);
    return 0;
}

 

18 / 50

What is the output?

#include <stdio.h>

int main()
{
  extern int data;
  printf("%d ", data);
  {
       int data = 10;
       printf("%d ", data);
  }

  return 0;
}

 

19 / 50

The output of the following program?

#include <stdio.h>

int fun(int n)
{
    static int s = 0;
    s = s + n;
    return (s);
}

int main()
{
    int data = 10, x;
    while (data > 0)
    {
        x = fun(data);
        data--;
    }
    printf ("%d ", x);
    return 0;
}

 

20 / 50

The lifetime of a variable refers to

21 / 50

Which of the following statement are correct?

(i) The maximum value a variable can hold depends upon its storage class.
(ii) By default all variables enjoy a static storage class.

22 / 50

What is the output?

#include <stdio.h>

int a, b, c = 0;

void prtFun (void)
{
    register int a = 2;
    int b = 1;
    a += ++b;
    printf ("\n %d %d ", a, b);
}

int main ()
{
    auto int a = 1;
    prtFun();
    a += 1;
    prtFun();
    printf ( "\n %d %d ", a, b) ;
    return 0;
}

 

23 / 50

Consider the following C function, what is the output?

#include <stdio.h>

int fun(int n)
{
    static int r = 0;
    if (n <= 0)
        return 1;
    if (n > 3)
    {
        r = n;
        return fun(n-2)+2;
    }
    return fun(n-1)+r;
}

int main()
{
    printf("%d", fun(5));
    
    return 0;
}

 

24 / 50

What is the output?

#include<stdio.h>

int main()
{
    typedef static int *ptr;

    int data;

    ptr a = &data;

    printf("%d", *a);

    return 0;
}

 

25 / 50

Which of the following statement is correct about the code snippet given below?

#include<stdio.h>

int bomb();

extern int p;
int sum = 5;

int main()
{
    p = bomb();
    printf("%d %d", sum, p);
    return 0;
}

int p;

int bomb()
{
    sum ++;
    return (sum);
}

 

26 / 50

What is the output?

#include <stdio.h>

int main()
{
    int x = 10;
    static int y = x;

    if(x == y)
    {
        printf("Equal");
    }
    else if(x > y)
    {
        printf("Greater");
    }
    else
    {
        printf("Less");
    }
    return 0;
}

 

27 / 50

What is the output?

#include <stdio.h>

int fun()
{
    static int num = 16;
    return num--;
}

int main()
{
    for(fun(); fun(); fun())
    {
        printf("%d ", fun());
    }
    return 0;
}

 

28 / 50

What is the output of the below code?

#include<stdio.h>

int main()
{
    extern int var;

    printf("%d",var);

    int var = 0;

    return 0;
}

 

 

29 / 50

What will be the storage class of variable I in the code written below?

#include <stdio.h>

int main()
{
    int i = 10;
    printf("%d", i);
    return 0;
}

 

30 / 50

What will be the output of the following program?

#include< stdio.h>

int main()
{
    static unsigned int a = 23;
    register unsigned char c = ‘R’;
    auto long unsigned q = 345L;
    static long signed p = 345L;
    
    printf("a = %u c = %c", a,c);
    printf("\nq = %ld p = %ld", q, p);
    
    return 0;
}

 

31 / 50

What will be the output of the following program?

#include<stdio.h>

void fun()
{
    auto int I = 1;
    register char a = 'D';
    static int p = 0;
    printf("%d %d %d", I, a, p);
}

int main()
{
    fun();
    return 0;
}

 

32 / 50

The typedef specifier is called a

33 / 50

What is the output of the below code?

#include<stdio.h>

int main()
{
    {
        int a = 10;
    }
    printf("value of a = %d\n",a);

    return 0;
}

 

34 / 50

What will be the output of the following code?

#include <stdio.h>

static int data = 5;

int main()
{
    int sum = 0;
    do
    {
        sum += (1/data);
    }
    while(0 < data--);
    printf("sum of the series is %d", sum);

    return 0;
}

 

35 / 50

What will be the output of the following program?

#include <stdio.h>

static int y = 1;

int main()
{
    static int z;
    printf("%d %d", y, z);
    return 0;
}

 

36 / 50

Pick the correct statement for const and volatile.

37 / 50

For the following “typedef” in C, pick the best statement

//new type

typedef int INT, *INTPTR, ONEDARR[10], TWODARR[10][10];

 

38 / 50

The output of the following program?

#include <stdio.h>

int main()
{
    static int data=5;
    if(--data)
    {
        main();
        printf("%d ",data);
    }
    return 0;
}

 

39 / 50

Which of the following is correct for a function definition along with a storage-class specifier in C language?

40 / 50

Which of the following storage classes have global visibility in C/C++ ?

41 / 50

What is the output?

#include <stdio.h>

int main()
{
    static int data=5;
    if(--data)
    {
        printf("%d ",data);
        main();
    }
    return 0;
}

 

42 / 50

Consider the following pseudocode:

x : integer := 1
y : integer := 2
procedure add
x := x + y

procedure second (P: procedure)
x : integer := 2
P()
procedure first
y : integer := 3
second(add)
first()
write_integer (x)

What does it print if the language uses dynamic scoping with deep-binding?

ISRO CS 2013

 

43 / 50

What is the output of the below code?

#include<stdio.h>

int test()
{
    int data = 0;
    data++;
    return data;
}

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

 

44 / 50

Which of the following statement is correct?

(i) A function can also be declared as static.
(ii) The default value of an external storage class variable is zero.

45 / 50

What is the output?

#include <stdio.h>

int main()
{
    int data = 5;

    int const * ptr = &data;

    ++(*ptr);

    printf("%d", data);

    return 0;
}

 

46 / 50

If only one memory location is to be reserved for a class variable, no matter how many objects are instantiated, then the variable should be declared as?

ISRO CS 2014

47 / 50

What is the output of the below code?

#include<stdio.h>

int test()
{
    static int data = 0;
    data++;
    return data;
}

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

 

48 / 50

Consider the following C function

int fun(int n)
{
    static int data = 1;
    if (n >= 5)
    {
        return n;
    }
    n = n+data;
    data++;
    return fun(n);
}

 

The value returned by f(1) is

49 / 50

The same identifier can not denote more than one entity in the same scope or namespaces.

50 / 50

In the context of C data types, which of the following is correct?

Your score is

The average score is 0%

0%

Recommended Articles for you: