-
Diffenentiate between an internal static and external static variable?
An internal static variable is declared inside a block with static storage class whereas an external static variable is declared outside all the blocks in a file.An internal static variable has persistent storage,block scope and no linkage.An external static variable has permanent storage,file scope and internal linkage.
-
What are advantages and disadvantages of external storage class?
Advantages of external storage class1)Persistent storage of a variable retains the latest value2)The value is globally available Disadvantages of external storage class1)The storage for an external variable exists even when the variable is not needed2)The side effect may produce surprising output3)Modification of the program is difficult4)Generality of a program is affected
-
-
When does the compiler not implicitly generate the address of the first element of an array?
Whenever an array name appears in an expression such asØ array as an operand of the sizeof operatorØ array as an operand of & operatorØ array as a string literal initializer for a character arrayThen the compiler does not implicitly generate the address of the address of the first element of an array
-
What is modular programming?
If a program is large, it is subdivided into a number of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is known as modular programming.
-
What are the advantages of the functions?
Ø Debugging is easierØ It is easier to understand the logic involved in the programØ Testing is easierØ Recursive call is possibleØ Irrelevant details in the user point of view are hidden in functionsØ Functions are helpful...
-
Point out error, if any, in the following program main() { int i=1; switch(i) { case 1: printf("nRadioactive cats have 18 half-lives"); break; case 1*2+4: printf("nBottle for rent -inquire within"); break; } }
No error. Constant expression like 1*2+4 are acceptable in cases of a switch.
-
-
Point out the error in the following program
main()
{
const char *fun();
*fun()='A';
}
const char *fun()
{
return "Hello";
}
fun() returns to a "const char" pointer which cannot be modified
-
-
-
How many levels deep can include files be nested?
Even though there is no limit to the number of levels of nested include files you can have, your compiler might run out of stack space while trying to include an inordinately high number of files. This number varies according to your hardware configuration and possibly your compiler.
-
What is #line used for?
The #line preprocessor directive is used to reset the values of the _ _LINE_ _ and _ _FILE_ _ symbols, respectively. This directive is commonly used in fourth-generation languages that generate C language source files.
-
-
-
What is the difference between goto and longjmp() and setjmp()?
A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution. Generally, a jump in execution of any kind should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program. A goto statement simply bypasses code in your program and jumps...
-
-
-
-
Point out the error in the following program main() { const int x; x=128; printf("%d",x); }
x should have been initialized where it is declared.
C Interview Questions
Ans