C Interview Questions and Answers

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.

What is Recursive Functions?

The function can be called by another function and can call itself from a statement inside the body of the function itself. When function called itself then is said to be recursive.

What is the purpose of main() function?

C program execution starts and ends with the main() function .
The main() function can returns an integer value to the environment that called the program. Where return 0; indicates program is terminated normally.

Can we compile a program without main() function?

Yes, we can compile program but it can't be executed.

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

The printf() function is used for output and scanf() function is used for input.

What is the difference between the while and do-while statements?

The main difference is that in the while statement, the conditional expression is evaluated at the top of the loop, while in the do-while statement, the conditional expression is evaluated at the bottom of the loop. 
Therefore, do-while statement are guaranteed to be executed at least once even conditional expression will be fail.

What is the difference between break and continue statement?

break is a keyword used to terminate the loop or exit from the block. The control jumps to next statement after the loop or block.
continue is a keyword used for skipping the current iteration and go to next iteration of the loop.

What goto statement do?

The goto statement is to enable the programmer to jump unconditional from one spot to some other spot in the code. Uses of goto statement is not recommended because it can make program unreliable and hard to debug.

What Is a Pointer?

A pointer is a special variable that contains the memory address of another variable or function. 
Whereas address-of operator (&) can be used to obtain the address of a variable and   the asterisk (*) in a variable declaration tells the compiler that the declared variable is a pointer.

Latest Updates

Ratio and Proportion

A certain sum of money is divided between A and B in the ratio of 5/4 : 5/3 and A got Rs. 360/-. Find the total sum of money and B’s share?

In an office, the ratio of the salaries of an officer and a clerk is 15:7. If the salary of a clerk is Rs. 720/- less than the salary of the officer, find the salary of each?

In an election to a municipal council, the votes secured by two candidates are in the ratio 13:19. The elected candidates gets 312 votes more than the second candidate. How many votes are secured by the second candidate?

A certain sum of money is divided between Murthy and Prasad in the ratio 22/7 : 8/3. If Murthy gets Rs. 120/- more than Prasad, find the share of each?

In a cricket test series, the runs made by Raju and Tendulkar are in the ratio 5:9 and Tendulkar and Azar are in the ratio 6:7. What are the runs made by them if Azar makes 187 runs more than Raju?

If A:B = 2:3 and B:C = 9:5 find A:B:C?

If A:B = 3/5:5/7 and B:C = 3/4:2/5, find A:B:C?

If R:S = 0.01:0.11 and S:T = 2.2:1, Find R:S:T?

In a school, Under a Saving Scheme, Rekha saves 3/2 times the savings of Bindu, Geeta saves 4 times the savings of Rekha. Find the ratio of the savings of all the three in least terms?

Simplification

A man left 1/3 rd of his property to his wife and 3/5 th of the remainder to his daughter. He gave the rest to his son who received Rs. 6400/-. How much was his original property worth?

Ratio and Proportion

In a school 4/9 of the pupils are boys. There are 125 girls. How many boys are there?

If A:B = 3:4 and B:C = 5:6, find A:C?

IF X:Y = 3:4 AND Y:Z = 4:5, FIND X:Y:Z?

Area

A house site is in the shape of a square. Its area is 1225 sq metres. What is its perimeter?

The area of a square field is 7396 sq metres. Find its perimeter?

Numbers

Twice the first of three consecutive even integer is 6 more than the second integer. What is the third integers?

Ratio and Proportion

If 2x=3y and 4y=5z, then what is x:z=?

What quantity must be added to each term of the ratio a + b : a – b to make it equal to (a + b)2 : (a – b)2 ?