Skip to main content
Loading...
20% Off your first order         +1 309 992 1394

Computer Science Multiple Choice Questions Paper help

Computer Science Multiple Choice Questions Paper help

Computer Science Multiple Choice Questions Paper help

 
  1. A ____________ (with no duplicate elements) has the property that for every node in the tree the value of any node in its left subtree is less than the value of the node and the value of any node in its right subtree is greater than the value of the node.
  a. list
  b. binary search tree
  c. linked list
  d. binary tree

5 points   

QUESTION 2

  1. The        of a path  in a tree is the number of the edges in the path.
  a. length
  b. breadth
  c. height
  d. depth

5 points   

QUESTION 3

  1. In a binary tree, the        of a node is the length of the path from the root to the node.
  a. length
  b. height
  c. depth
  d. breadth

5 points   

QUESTION 4

  1. The        of a nonempty tree is the length of the path from the root node to its furthest leaf.
  a. length
  b. depth
  c. breadth
  d. height

5 points   

QUESTION 5

  1. What is the return type for the Tree search function?
  a. char
  b. int
  c. double
  d. boolean

5 points   

QUESTION 6

  1. The time complexity for searching an element in a binary search tree is_____________.
  a. O(n)
  b. O(nlogn)
  c. O(logn)
  d. O(n2)

5 points   

QUESTION 7

  1. In a binary search tree a new element is always inserted into a leaf node.

 True

 False

5 points   

QUESTION 8

  1. In a binary tree, the ______________ traversal is to visit the nodes level by level. First visit the root, then all children of the root from left to right, then grandchildren of the root from left to right, and so on.
  a. postorder
  b. preorder
  c. inorder
  d. breadth-first

5 points   

QUESTION 9

  1. In a binary tree, the _____________ traversal is to visit the left subtree of the current node first, then the current node itself, and finally the right subtree of the current node.
  a. preorder
  b. breadth-first
  c. inorder
  d. postorder

5 points   

QUESTION 10

  1. In a binary tree, the _____________ traversal is to visit the left subtree of the current node first, then the right subtree of the current node, and finally the current node itself.
  a. breadth-first
  b. postorder
  c. preorder
  d. inorder

5 points   

QUESTION 11

  1. In a binary tree, the _____________ traversal is to visit the current node first, then the left subtree of the current node, and finally the right subtree of the current node.
  a. inorder
  b. preorder
  c. breadth-first
  d. postorder

5 points   

QUESTION 12

  1. Suppose you have the following binary search tree.  What is the inorder traversal of the elements?
Diagram

Description automatically generated
  a. 4 45 21 12 92 3
  b. 12 21 92 45 4 3
  c. 4 21 12 92 45 3
  d. 3 4 45 21 12 92
  e. 3 4 12 21 45 92

5 points   

QUESTION 13

  1. Suppose you have the following binary search tree.  What is the postorder traversal of the elements?
Diagram

Description automatically generated
  a. 3 4 12 21 45 92
  b. 4 21 12 92 45 3
  c. 12 21 92 45 4 3
  d. 4 45 21 12 92 3
  e. 3 4 45 21 12 92

5 points   

QUESTION 14

  1. Suppose you have the following binary search tree.  What is the preorder traversal of the elements?
Diagram

Description automatically generated
  a. 3 4 12 21 45 92
  b. 4 45 21 12 92 3
  c. 3 4 45 21 12 92
  d. 12 21 92 45 4 3
  e. 4 21 12 92 45 3

5 points   

QUESTION 15

  1. Suppose you have the following binary search tree and insert 30 into the tree.  Where would 30 be placed?
Diagram

Description automatically generated
  a. right child of 12
  b. as the root (at the top)
  c. left child of 3
  d. left child of 92
  e. right child of 21

5 points   

QUESTION 16

  1. Suppose you have the following binary search tree and insert 2 into the tree.  Where would 2 be placed?
Diagram

Description automatically generated
  a. right child of 92
  b. right child of the root
  c. left child of the root
  d. as the root (at the top)
  e. left child of 4

5 points   

QUESTION 17

  1. Which of the following is correct to create a TreeNode for integer 50.
  a. TreeNode<Integer> node = new TreeNode<Integer>(50);
  b. TreeNode<Integer> node = new TreeNode<int>(50);
  c. TreeNode<int> node = new TreeNode<>(50);
  d. TreeNode<int> node = new TreeNode<int>(50);

5 points   

QUESTION 18

  1. The time complexity for inserting an element into a binary search tree is               .
  a. O(logn)
  b. O(n2)
  c. O(nlogn)
  d. O(n)

5 points   

QUESTION 19

  1. Suppose the keys 3, 4, 45, 21, 92, 12 are inserted into a BST in this order. What is the preorder traversal of the elements after inserting 2 into the tree?
  a. 3 2 4 12 21 45 92
  b. 3 2 4 45 21 12 92
  c. 4 2 45 21 12 92 3
  d. 12 2 21 92 45 4 3

5 points   

QUESTION 20

  1. The time complexity for deleting an element into a binary search tree is____.
  a. O(n2)
  b. O(n)
  c. O(logn)
  d. O(nlogn)

Our Advantages

  • Quality Work
  • Unlimited Revisions
  • Affordable Pricing
  • 24/7 Support
  • Fast Delivery

Order Now

Get 20% Discount

Get 20% off on your first order