C Interview Questions and Answers

What is C language?

C is a high-level programming language and first developed in 1972 by Dennis Ritchie and Ken Thompson at AT& T Bell Labs.

Why C is sometimes called a mid-level programming language?

C supports both low-level (machine) and high level programing that is why it is also known as a mid-level programming language.

What are the advantages and disadvantages of C language?

Advantage and disadvantage of C are
Advantages
It is a high-level programming languages that is closer to human languages, especially English.
C programs can be reused, by saving into a library file and invoking simply by including the library file.
C allows to access computer hardware and peripherals. 
It used compiler, so once program become executable code then we can run it without interacting the compiler.

Disadvantages 
It used complier so complied code not portable on different machine.
C is a procedural language, become difficult to maintain for large application.
Less support to GUI.

What is a variable?

A variable is a name representation of memory storage location and that value can change between program execution.

What is the difference between variable declaration and variable definition?

Declaration associates type to the variable whereas definition is value assignment of the variable.

What is a constant?

When variables are declared with the const keywordcalled constant. The value ofconstant never changed.

What is the difference between local variable and global variable in C?

Local variable: A variable which is declared inside function or block is known as local variable.
Global variable: A variable which is declared outside function or block is known as global variable.

What is Storage Class in C and types of it?

The storage class represent scope and storage type in memory of variable in C.
There are four types of storage cases: Auto,Extern,Static and Register

What is auto keyword in C?

The auto keyword indicate that the memory location of a variable is temporary. Whereas by default every local variable of the function and block is automatic (auto). 

What is the use of static variable in C?

A variable declared with static keyword, is known as static variable. The static variable retains its value between multiple function calls and has permanent scope.

What are register variables? What are the advantages of using register variables? 

A variable is declared with a register storage class, known as register variable. The register variable is stored in the CPU register instead of main memory. 

Storing of frequently used variable in register might be speed up the code as variable access is faster from register in compare from memory. 

What is the purpose of type declarations? Or use of typedef?

The type declaration allow to create a name synonym for the existing data types that can help to simplify the complex declaration.

Syntax
typedef type identifier; 

How do you know the size of a data type or variable?

The sizeof operator can measure the data type size.

What is type casting?

Converting one data type into another is known as type casting.

What is a function and advantages of it? 

A function is a block of set of instruction that perform specific task.
Advantages
Reusability: function can be reuse in different place to perform same task
Code reduction: repeated code can move into function and can call function in place 
Modularity: task can be simplify by dividing that in modularity, that also increase readability

When is the void keyword used in a function?

When declare functions with void then it will not require return a value.

Latest Updates

Ratio and Proportion

175 men can dig a canal of 3150 meters long in 36 days. How many men are required to dig a canal of 3900 meters long in 24 days?

24 men working at 8 hours a day can do a piece of work in 15 days. In how many days can 20 men working at 9 hours a day do the same work?

10 men can lay a road of 75 Km long in 5 days. In how many days can 15 men lay a road of 45 Km long?

Rice costing Rs. 480/- is needed for 8 members for 20 days. What is the cost of rice required for 12 members for 15 days?

The mess charge for 35 students for 24 days is Rs. 6300/-. In how many days will the mess charges be Rs. 3375/- for 25 students?

Time and Work

18 men can dig a well in 10 days. After they have worked for 4 days, how many more men shall be employed to complete the work in 4 days from then?

If 80 men can do a piece of work in 10 days, how many men are required to do the same work in 4 days?

If 80 men can do a piece of work in 10 days, in how many days can 40 men do the same piece of work?

General Computer Knowledge

What kind of material does ‘IC’ in computers made of?

Physics

The force required to produce an acceleration of 4 m/s2 in an object of mass 9 kg is?

Biology

Some seeds have hooks and spines. It helps the seeds to__________?

Physics

Which of the following modes of heat transfer is faster?

Agriculture

Which of the following reproduces from underground stem?

Botany

Lichens are a symbiotic association of?

Physics

The unit of relative density is?

Problems on Ages

The ages of Gyanendra and Jitendra are in the ratio of 12:7 respectively. After 6 years, the ratio of their ages will be 3:2 respectively . find the difference in their ages?

Time and Work

X can do a piece of work in 20 days, while Y can do in 10 days. If Y worked at it for 8 days,then X can finish the remaining work in______.?

Coding-Decoding

In a certain code, BELIEF is written as AFKKDI. How is SELDOM written in that code?