GATE DA Python Data Structures & Collections | Set 1

Questions 76-80 of 100

0% completed (0/100 answered)
Your score 0/100 0 answered
Correct 0 Incorrect 0 Unanswered 100 Accuracy 0%

Question 76

NAT · Numerical Answer 1 mark

Consider the following Python class definition for a Linked List node:

PYTHON
class Node:
    def __init__{self, val}:
        self.val = val
        self.next = None

head = Node(10)
head.next = Node(20)
head.next.next = Node(30)

# Code:
curr = head
s = 0
while curr:
s += curr.val
curr = curr.next
print(s)

Answers for question 76

Question 77

MCQ · Single Correct 1 mark

In a Circular Singly Linked List with head pointer, what is the value of last_node.next?

Answers for question 77

Question 78

NAT · Numerical Answer 1 mark

A Hash Table with 7 slots uses hash function h(k) = k % 7 with chaining. Keys inserted: 10, 17, 24, 31. What is the length of the linked list chain at index 3?

Answers for question 78

Question 79

MCQ · Single Correct 1 mark

What is the worst-case time complexity of searching an element in an unbalanced Binary Search Tree (BST) with N nodes?

Answers for question 79

Question 80

NAT · Numerical Answer 1 mark

If the Preorder traversal of a tree is A B D E C and Inorder traversal is D B E A C, what is the leaf count of the tree?

Answers for question 80
Scroll to Top