© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

C and C++ Interview Questions

11.  What are advantages and disadvantages of external storage class?

Ans:
Advantages of external storage class:

1) Persistent storage of a variable retains the latest value
2) The value is globally available

Disadvantages of external storage class:

1) The storage for an external variable exists even when the variable is not needed
2) The side effect may produce surprising output
3) Modification of the program is difficult
4) Generality of a program is affected

Ex - Q1: When should a type cast not be used?
 
Ans:

A type cast should not be used to override a const or volatile declaration. Overriding these type modifiers can cause the program to fail to run correctly. A type cast should not be used to turn a pointer to one type of structure or data type into another. In the rare events in which this action is beneficial, using a union to hold the values makes the programmer’s intentions clearer.

Ex - Q2: What is storage class and what are storage variable?

Ans:

A storage class is an attribute that changes the behavior of a variable. It controls the lifetime, scope and linkage.
There are five types of storage classes
1) auto
2) static
3) extern
4) register
5) typedef

Ex - Q3: What is a static function?

Ans:
A static function is a function whose scope is limited to the current source file. Scope refers to the visibility of a function or variable. If the function or variable is visible outside of the current source file, it is said to have global, or external, scope. If the function or variable is not visible outside of the current source file, it is said to have local, or static, scope.


SLogix Student Projects
bottom