3 3 votes Consider the following Python code:class Node: def __init__(self, data): self.data = data self.next = None n1 = Node(10) n2 = Node(20) n3 = Node(30) n1.next = n2 n2.next = n3 n2.data = n1.data + n3.data print(n1.data, n1.next.data, n1.next.next.data)What is the output of the code above?10 20 3010 40 3040 40 3010 30 40 Programming in Python goclasses goclasses-da-dpp goclasses-da-dpp-day-210 programming-in-python goclasses-python-&-dsa-practice-questions output + – GO Classes 165 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote A linked list is made using nodes. Each node can store data and a reference to the next node.Initially:n1.data = 10 n2.data = 20 n3.data = 30These statements create links between the nodes:n1.next = n2 n2.next = n3So:n1.next.data = n2.data n1.next.next.data = n3.dataNow:n2.data = n1.data + n3.data n2.data = 10 + 30 = 40Therefore:n1.data = 10 n1.next.data = n2.data = 40 n1.next.next.data = n3.data = 30The output is:10 40 30Correct Option: B GO Classes answered Jun 27 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.