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

Agriculture

Which gas is fixed by Rhizobium bacteria present in the root nodules of a pea plant ?

Chemistry

The formation of sulphurous acid involves ?

The acid present in soft drinks is ?

The cathode of a dry cell is made of ?

The number of atoms present in the molecule of an element is known as its?

Physics

If the angle of incidence formed by a ray of light on a plane mirror is 37°, then the angle of refraction is?

A dynamo converts ?

If the time taken for hearing the echo of a girl's voice after reflection from a cliff is 6 seconds, calculate the distance of the girl from cliff ?

The physical quantity corresponding to the rate of change of displacement is..............?

Work done is said to be zero when an object moves at an angle of ............with respect to the force applied ?

Indian Geography

In terms of area, India is the ........largest country in the world ?

Indian Politics

How many members from the Anglo Indian community are nominated to the Lok Sabha?

Which of the following parts of the Constitution of India provides fundamental rights ?

Time and Work

Ram could complete a job alone in 6 days but Sunil would take thrice the time to do it alone.They started the work together but Ram had to leave a few days before the completion of the work and Sunil had to complete the remaining task by himself. If as a result , it took 6.75 days in all to complete the job, for how many days did the duo work together?

Profit and Loss

The cost price of 20 articles is equal to the selling price of 16 articles. Find the gain or loss percent?

Discount

Successive discount of 10% and 10% are equivalent to a single discount of ?

A discount series of 10%, 20% and 40% is equal to single discount of ?

Pepsi and Coke, there are two companies, selling the packs of cold­drinks. For the same selling price Pepsi gives two successive discounts of 10% and 25% on marked price, while Coke sells it by giving two successive discounts of 15% and 20% on marked price. What is the ratio of their marked price?