Commonly Asked C Programming Interview Questions

C Programming Language Interview Questions and Answers

If you are looking for a job change or a new job which works on C programming, then we have compiled the list of interview questions asked on C programming frequently. Below given interview questions will help you to crack the technical round and also will get you through the programming test.

What are the storage class specifiers in C programming?

Answer: static, register, auto, extern. It is used to declare variables which will be used throughout the program.

What is a stack?

Answer: Stack is the data structure in which data is stored in a particular order (LIFO/FILO)

  • LIFO- Last In First Out
  • FILO- First in Last Out

Stack has two functions

  • Push
  • Pop

What are header files?

Answer: Header files are extensions which contains function declarations with definitions which are reused in the program. There are two types one which developer writes and another which comes with the compiler.

What is FIFO?

Answer: FIFO- First in first out or called a pipe, it’s a way of handling data structure.

What is typecasting?

Answer: To convert one data type to another.

Example: Explicit casting: integer to character

int x;

for(x=77cx<=115; x++)

{

printf(“%c”, (char)x);

}

What do you mean by a variable in C?

Answer: A variable is the name of the location in the memory, where the value is hold of the variable. We can put different values to a variable through a program but it needs a location where data is stored in the form of bits, so we can say it is a physical address allocated in the memory.

Name some of the time-related function in C programming? Explain the use also.

Answer:

state(): modifies the system date.

mktime() : Interprets tm structure as calendar time.

localtime(): TM structure that contains date and time information.

strftime(): Modify the actual time format.

gmtime(): This function shares the tm structure that contains date and time information.

ctime(): String that contains date and time informations.

asctime() : Time is converted into string.

getdate() :Fetch the CPU time.

clock(): Fetch current system time.

Time: Fetch the current system time as a structure.

difftime(): Difference between two given times.

 

Explain some features offered in C programming Language?

Answer:

  • C only has 32 keywords.
  • C is fast and efficient as a programming language.
  • A recursive function can be used in c.
  • C is a highly portable language.
  • C has a function-rich
  • C is the most used language for embedded systems.
  • C is a structure oriented language.

Who Developed C Language?

Answer: Dennis Ritchie is the father of C programming language was developed in 1972.

How to swap a number in place without temporary variables?

Answer: logic explained below

int K = 20, L = 5;

K = K + L; // K now becomes 25

L = K – L; // L becomes 20

K = K – L; // K becomes 5

What is difference between i++ and ++i?

Answer:

i++ ++i
Returns the old value and then does increment. Returns the incremented value
i++ cannot be used as I-value in C++ ++i can be used as l-value in C++
Example:

 

int i = 1;

int z = i++; //z is 1 & i is 2

int w= ++i; //w is 3 & i is 3

Is C language a Procedural Programming Language?

Answer: Yes

Please contribute to our question base, through the comment section given below.

Add a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!