In our campus placement series, this is set-2 of programming questions. Below are little more advanced and frequently asked questions. Purpose of this set is to getting you ready for any kind of question that may be asked.

**Programming Questions :-**

Q1. How do you find the middle of a linked list? Write a C program to return the middle of a

linked list ?

Q2. How to create a copy of a linked list? Write a C program to create a copy of a linked

list.

Q3. How do you reverse a linked list without using any C pointers?

Q4. Write your own C program to implement the atoi() function

Q5. Write C code to solve the Tower of Hanoi problem.

Q6. Given two strings A and B, how would you find out if the characters in B were a subset

of the characters in A?

Q7. How to generate prime numbers? How to generate the next prime after a given prime?

Q8. Write C code to check if a given binary tree is a binary search tree or not?

Q9. Write a C program to count bits set in an integer?

Q10. What’s the difference between const char *p, char * const p and const char * const p?

Q11. Given a singly linked list, determine whether it contains a loop or not.

Q12. Write an algorithm to find the first non-repeated character in a string. For example, the first non-repeated character in the string ‘abcdab’ is ‘c’.

Q13. Remove Duplicate elements You are given an array of elements. Some/all of them are duplicates. Find them in 0(n) time and 0(1) space. Property of inputs – Number are in the range of 1..n where n is the limit of the array.

Q14. Given and Array of A[1..n] bits, find the length of longest consecutive substring of 0 and 1 such that number of 0s and 1s are equal.

Q15. Given an Array of Integers, Find two elements in the array whose sum is closest to zero?

If you have any problem in solving any questions, please do comment below. We will try to answer as soon as possible.