Data Structures Quiz :- 2 (IT-c)

10 Questions | Total Attempts: 80

SettingsSettingsSettings
Please wait...
Data Structures Quiz :- 2 (IT-c)

.


Questions and Answers
  • 1. 
    Assume a linked list has been created and start pointer is referring the first node of that linked list. select the following code that can add a new node that address hold by temp pointer, at beginning of that linked list
    • A. 

      Temp->link=start; start=temp;

    • B. 

      Start=temp; temp->link=start;

    • C. 

      Start=temp->link; temp=start;

    • D. 

      Temp=start; temp=start->link

  • 2. 
    Insertion of a node at the beginning of the singly linked list involves modification of
    • A. 

      One pointer

    • B. 

      Two pointer

    • C. 

      Three pointer

    • D. 

      Nothing

  • 3. 
    Assume a linked list referred by start pointer. which of the following set of statements will result into deletion of a node at position pos
    • A. 

      If(pos==1) start=start->link; else { t1=start; for(int i=2;ilink; } t1->link=t1->link->link; }

    • B. 

      If(pos==1) start=start->link; else { t1=start; for(int i=1;ilink; } t1->link=t1->link->link; }

    • C. 

      If(pos==1) start=start->link; else { t1=start; for(int i=1;ilink; } t1=t1->link; }

    • D. 

      If(pos==1) start=start->link; else { t1=start; for(int i=1;ilink; } t1->link=t1; }

  • 4. 
    Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is not given, can we delete the node X from given linked list?
    • A. 

      Possible if size of linked list is even

    • B. 

      Possible if size of linked list is odd

    • C. 

      Possible if X is not last node. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X.

    • D. 

      Possible if X is not first node. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X.

  • 5. 
    Which of the following points is/are true about Linked List data structure when it is compared with array
    • A. 

      Arrays have better cache locality that can make them better in terms of performance

    • B. 

      It is easy to insert and delete elements in Linked List

    • C. 

      Random access is not allowed in a typical implementation of Linked Lists

    • D. 

      All of the mentioned

  • 6. 
    What is the output of following function for start pointing to first node of following linked list?1->2->3->4->5->6void fun(struct node* start){ if(start==NULL)  return;  while(start->link!=NULL)  {  printf("%d ",(start->link)->info);  start=start->link;  } }
    • A. 

      1 2 3 4 5 6

    • B. 

      2 3 4 5 6

    • C. 

      2 3 4 5

    • D. 

      1 2 3 4 5

  • 7. 
    What is the change in linked list after execution of the following code?start:- points to first node of linkedstart->info=start->link->info;
    • A. 

      The values of first node and second node will be same

    • B. 

      The value of first node will be copied into second node

    • C. 

      The value of three node will be copied into first node

    • D. 

      No change

  • 8. 
    Linked is a ......
    • A. 

      Linear data structure

    • B. 

      Non linear data structure

    • C. 

      Dynamic data structure

    • D. 

      None

  • 9. 
    You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?
    • A. 

      Delete the first element

    • B. 

      Insert a new element as a first element

    • C. 

      Delete the last element of the list

    • D. 

      Add a new element at the end of the list

  • 10. 
    Binary search is possible in Linked list
    • A. 

      True

    • B. 

      False

Back to Top Back to top