[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Data Structures :: Linked Lists - Discussion

Home > Data Structures > Linked Lists > MCQs Questions Discussion

4 / 48

Choose the correct option.

Assume single linked list pseudo code as follows?

struct Node {
data
next
}
record List {
Node firstNode
}

function1(List list) {
obsoleteNode = list.firstNode; list.firstNode = list.firstNode.next; free obsoleteNode;
}

function2(node node) {
obsoleteNode = node.next; node.next= node.next.next; free obsoleteNode;
}

function3(Node node,Node newNode) {
newNode.next = node.next;node.next= newNode
}

function4(List list, Node newNode) {
newNode.next = list.firstNode; list.firstNode = newNode;
}

Afunction1 removes the first node

Bfunction2 removes node past this one

Cfunction3 inserts newNode after node

Dfunction4 inserts newNode after current first node

Answer: Option (Login/Signup)

Show Explanation

What is the purpose of  clear function provided.

def clear(self):

 self.tail = None

 self.head = None

Select one:

Asked In :: Commvault Societe Generale SAP Labs Capgemini

Post Your Answer Here:     

Reply    
Rate This: +1 -2 +
    Report


Report Error

Please Login First Click Here