C Interview Questions & Answers part 6

Q: – Why do you need a linker?

After compiling, some function code may still be missing in the object file of a program. A linker must then be used to link the object file to the C standard library or other user-generated libraries and include the missing function code so that an executable file can be created.

Q: – How many parts does a function normally have?

A function normally has six parts: the function type, the function name, the arguments, the opening brace, the function body, and the closing brace.

Q: – What is difference between visual c++ & ANSI c++ ?

There are two ways to do the declaration. The first one is

…char variable-name1, variable-name2;

The second one is
char variable-name1;
char variable-name2;

Q: – What is the difference between a constant and a variable?

The major difference is that the value of a constant cannot be changed, whereas the value of a variable can. You can assign different values to a variable whenever it’s necessary in your C program.

Q: – What are %c, %d, and %f?

These are format specifiers. %c is used to obtain the character format; %d is for the integer format; %f is for the floating-point format. %c, %d, and %f are often used with C functions such as printf().

Q: – Why do you need a statement block?

Many C keywords can only control one statement. A statement block provides a way to put more than one statement together, and put the statement block under the control of a C keyword. Then, the statement block is treated as a single statement.

Submitted By:-Rohit Kumar          Email-ID: – rohitkumar1372@yahoo.in