Top 10 frequently asked questions for C Programming during interviews (with solutions).

During interviews, it is always important for programmers to be familiar with the fundamental concepts of programming.

Here is a list of the 10 most asked questions for C Programming during interviews:

1) What are the different storage class specifiers in C?

Ans: auto, register, static, extern

2) What are the main characteristics of C language?

Ans: The main characteristics of C language are: –

a) low level access to memory

b) simple set of keywords

c) clean style

3)Why pre-processor directive does not have a semi-colon at last?
Ans: Semi-colon is needed by the compiler and as the name suggests Pre-processors are programs that process our source code before compilation. Therefore, the semi-colon is not required.

4) What is the difference between near, far and huge pointers?

Ans: The differences are: –

a) Near pointer is used to store 16 bit addresses means within current segment on a 16 bit machine.

b) Far pointer is typically 32 bit that can access memory outside current segment.

c) Huge pointer is also typically 32 bit and can access outside segment.

Note: In case of far pointer, the segment is fixed and cannot be modified but huge pointer can be.

5) What is stack area?

Ans: Stack area is used to store the local variables and arguments of a method. This stays in memory only till the termination of that particular method.

6) What is heap area?

Ans: Heap area is used for objects allocated dynamically, using malloc() and calloc().

7) What is I-value?

Ans: I-value or location value refers to an expression that can be used on the left side of assignment operator.

I-value are of two types: –

a) non-modifiable I-value

it represents a I-value that cannot be modified. const variables are non0modifiable I-value.

b) modifiable I-value

it represents a I-value that can be modified.

8) Can a variable be both const and volatile?

Ans: Yes. Const modifier does not allow changing the value of the variable by internal program. But it does not mean that value of const variable should not be changed by external code. So, a variable can be both volatile and constant in C.

9) What is the difference between assembler, compiler and interpreter?

Ans: The differences are

a) Assembler is a program that converts assembly level language into machine level language.

b) Compiler compiles entire C source code into machine code.

c) Interpreters converts source code into intermediate code and then this code is executed line by line.

10) What are static functions?

Ans: In C, functions are global by default. The “static” keyword before a function name makes it static. Unlike global functions in C, access to static functions is restricted to the file where they are declared. Therefore, when we want to restrict access to functions, we make them static. Another reason for making functions static can be reuse of the same function name in other files.

Hope this clears up some doubts and ups your confidence. All the best!

Leave a Reply

Your email address will not be published.