Practice 30 C Programming Questions on Linked List
Q1. Write a program in C to create a linked list with three nodes containing data 10, 20, and 30, and display the data in each node.
Q2. Write a program in C to insert a node with data 5 at the beginning of a linked list that initially contains the values 10 and 20.
Q3. Write a program in C to insert a node with data 40 at the end of a linked list that initially contains the values 10, 20, and 30.
Q4. Write a program in C to delete the first node of a linked list that initially contains 10 -> 20 -> 30.
Q5. Write a program in C to delete the last node of a linked list that initially contains 10 -> 20 -> 30.
Q6. Write a program in C to find and display the number of nodes in a linked list that contains the values 10 -> 20 -> 30.
Q7. Write a program in C to search for a specific value (e.g., 20) in a linked list and indicate whether it’s present.
Q8. Write a program in C to reverse a linked list with the values 10 -> 20 -> 30.
Q9. Write a program in C to insert a node with data 25 at position 2 in a linked list initially containing 10 -> 20 -> 30.
Q10. Write a program in C to delete a node at position 2 from a linked list that initially contains 10 -> 20 -> 30.
Q11. Write a program in C to copy a linked list with values 10 -> 20 -> 30 to a new linked list.
Q12. Write a program in C to check if a linked list has a loop (cycle) in it.
Q13. Write a program in C to flatten a multilevel linked list (for simplicity, assume all nodes only have next pointers).
Q14. Write a program in C to merge two sorted linked lists into a single sorted linked list.
Q15. Write a program in C to remove duplicates from a linked list.
Q16. Write a program in C to calculate the sum of all elements in a linked list containing 10 -> 20-> 30.
Q17. Write a program in C to swap two nodes in a linked list.
Q18. Write a program in C to find the Kth node from the end of a linked list containing 10 -> 20 -> 30 -> 40.
Q19. Write a program in C to check if a linked list is a palindrome.
Q20. Write a program in C to create a cycle in a linked list.
Q21. Write a program in C to find the middle node of a linked list containing 10 -> 20 -> 30 -> 40 -> 50.
Q22. Write a program in C to reverse a linked list containing 10 -> 20 -> 30.
Q23. Write a program in C to remove the N-th node from the end of a linked list containing 10 -> 20 -> 30 -> 40 -> 50.
Q24. Write a program in C to add two numbers represented by linked lists, where each node contains a single digit. The digits are stored in reverse order.
Q25. Write a program in C to find the intersection point of two linked lists.
Q26. Write a program in C to delete a linked list and free the memory.
Q27. Write a program in C to merge two sorted linked lists into a single sorted linked list.
Q28. Write a program in C to detect a cycle in a linked list.
Q29. Write a program in C to clone a linked list where each node has a next pointer and a random pointer.
Q30. Write a program in C to print the elements of a linked list in reverse order without modifying the list.
Bikki Singh
Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!