C-Storage Class Question and Answer

C-Storage Class Question and Answer
71. State the correct statement
  • Variable having block scope and without static specifier have automatic storage duration.
  • Variables with blocks scope, and with static specifier have static scope. global variables (i.e. file scope)with or without the static specifier also have static scope.
  • Memoey obtained from calls to malloc(), alloc() of realloc() belongsl to allocated storage class
  • All of these
Show Answer
72. Which of these is/are true about global variables
  • For every gloabl variable, there must be exactly one real declaration, but there can be any number of extern declarations
  • A static global variable is never visible outside declarations.
  • As with static globals, a static function is never visible outside of its file.
  • All of these
Show Answer
73. Every variable that you declare and use in a program belongs to a storage class. The storage class of a variable controls:
I. When (during program execution) it is allocated in memory
II). When (during program execution) it is initialized.
III. Where (in the program) it is visible.
IV. When (during program execution) it is dealocated from memory.
  • only I
  • I and II
  • I II and IIi
  • I II III and IV
Show Answer
74. Which storage classes can not be used at external level (i.e. outside all functions)
  • static and register
  • auto and register
  • Static and extern
  • extern and register
Show Answer
75. Which of the following statement is incorrect about a register variable ?
  • Register variables are stores in register rather than in RAM
  • These are used for variables that require quick access.
  • We can apply unary '&' operator to these variables.
  • Register variables has same scope as a auto variable.
Show Answer
76. Find the output
extern int i=4000;
void main ( )
{
int ii=40000;
printf('5d", sizeof (i));
printf("%1d %1d", ii,i);
}

  • 2 40000 40000
  • 2 garbage garbage
  • 2 40000 garbage
  • 2 garbage 40000
Show Answer
77. Find the output
void main ( )
{
static int val=7;
int data;
if (--val)
{
data=main ( ) +val;
printf("5d", data);
}
return 0;
}

  • 1 2 3 4 5 6
  • 0 0 0 0 0 0
  • Infinite loop
  • Compilation error
Show Answer
78. Find the output
extern int i=10;
int f(int i)
{
return (++i*i);
}
void main ( )
{
extern int i;
printf('5d", f(i));
}

  • 121
  • 100
  • 110
  • Compilation error
Show Answer
79. Find the outpu
#define ptr int
void main ( )
{
typedef ptr raja;
static raja x;
if (++x)
printf("5d", x++);
}

  • 0
  • 1
  • No output
  • Error: too many storage class
Show Answer
80. Consider the following declaration statement
extern int sum;
What information does it convey?

  • Variable sum has its initial value0.
  • Identifiers with internal linkage can only be seen within the translation unit.
  • Identifiers with no linkage can only be seen in the scope in which they are defined.
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test