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

Physics

Atmospheric pressure at sea level equals ?

General Knowledge of India

Which of the following dance forms was introduced by the great Vaishnava saint and reformer Mahapurusha Sankaradeva ?

Which of the following is the only classical dance of india having links with Muslim culture and represents a unique synthesis of Hindu and Muslim genius in art ?

Time and Distance

Starting from the same point at the same time, Ruhan and Yuvan had to reach the same destination. While Ruhan drove at 45 km/hr, Yuvan was slower by 5 km/hr. If Yuvan arrived at the destination an hour after Ruhan did, the distance covered by each, in Kilometres, was ?

Simple Interest

A sum of money was invested at a certain rate of simple interest for 4 years. Had the sum been invested at a rate 3% higher than the actual rate, the interest earned would have been 720 Rs more. Find the sum initially invested?

Ratio and Proportion

A bag contains red, blue and black balls. The ratio of red to blue balls is 3 : 5. The ratio of black to red balls is 3 : 4. What is the ratio of blue to black balls?

Profit and Loss

Selling a pack of incense sticks for 136 Rs resulted in a loss of 15%. To make a profit of 10%, the selling price should be ?

Percentage

23% of a bucket full of diluted milk was water. If the quantity of pure milk in the bucket was 15.4 liter, then the capacity of the bucket was ?

Average

The average of the marks obtained by three girls in a test was twice the average of the marks obtained by eight boys in that test. If the total marks obtained by all these examinees was 168, find the average marks each of the girls obtained ?

Pipes and Cistern

44 pipes can fill a large water tank in 27 hours. How many hours it take for 66 pipes to fill four such tanks ?

HCF and LCM

A natural number, when divided by 3, 4, 5, 6, and 7 respectively, leaves corresponding remainder of 2, 3, 4, 5 and 6. What is the smallest of all such numbers fulfilling the above condition ?

Coding-Decoding

If in a certain code language, PRINT is written as 34825 and TRUE is written as 5479. Then, how will TENURE be written in that language?

Order Sequence

Arrange the given words from smallest to biggest-
1.Jug
2.Mug
3.Bucket
4.Drum
5.Cup

Statement and Conclusion

Statements
All socks are shoes
Some shoes are black

Conclusions
I. Some shoes are socks.
II. No scoks is black

Numbers

The difference between the place value of 4 and 2 in the number 833749502 is ?

Analogy

GIKM : HJLN :: PRTV : .........?

Order Sequence

In a row of girls, Nanda is eighth from the left and Chanda is nineteenth from right. When Nanda and Chanda interchange their positions, Chanda becomes twnty-third form right. How many girls are there in the row?

Analogy

Summer: Day :: Winter : ........?