C Interview Questions and Answers

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.

What are the usage of pointer in C?

A pointer is used in the following cases 
Accessing array elements
Dynamic memory allocation
Call by Reference
Data Structures like tree, graph, linked list etc.

What is Null Pointers?

A pointer is said to be a null pointer when its right value is either null or 0. Remember, a null pointernever point to valid data.

What is a pointer on pointer?

Pointer variable can hold the address of another pointer variable is known as a pointer on pointer.

What is the advantage of declaring void pointers?

The void pointer can be converted anytime into any generic type pointer by casting operator.

What is a pointer to a function?

A pointer can hold the reference of the function is called pointer to a function.

What is the difference between actual and formal parameters?

The parameters sent to the function at calling end are called as actual parameters while at the receiving of the function definition called as formal parameters.

What is Pass by Value & Pass by Reference?

Pass by Value:In this method,the value of each of the actual arguments in the calling function is copied into corresponding formal arguments of the called function.In pass by value,the changes made to formal arguments in the called function have no effect on the values of actual arguments in the calling function.

Pass by Reference:In this method,the addresses of actual arguments in the calling function are copied into formal arguments of the called function. This means that using these addresses, we would have an access to the actual arguments and hence we would be able to manipulate them.

What Is an Array?

An array is a collection of variables with same data type. Item of array is called an element. All elements in an array are referenced by the name of the array and are stored in a set of consecutive, adjacent memory slots.the index of an array starts from 0.

Latest Updates

Indian Geography

What is the approximate distance between earth and the moon?

Indian History

In which year was the battle of ‘Koregaon Bhima’ fought?

The approach that is very useful in organizing the content in history is.

General Knowledge of India

NITI Aayog stands for _____.

General Knowledge of MP

India’s first Ramayan art museum was established at?

Errors Identification

Read the sentence carefully and choose the option that has an error in it:
The management’s trusted employee was suspected of stealing large sum of money.

Read the sentence carefully and choose the option that has an error in it:
The teacher asked the child to repeat again because he spoke feebly.

Fill in the blank

Fill in the blank with the most appropriate preposition in the given sentence.
Let’s sit _________ the shade of this beautiful tree.

Choose the most appropriate determiner for the given sentence.
________of what he said was very sensible.

Substitution

Choose the option that substitutes the given phrase appropriately.
A work of art made by carving

Correct sentence

Choose the option that best transforms the sentence into its Indirect form:
‘What country do you come from?’ said the police officer.

Alternative Phrase

Choose the option that best explains the highlighted expression:
All human beings have feet of clay.

Fill in the blank

Choose an appropriate modal for the given sentence:
My doctor said that I_____ stop smoking as one of my lungs got infected.

Choose the appropriate prepositions for the given sentence:
My parents have been married ________ forty-nine years, but you can still see the love ________ their eyes.

Choose the appropriate conjunction for the given sentence:
______ it rains, the college will declare the holiday.

Antonyms

Choose the appropriate antonym for the highlighted word in the given sentence.
The family protracted their visit by several days.

Tenses

Choose the appropriate tenses to fill in the blanks in the given sentence:
Please _________ a noise. Ritu __________ to sleep.

Synonyms

Choose the appropriate synonym for the highlighted word in the given sentence.
Does he really expect us to believe such a flimsy excuse?