McqMate
Q. |
How do you insert a node at the beginning of the list? |
A. | public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node); size++; } |
B. | public class insertfront(int data) { node node = new node(data, head, head); node.getnext().setprev(node); head.setnext(node); size++; } |
C. | public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(head); head.setnext(node); size++; } |
D. | public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node.getnext()); size++; } |
Answer» A. public class insertfront(int data) { node node = new node(data, head, head.getnext()); node.getnext().setprev(node); head.setnext(node); size++; } |
View all MCQs in
Data Structures (DS)No comments yet