C programming mostly asked interview question

1) What are the key features of the C programming language?

  • C is a platform-dependent language
  • It is many time faster than BASIC.
  • C is highly portable this means that programs once are written can be run on another machine with little or no modification.
  • C language is the most widely used language in operating systems and embedded system development today.

2) Who is the founder of C language?

Dennis Ritchie

3) When was C language developed?

C language was developed in 1972 at bell laboratories of AT&T.

4) What is the use of printf() and scanf() functions?

Basically, printf() is used to print the integer, character, float and string values on to the screen.
scanf() is used to take input from the user.

5) What is the use of header files in C?

The header file contains a set of rules and definitions of function which we used in our program
for example – without use of #include<stdio.h> our compiler gives an error, because of header file #include<stdio.h> contains definitions of printf() and scanf().

6) Can a program be compiled without the main() function?

Yes, we can compile a C program without the main function but it will not be executed as its execution starts from the main function only.

7) What happens if a header file is included twice? 

Nothing, but it increases the compilation time of the program. if a header file with proper syntax is included twice, the second one gets ignored.

8) What is the difference between static & global variables?

As the name suggests, the global variable is defined outside the function A global variable can be accessed by any function.
Static variables are initialized only once. A static variable remains in memory while the program is running.

9) What is Memory Leak in C?

The memory leak occurs when a piece of memory which was previously allocated by the programmer. Then it is not deallocated properly by the programmer.

10) What is Static and Dynamic memory allocation?

The part of memory that is allocated during the writing of the program is known as static memory allocation.
The part of memory that is allocated during the execution of the program is known as dynamic memory allocation.

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

auto, register, static, extern

12) What is a NULL pointer?

NULL is used to indicate that the pointer doesn’t point to a valid location.

13) What is the difference between ++a and a++?

‘++a’ is called pre-increment whereas a++ is post-increment.

14) What is a Dangling Pointer in C?

A pointer pointing to a dereferenced memory location is called dangling pointer.




0 0 vote
Article Rating

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x