Storage Class Questions and Answers

Practice Mode
Showing 10 of 97 questions
Q71
State the correct statement
  • A Variable having block scope and without static specifier have automatic storage duration.
  • B 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.
  • C Memoey obtained from calls to malloc(), alloc() of realloc() belongsl to allocated storage class
  • D All of these
Answer: Option D
Q72
Which of these is/are true about global variables
  • A For every gloabl variable, there must be exactly one real declaration, but there can be any number of extern declarations
  • B A static global variable is never visible outside declarations.
  • C As with static globals, a static function is never visible outside of its file.
  • D All of these
Answer: Option D
Q73
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.
  • A only I
  • B I and II
  • C I II and IIi
  • D I II III and IV
Answer: Option D
Q74
Which storage classes can not be used at external level (i.e. outside all functions)
  • A static and register
  • B auto and register
  • C Static and extern
  • D extern and register
Answer: Option B
Q75
Which of the following statement is incorrect about a register variable ?
  • A Register variables are stores in register rather than in RAM
  • B These are used for variables that require quick access.
  • C We can apply unary '&' operator to these variables.
  • D Register variables has same scope as a auto variable.
Answer: Option C
Q76
Find the output extern int i=4000; void main ( ) { int ii=40000; printf('5d", sizeof (i)); printf("%1d %1d", ii,i); }
  • A 2 40000 40000
  • B 2 garbage garbage
  • C 2 40000 garbage
  • D 2 garbage 40000
Answer: Option D
Q77
Find the output void main ( ) { static int val=7; int data; if (--val) { data=main ( ) +val; printf("5d", data); } return 0; }
  • A 1 2 3 4 5 6
  • B 0 0 0 0 0 0
  • C Infinite loop
  • D Compilation error
Answer: Option D
Q78
Find the output extern int i=10; int f(int i) { return (++i*i); } void main ( ) { extern int i; printf('5d", f(i)); }
  • A 121
  • B 100
  • C 110
  • D Compilation error
Answer: Option A
Q79
Find the outpu #define ptr int void main ( ) { typedef ptr raja; static raja x; if (++x) printf("5d", x++); }
  • A 0
  • B 1
  • C No output
  • D Error: too many storage class
Answer: Option B
Q80
Consider the following declaration statement extern int sum; What information does it convey?
  • A Variable sum has its initial value0.
  • B Identifiers with internal linkage can only be seen within the translation unit.
  • C Identifiers with no linkage can only be seen in the scope in which they are defined.
  • D None of these
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test