adplus-dvertising

Welcome to the Trees MCQs Page

Dive deep into the fascinating world of Trees with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Trees, a crucial aspect of Data Structures and Algorithms. In this section, you will encounter a diverse range of MCQs that cover various aspects of Trees, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Data Structures and Algorithms.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Trees. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Data Structures and Algorithms.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Trees. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Trees MCQs | Page 17 of 32

Explore more Topics under Data Structures and Algorithms

Q161.
What are the children for node β€˜w’ of a complete-binary tree in an array representation?
Discuss
Answer: (a).2w and 2w+1
Q162.
What is the parent for a node β€˜w’ of a complete binary tree in an array representation when w is not 0?
Discuss
Answer: (a).floor(w-1/2)
Discuss
Answer: (a).every node stores data saying which of its children exist in the array
Q164.
What must be the missing logic in place of missing lines for finding sum of nodes of binary tree in alternate levels?
 //e.g:-consider -complete binary tree:-height-3, [1,2,3,4,5,6,7]-answer must be 23
  n=power(2,height)-1; //assume input is height and a[i] contains tree elements
  for(i=1;i<=n;)
  {
        for(j=1;j<=pow(2,currentlevel-1);j++) //present level is initialized to 1 and sum is initialized to  0
        {
           sum=sum+a[i];
           i=i+1;
        }
     //missing logic
  }

a)

   i=i+pow(2,currentlevel);
   currentlevel=currentlevel+2;
   j=1;

b)

   i=i+pow(2,currentlevel);
   currentlevel=currentlevel+2;
   j=0;

c)

i=i-pow(2,currentlevel);
   currentlevel=currentlevel+2;
   j=1;
d)

   i=i+pow(2,currentlevel);
   currentlevel=currentlevel+1;
   j=1;

a.

a

b.

b

c.

c

d.

d

Discuss
Answer: (a).a
Discuss
Answer: (c).No it is not efficient in case of sparse trees and remaning cases it is fine
Q166.
Why is heap implemented using array representations than tree(linked list) representations though both tree representations and heaps have same complexities?

for binary heap

-insert: O(log n)

-delete min: O(log n)

for a tree

-insert: O(log n)

-delete: O(log n)

Then why go with array representation when both are having same values ?
Discuss
Answer: (d).all of the mentioned
Q167.
Can a tree stored in an array using either one of inorder or post order or pre order traversals be again reformed?
Discuss
Answer: (b).No we need one more traversal to form a tree
Q168.
Advantages of linked list representation of binary trees over arrays?
Discuss
Answer: (d).both dynamic size and ease in insertion/deletion
Discuss
Answer: (d).Random access is not possible and extra memory with every element
Discuss
Answer: (d).all of the mentioned

Suggested Topics

Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!