C Programming Interview Questions and Answers - 1

Question: 1

What is an endless loop?

An endless loop can mean two things.

One is that it was designed to loop continuously until the condition within the loop is met, after which a break function would cause the program to step out of the loop.

Another idea of an endless loop is when an incorrect loop condition was written, causing the loop to run erroneously forever. Endless loops are oftentimes referred to as infinite loops.

Question: 2

What are the advantages and disadvantages of a heap?

Storing data on the heap is slower than it would take when using the stack.

However, the main advantage of using the heap is its flexibility.

That’s because memory in this structure can be allocated and remove in any particular order. Slowness in the heap can be compensated if an algorithm was well designed and implemented.

Question: 3

What are linked lists?

A linked list is composed of nodes that are connected with another.

In C programming linked lists are created using pointers.

Using linked lists is one efficient way of utilizing memory for storage.

Question: 4

What are binary trees?

Binary trees are actually an extension of the concept of linked lists.

A binary tree has two pointers, a left one and right one. Each side can further branch to form additional nodes, which each node having two pointers as well.

Question: 5

What is the default statement used in switch case in C?

Switch case statements are used to execute only specifies case statements based on the switch expression.

If switch expression does not match with any case, default statements are executed by the program.

Related Questions