
Data Structures and Algorithms Quiz Part2
Authored by Comprehensive Viva
Computers
University
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Construct a binary search tree by inserting 8, 6, 12, 3, 10, 9 one after another. To make the resulting tree as AVL tree which of the following is required?
One right rotation only
One left rotation followed by two right rotations
One left rotation and one right rotation
The resulting tree itself is AVL
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider a hash table of size seven, with starting index zero, and a hash function (2x + 5) mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 4, 9, 6 is inserted into the table using closed hashing? Note that '_' denotes an empty location in the table.
9, _, 1, 6, _, _, 4
1, _, 6, 9, _, _, 4
4, _, 9, 6, _, _, 1
1, _, 9, 6, _, _, 4
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following C program where TreeNode represents a node in a binary tree
struct TreeNode
{ struct TreeNode *leftChild;
struct TreeNode *rightChild;
int element; };
int CountNodes(struct TreeNode *t)
{ if((t==NULL)||((t->leftChild==NULL) && (t->rightChild==NULL)))
return 0;
else
{ return 1+CountNodes(t->leftChild)+CountNodes(t->rightChild) } }
The value returned by CountNodes when a pointer to the root of a binary tree is passed as its argument is
number of nodes
number of leaf nodes
number of non leaf nodes
number of leaf nodes-number of non leaf nodes
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many distinct binary search trees can be created out of 6 distinct keys?
7
36
140
132
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this: 2 5 1 7 9 12 11 10 Which statement is correct?
The pivot could be either the 7 or the 9.
The pivot could be the 7, but it is not the 9
The pivot is not the 7, but it could be the 9
Neither the 7 nor the 9 is the pivot.
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree with n internal nodes is:
nk
(n - 1) k+ 1
n( k - 1) + 1
n(k - 1)
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
If a node in a Binary search tree has two children, then its inorder predecessor has .........
No child
No left child
No right child
Two children
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
Digital and Analog transmission
Quiz
•
University
15 questions
GIS Unit III
Quiz
•
University
15 questions
Internet Basics
Quiz
•
5th Grade - University
15 questions
Preguntas sobre Excel 2016
Quiz
•
6th Grade - University
15 questions
ADB Quiz #1
Quiz
•
University
20 questions
Quiz Harian Gdevelop MPK
Quiz
•
University
15 questions
Computer and Other Human Inventions
Quiz
•
University
15 questions
Robotics Prelim
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University