C Interview Questions and Answers

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.

How do declare an array?

We can declare an array by specify its data type, name and the number of elements the array holds between square brackets immediately following the array name.

ex
int array_int[10]; 

Can we access array using pointer in C language?

Yes, by holding the base address of array into pointer, we can access the array using pointer.

What is a string? How do you know its length?

In C, a string is a character array which is terminated by a null character (‘’). The null character tells the string functions to end of the string.
The strlen() function can be used to measure the length of a string. It returns the total number of bytes taken by the string and it is not counted the null character in the string.

What is static memory allocation?

Allocated the memory at compile time called static memory allocation.It is fixed and can't be increased at runtime.

Latest Updates

Trigonometry

What is the value of cot 4π/3 ?

Indian Politics

Article-24 of the Indian Constitution ‘Prohibition of employment of children in factories, etc’ deals with?

Article-134A of the Indian Constitution ‘Certificate for appeal to the Supreme Court’ deals with?

Chemistry

Who invented Aspirin?

Physics

A larger force on a rotating body results in larger?

What is the unit of the physical quantity, magnetic flux density?

Algebra

The system of equations 2x + 4y = 6 and 4x + 8y = 8 is ?

Time and Distance

A thief is spotted by a policeman from a distacne of 100 m. When the policeman starts the chase, the thief also starts running. If the speed of the theif is 8 km / hour and that of the policeman is 10 km/hour, then how far will the theif have to run before he is overtaken?

Algebra

Aman and Alok attempted to solve a quadratic equation. Aman made a mistake in writing down the constant term and ended up in roots (4, 3). Alok made a mistake in writing down the coefficient of x to get roots (3, 2). The correct roots of the equation are?

Compound Interest

The effective annual rate of interest corresponding to a nominal rate of 22% per annum payable half-yearly is?

Volume and Surface Area

If the volume of a cylinder is 2156 cubic cm and height is 14 cm, find its radius?

Algebra

What is the equation of the line which passes through the points (2, 3) and (- 4, 1)?

Triangles

In △ABC, the angle bisector of ∠A cuts BC at E. Find length of AC, if lengths of AB, BE and EC are 9 cm, 3.6 cm and 2.4 cm?

In a triangle, the length of the opposite side of the angle which measures 45° is 8√2 cm, what is the length of the side opposite to the angle which measures 90°?

General Knowledge of India

The boundary line between India and Pakistan is called?

Which city is located on the banks of the river Mahanadi?

Indian History

When was the battle of Haldighati fought?

In 1498, which Portuguese explorer discovered a new sea route from Europe to India?

General Knowledge of India

Chapchar Kut is a festival of which State?

Chemistry

In chemistry, soap is a salt of a ?

Indian Economy

Which of the following is a Direct tax?

Biology

Sauria lacertidae is the scientific name of?

Which of the following is a primary function of haemoglobin?

Average

A factory buys 8 machines.3 Machine A, 2 Machine B and rest Machine C. Prices of the machines are 100000, 80000 and 45000 respectively.Calculate the average cost of these machines?

Discount

Ticket for an adult is 500 and a child is 200. 1 child goes free with two adults. If a group has 20 adults and 8 children what will be the discount the group get?