Page 42 - Data Structures Interactive Book
P. 42

4.8  Exercise

                     Essay Questions

                 1.  Write a program to create a singly linked list and traverse it.
                 2.  Implement insertion at the beginning, end, and a specific position in a singly linked list.

                 3.  Write a program to delete a node from a singly linked list.

                 4.  Create a doubly linked list and demonstrate forward and backward traversal.

                 5.  Implement a circular linked list and show how it can be used for round-robin scheduling.

                 6.  Represent a polynomial using a linked list and evaluate it for a given value of   .
                     Multiple Choice Questions (MCQ)

                     Q1. What is the main advantage of linked lists over arrays?

                     a) Constant-time random access                   b) Dynamic memory allocation and flexible size
                     c) Faster searching                                           d) Less memory usage in all cases

                     Q2. In a singly linked list, each node contains:

                     a) Only data                                                       b) Data and a pointer to the next node

                     c) Data and pointers to both previous and next nodes             d) Only a pointer to the next node

                     Q3. Which of the following is TRUE about doubly linked lists?
                     a) They allow traversal in only one direction

                     b) They require less memory than singly linked lists

                     c) They allow traversal in both forward and backward directions
                     d) They cannot be used for deletion operations

                     Q4. What is the key feature of a circular linked list?

                     a) The last node points to NULL                      b) The last node points back to the first node

                     c) It cannot be traversed                                  d) It uses less memory than arrays

                    Q5. Which of the following is a common application of circular linked lists?
                     a) Binary search                                                  b) Round-robin scheduling

                     c) Polynomial evaluation                                  d) Balanced tree construction

              Q6. When representing a polynomial using a linked list, each node typically contains:
                    a) Only the coefficient                                       b) Only the exponent

                    c) Both coefficient and exponent                    d) A pointer to the array of terms






                                                             42
   37   38   39   40   41   42   43   44   45   46   47