Filters
Question type

Study Flashcards

What type of traversal occurs in the binary search trees __iter__ method?


A) sequential
B) postorder
C) preorder
D) inorder

E) B) and D)
F) A) and C)

Correct Answer

verifed

verified

Which of the following is not a part of a grammar?


A) vocabulary
B) semantic rules
C) syntax rules
D) method rules

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

When a linked binary search tree is instantiated, the self.root variable is set to self .

A) True
B) False

Correct Answer

verifed

verified

What operator causes the __contains__ method to run in the binary search tree implementation?


A) =
B) is
C) +
D) in

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

The number of comparisons required for a removal in an array-based heap is at most log2 n , so the pop operation is O(log n ).

A) True
B) False

Correct Answer

verifed

verified

The preorder traversal algorithm traverses the left subtree, visits the root node, and traverses the right subtree.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is true about a binary tree?


A) each node has at most two children
B) each node has only one child
C) child nodes can have multiple parents
D) the root node must have only one child

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Which type of binary tree traversal traverses the left subtree, visits, the root node, and traverses the right subtree?


A) postorder traversal
B) inorder traversal
C) preorder traversal
D) unordered traversal

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

In the following code for the __init__ method for the linked binary search tree, what is the missing code? def __init__(self, sourceCollection = None) : < missing code > AbstractCollection.__init__(sourceCollection)


A) self.root = sourceCollection
B) self.root = None
C) sourceCollection.__init__(AbstractCollection)
D) self.leaf = root

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

An expression tree is never empty.

A) True
B) False

Correct Answer

verifed

verified

With trees, each item, including the first and last, have a distinct successor.

A) True
B) False

Correct Answer

verifed

verified

The peek method in a heap implementation returns the bottom most item in the heap.

A) True
B) False

Correct Answer

verifed

verified

When the shape of a BST approaches that of a perfectly balanced binary tree, what is the worst case performance characteristic of searches and insertions?


A) O(log n )
B) O n
C) O( n )
D) O(log2 n )

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

What is the height of a full binary tree with 63 nodes?


A) 5
B) 8
C) 6
D) 7

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Which of the following is true about a max-heap?


A) each node is less than or equal to its children
B) the largest nodes are nearer to the root
C) the largest items are in the leaves
D) the smallest item is in the root node

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

The maximum amount of work that it takes to access a given node in a full binary tree is O( N ).

A) True
B) False

Correct Answer

verifed

verified

Which of the following carries out the actions specified by a sentence?


A) interpreter
B) parser
C) recognizer
D) compiler

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

An access, an insertion, or a removal of a node in vine-like tree with N nodes and a height of N - 1 would be linear in the worst case.

A) True
B) False

Correct Answer

verifed

verified

The inorder traversal algorithm visits a tree's root node and then traverses the left subtree and the right subtree in a similar manner.

A) True
B) False

Correct Answer

verifed

verified

Which type of binary tree traversal visits the tree's root node, the left subtree and then the right subtree?


A) postorder traversal
B) inorder traversal
C) preorder traversal
D) unordered traversal

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer