Data Structures MCQs with answers parts 2 - letsbug

  Here is another 25 sets of Data structures MCQs with answers. To view previous set click here

1. Which of the following is false about a circular linked list?

  1. Every node has a successor
  2. Time complexity of inserting a new node at the head of the list is O(1) 
  3. Time complexity for deleting the last node is O(n)
  4. We can traverse the whole circular linked list by starting from any point

Answer: 2 :  Time complexity of inserting a new node at the head of the list is O(1)

2. How many children does a binary tree have?

  1. any number of children
  2. 0 or 1 or 2
  3. 0 or 1

Answer: 3 : 0 or 1 or 2

3. What is/are the disadvantages of implementing tree using normal arrays? 

  1. Difficulty in knowing children nodes of a node
  2. Difficult in finding the parent of a node
  3. Have to know the maximum number of nodes possible before creation of trees 
  4. Difficult to implement

Answer: 3 : Have to know the maximum number of nodes possible before creation of trees

4. What must be the ideal size of array if the height of tree is "I"?

  1. 2L-1
  2. L-1
  3. L
  4. 2L

Answer: 1: 2l -1 .

5. If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array?

  1. Every node stores data saying which of its children exist in the array
  2. No need of any changes continue with 2w+1, if node is at i
  3. Keep a seperate table telling children of a node
  4. use another array parallel to the array with tree

Answer: 1 : Every node stores data saying which of its children exist in the array 

6. Advantages of linked list representation of binary trees over arrays?

  1. dynamic size 
  2. Ease of insertion/deletion
  3. Ease in randomly accessing a node
  4. Both dynamic size and ease in insertion/deletion

Answer: 4: Both dynamic size and ease in insertion/deletion

7. Disadvantages of linked list representation of binary trees over arrays?

  1. Randomly accessing is not possible
  2. Extra memory for a pointer is needed with every element in the list
  3. Difficulty in deletion
  4. Random access is not possible and extra memory with every element.

Answer: 4 : Random access is not possible and extra memory with every element.

8.  Which of the following traversing algorithm is not used to traverse in a tree?

  1. Post order
  2. Pre order
  3. None
  4. Randomized

Answer: 4: Randomized

9. The following given tree is an example for? 

  1. Binary tree
  2. Binary search tree
  3. Fibonacci tree
  4. AVL tree

Answer: 2 : Binary Search tree

10. A binary tree is a rooted tree but not an ordered tree

  1. True
  2. False

Answer: 2: False 

11.  What is the traversal strategy used in the binary tree? 

  1. depth-first traversal
  2. breadth-first traversal
  3. random traversal
  4. priority traversal

Answer: 2 : Breadth-first traversal

12. How many types of insertion are performed in a binary tree?

  1. 1
  2. 2
  3. 3
  4. 4

Answer: 2 : 2

13. What operation does the following diagram depict?

  1. inserting a leaf node
  2. inserting an internal node
  3. deleting a node with 0 or 1 child
  4. deleting a node with 2 children

Answer: 4 : deleting a node with 2 children

14. The number of edges from the root to the node is called ________ of the tree.

  1. Height 
  2. Depth
  3. Length
  4. Width

Answer: 2: Depth

15. The number of edges from the node to deepest leaf is called ________ of the tree.    

  1. Height
  2. Depth
  3. Length
  4. Width

Answer: 1: Height

16. What is a full binary tree?

  1. Each node has exactly zero or two children
  2. Each node has exactly two children 
  3. All the leaves are at the same level
  4. Each node has exactly one or two children

Answer: 1 : Each node has exactly zero or two children

17. What is a complete binary tree? 

  1. Each node has exactly zero or two children
  2. A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from the right to left.
  3. A binary tree, which is completely filled, with the possible exception of bottom level, which is filled from left to right.
  4. A tree in which all nodes have degree 2

Answer: 3

18. What is the average case time complexity of finding the height of the binary tree?

  1. h = O(log log n)
  2. h = O(n log n)
  3. h = O(n)
  4. h = O(log n)

Answer: 4 : h = O(log n)

19. What is the speciality about the inorder traversal of a binary search tree? 

  1. It traverses in a non increasing order
  2. It traverses in an increasing order
  3. It traverses in a random fashion
  4. It traverses based on priority of the node

Answer: 2 : It traverses in an increasing order 

20.  What does the following piece of code do?

public void func(Tree root)
{
    func(root.left());
    func(root.right());
    System.out.println(root.data());
}

  1. preorder traversal
  2. Inorder traversal
  3. Postorder traversal
  4. Level order traversal

Answer: 3: Postorder traversal

21.  What does the following piece of code do?

public void func(Tree root)
{
    System.out.println(root.data());
    func(root.left());
    func(root.right());
}

  1. preorder traversal
  2. Inorder traversal
  3. Postorder traversal
  4. Level order traversal

Answer: 1: preorder traversal

22. Which of the following is not a stable sorting algorithm.

  1. Insertion sort
  2. Selection sort
  3. Bubble sort
  4. Merge sort

Answer: 2 : Selection sort 

23. What is an external sorting algorithm?

  1. Algorithm that uses tape or disk during the sort
  2. Algorithm that uses main memory during the sort
  3. Algorithm that involves swapping
  4. Algorithm that are considered 'in place'

Answer: 1: Algorithm that uses tape or disk during the sort

24. If the number records to be sorted is small, then ________ sorting can be efficient

  1. Merge
  2. Heap
  3. Selection
  4. Bubble

Answer: 3 : selection  

25. Which of the following is not an in-place sorting algorithm? 

  1. Selection sort
  2. Heap sort
  3. Quick sort
  4. Merge sort

Answer: 2 : Merge sort

To view previous set click here.

Comments

Categories

Big Data Analytics Binary Search Binary Search Tree Binary To Decimal binary tree Breadth First Search Bubble sort C Programming c++ Chemical Reaction and equation class 10 class 10th Class 9 Climate Complex Numbers computer network counting sort CSS Cyber Offenses Cyber Security Cyberstalking Data Science Data Structures Decimal To Binary Development diamond pattern Digital Marketing dust of snow Economics Economics Lesson 4 Email Validation English fire and ice Food Security in India Footprints Without feet Forest And Wildlife Resources game Geography Geography lesson 6 glassmorphism Glossary Graph HackerRank Solution hindi HTML image previewer India-Size And Location Insertion Sort Internet Network Status Interview Questions Introduction to cyber crime and cyber security IT javascript tricks json to CSV converter lesson 2 lesson 1 lesson 2 Lesson 3 Lesson 6 lesson 7 Life lines of National Economy life processes Linear Search Linked List lowest common ancestor Machine Learning MCQs median in array Merge sort min and max of two numbers Moment Money and Credit My Childhood Natural Vegetation and Wildlife NCERT Network connectivity devices Network Models Network Security No Men Are foreign Node.js operator overloading P5.js PHP Physical features of India Population Prime Numbers python Quick sort R language Rain on the roof Regular Expression Resources and development reversing array saakhi science Searching Algorithm Selection sort Social Media Marketing social science Software Engineering Software Testing Sorting Algorithm Stacks staircase pattern System Concepts Text Recognition The last Leaf time converter Time Passed From A Date Todo List App Tree Trending Technologies Understanding Economic Development username and password video player Visualization water resources Wired And Wireless LAN साखी
Show more

Popular Posts

Big Data MCQs(multiple choice questions) with answers - letsbug

Digital Marketing MCQ(Multiple Choice Questions) with Answers | part 1 | letsbug

Software Engineering MCQs questions with answers - letsbug