SlideShare a Scribd company logo
1 of 17
Download to read offline
Q1. public void operationZ() throws StackUnderflowException
{
if(stackTop == null)
throw new StackUnderflowException();
stackTop = stackTop.link;
}//end operationZ
What does it mean if stackTop equals NULL in the operation above?
a. The stack is full
b. The stack is empty
c. The element does not exist
d. The stack is nonempty but not full
Q2. The bottom element of the stack is the last element added to the stack.
a. true
b. false
Q3. What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)?
a. x v * y w - +
b. - x y + v w *
c. x * y + v * w -
d. x y - v w + *
Q4. The item added to the stack last will be the item removed last.
a. true
b. false
Q5. StackClass s = new StackClass(50);
int x, y, z;
s.push(new IntElement(3));
s.push(new IntElement(7));
x = s.pop();
s.push(new IntElement(5));
y = s.pop();
z = s.pop();
Given the sequence of operations above, what is the value of x?
a. 0
b. 3
c. 5
d. 7
Q6. StackClass s = new StackClass(50);
int x, y, z;
s.push(new IntElement(3));
s.push(new IntElement(7));
x = s.pop();
s.push(new IntElement(5));
y = s.pop();
z = s.pop();
Given the sequence of operations above, what is the value of y?
a. 0
b. 3
c. 5
d. 7
Q7. In a linked list implementation of a stack, only a fixed number of elements can be pushed
onto the stack.
a. true
b. false
Q8. In a linked representation, memory for the stack elements is allocated dynamically.
a. true
b. false
Q9. Add and delete are two basic operations of queues.
a. true
b. false
Q10. FIFO is similar to the way customers in line at a bank are serviced.
a. true
b. false
Q11. The method front returns the first element in the queue.
a. true
b. false
Q12. A technique in which one system models the behavior of another system is called
simulation.
a. true
b. false
Q13. In a(n) ____ queue, customers or jobs with higher priority are pushed to the front of the
queue.
a. circular
b. priority
c. linked
d. array-based
Q14. Whenever an application is modeled on a FIFO structure, ____ are used.
a. lists
b. queues
c. stacks
d. arrays
Q15. In a priority queue, customers or jobs with higher priority are pushed to the back of the
queue.
a. true
b. false
Q16. Queue can be derived from the class ____.
a. LinkedListClass
b. stack
c. list
d. array
Q17. One of the disadvantages of chaining is that if the item size is small, a considerable amount
of space is wasted.
a. true
b. false
Q18. Hashing collision resolution techniques are classified into which of the following
categories?
a. open addressing only
b. chaining only
c. closed addressing only
d. both open addressing and chaining
Q19. One requirement of linear search is that the item must be in the array.
a. true
b. false
Q20. On average, the number of comparisons made by a sequential search is equal to one-third
the size of the list.
a. true
b. false
Q21. In linear search, you search an array starting from the middle component.
a. true
b. false
Q22. In sequential search, the array must be ordered.
a. true
b. false
Q23. If we want to design a search algorithm that is of an order less than log2n, then it ____ be
comparison based.
a. must
b. could
c. cannot
d. should
Q24. In chaining, the average number of comparisons for an unsuccessful search is equal to the
load factor.
a. true
b. false
Q25. Both random and quadratic probing eliminate ____.
a. primary clustering
b. secondary clustering
c. rehashing
d. random probing
Q26. Merge sort uses a pivot just like quick sort.
a. true
b. false
Q27. The insertion sort algorithm sorts the list by moving each element to its proper place.
a. true
b. false
Q28. The functions implementing sorting algorithms are included as private members of the
related class.
a. true
b. false
Q29. Merge sort can be implemented for only array based lists.
a. true
b. false
Q30. Insertion sort tries to reduce the number of key comparisons relative to which of the
following?
a. heap sort
b. merge sort
c. selection sort
d. quick sort
Q31. The worst case for the number of comparisons in quick sort is O(n2).
a. true
b. false
Q32. Suppose that L is a list of n elements, where n > 0. Let A(n) denote the number of key
comparisons in the average case of merge sort. Which of the following is true?
a. A(n) = O(n log2n)
b. A(n) = O(n log n)
c. A(n) = O(n2 log n)
d. A(n) = O(n2 log2n)
Q33. The selection sort algorithm sorts a list by selecting the smallest element in the (unsorted
portion of the) list, and then moving this smallest element to the ____ of the (unsorted) list.
a. pivot
b. top
c. middle
d. bottom
Q34. Quick sort overcomes the worst case scenario of heap sort.
a. true
b. false
Q35. The iterative preorder tree traversal function is known as ____.
a. nonrecursive preorder traversal
b. recursive preorder traversal
c. preorder traversal
d. nonrecursive postorder traversal
Q36. In a binary search tree, the key in the ____ node is larger than every key in the left subtree
and smaller than every key in the right subtree.
a. child
b. root
c. right
d. head
Q37. Any node in a binary tree can be called a leaf node.
a. true
b. false
Q38. There is a unique path from the ____ to every node in the binary tree.
a. branch
b. root
c. reference
d. info
Q39. Each node in a binary tree contains data and a link to the left child and a link to the right
child.
a. true
b. false
Q40. In an AVL tree: 1) the height of the left and right subtrees of the root differ by at most 2,
and 2) the left and right subtrees of the root are AVL trees.
a. true
b. false
Q41. There are ____ cases to consider when deleting a node from a binary search tree.
a. two
b. three
c. four
d. five
Q42. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree,
2) Visit the node, and 3) Traverse the right subtree.
a. true
b. false
Q43. The adjacency matrix AG is a two-dimensional n x n matrix such that the (i, j)the entry of
AG is 1 if there is an edge from vi to vj; otherwise, the (i, j)the entry is zero.
a. true
b. false
Q44. The ____-first traversal of a graph is similar to traversing a binary tree level by level.
a. height
b. depth
c. breadth
d. width
Q45. In an undirected graph G = (V, E), the elements of E are ordered pairs.
a. true
b. false
Q46. A tree T is called a ____ tree of graph G if T is a subgraph of G such that V(T ) = V(G),
that is, all the vertices of G are in T.
a. spanning
b. binary
c. binary search
d. short
Q47. The edges connecting two vertices can be assigned a nonnegative real number, called the
____ of the edge.
a. height
b. weight
c. depth
d. level
Q48. A graph G has a spanning tree if and only if G is disconnected.
a. true
b. false
Q49. The two most common graph traversal algorithms are the height first traversal and breadth
first traversal.
a. true
b. false
Q50. The depth first traversal is similar to the postorder traversal of a binary tree.
a. true
b. falseQ1. public void operationZ() throws StackUnderflowException
{
if(stackTop == null)
throw new StackUnderflowException();
stackTop = stackTop.link;
}//end operationZ
What does it mean if stackTop equals NULL in the operation above?
a. The stack is full
b. The stack is empty
c. The element does not exist
d. The stack is nonempty but not full
Q2. The bottom element of the stack is the last element added to the stack.
a. true
b. false
Q3. What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)?
a. x v * y w - +
b. - x y + v w *
c. x * y + v * w -
d. x y - v w + *
Q4. The item added to the stack last will be the item removed last.
a. true
b. false
Q5. StackClass s = new StackClass(50);
int x, y, z;
s.push(new IntElement(3));
s.push(new IntElement(7));
x = s.pop();
s.push(new IntElement(5));
y = s.pop();
z = s.pop();
Given the sequence of operations above, what is the value of x?
a. 0
b. 3
c. 5
d. 7
Q6. StackClass s = new StackClass(50);
int x, y, z;
s.push(new IntElement(3));
s.push(new IntElement(7));
x = s.pop();
s.push(new IntElement(5));
y = s.pop();
z = s.pop();
Given the sequence of operations above, what is the value of y?
a. 0
b. 3
c. 5
d. 7
Q7. In a linked list implementation of a stack, only a fixed number of elements can be pushed
onto the stack.
a. true
b. false
Q8. In a linked representation, memory for the stack elements is allocated dynamically.
a. true
b. false
Q9. Add and delete are two basic operations of queues.
a. true
b. false
Q10. FIFO is similar to the way customers in line at a bank are serviced.
a. true
b. false
Q11. The method front returns the first element in the queue.
a. true
b. false
Q12. A technique in which one system models the behavior of another system is called
simulation.
a. true
b. false
Q13. In a(n) ____ queue, customers or jobs with higher priority are pushed to the front of the
queue.
a. circular
b. priority
c. linked
d. array-based
Q14. Whenever an application is modeled on a FIFO structure, ____ are used.
a. lists
b. queues
c. stacks
d. arrays
Q15. In a priority queue, customers or jobs with higher priority are pushed to the back of the
queue.
a. true
b. false
Q16. Queue can be derived from the class ____.
a. LinkedListClass
b. stack
c. list
d. array
Q17. One of the disadvantages of chaining is that if the item size is small, a considerable amount
of space is wasted.
a. true
b. false
Q18. Hashing collision resolution techniques are classified into which of the following
categories?
a. open addressing only
b. chaining only
c. closed addressing only
d. both open addressing and chaining
Q19. One requirement of linear search is that the item must be in the array.
a. true
b. false
Q20. On average, the number of comparisons made by a sequential search is equal to one-third
the size of the list.
a. true
b. false
Q21. In linear search, you search an array starting from the middle component.
a. true
b. false
Q22. In sequential search, the array must be ordered.
a. true
b. false
Q23. If we want to design a search algorithm that is of an order less than log2n, then it ____ be
comparison based.
a. must
b. could
c. cannot
d. should
Q24. In chaining, the average number of comparisons for an unsuccessful search is equal to the
load factor.
a. true
b. false
Q25. Both random and quadratic probing eliminate ____.
a. primary clustering
b. secondary clustering
c. rehashing
d. random probing
Q26. Merge sort uses a pivot just like quick sort.
a. true
b. false
Q27. The insertion sort algorithm sorts the list by moving each element to its proper place.
a. true
b. false
Q28. The functions implementing sorting algorithms are included as private members of the
related class.
a. true
b. false
Q29. Merge sort can be implemented for only array based lists.
a. true
b. false
Q30. Insertion sort tries to reduce the number of key comparisons relative to which of the
following?
a. heap sort
b. merge sort
c. selection sort
d. quick sort
Q31. The worst case for the number of comparisons in quick sort is O(n2).
a. true
b. false
Q32. Suppose that L is a list of n elements, where n > 0. Let A(n) denote the number of key
comparisons in the average case of merge sort. Which of the following is true?
a. A(n) = O(n log2n)
b. A(n) = O(n log n)
c. A(n) = O(n2 log n)
d. A(n) = O(n2 log2n)
Q33. The selection sort algorithm sorts a list by selecting the smallest element in the (unsorted
portion of the) list, and then moving this smallest element to the ____ of the (unsorted) list.
a. pivot
b. top
c. middle
d. bottom
Q34. Quick sort overcomes the worst case scenario of heap sort.
a. true
b. false
Q35. The iterative preorder tree traversal function is known as ____.
a. nonrecursive preorder traversal
b. recursive preorder traversal
c. preorder traversal
d. nonrecursive postorder traversal
Q36. In a binary search tree, the key in the ____ node is larger than every key in the left subtree
and smaller than every key in the right subtree.
a. child
b. root
c. right
d. head
Q37. Any node in a binary tree can be called a leaf node.
a. true
b. false
Q38. There is a unique path from the ____ to every node in the binary tree.
a. branch
b. root
c. reference
d. info
Q39. Each node in a binary tree contains data and a link to the left child and a link to the right
child.
a. true
b. false
Q40. In an AVL tree: 1) the height of the left and right subtrees of the root differ by at most 2,
and 2) the left and right subtrees of the root are AVL trees.
a. true
b. false
Q41. There are ____ cases to consider when deleting a node from a binary search tree.
a. two
b. three
c. four
d. five
Q42. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree,
2) Visit the node, and 3) Traverse the right subtree.
a. true
b. false
Q43. The adjacency matrix AG is a two-dimensional n x n matrix such that the (i, j)the entry of
AG is 1 if there is an edge from vi to vj; otherwise, the (i, j)the entry is zero.
a. true
b. false
Q44. The ____-first traversal of a graph is similar to traversing a binary tree level by level.
a. height
b. depth
c. breadth
d. width
Q45. In an undirected graph G = (V, E), the elements of E are ordered pairs.
a. true
b. false
Q46. A tree T is called a ____ tree of graph G if T is a subgraph of G such that V(T ) = V(G),
that is, all the vertices of G are in T.
a. spanning
b. binary
c. binary search
d. short
Q47. The edges connecting two vertices can be assigned a nonnegative real number, called the
____ of the edge.
a. height
b. weight
c. depth
d. level
Q48. A graph G has a spanning tree if and only if G is disconnected.
a. true
b. false
Q49. The two most common graph traversal algorithms are the height first traversal and breadth
first traversal.
a. true
b. false
Q50. The depth first traversal is similar to the postorder traversal of a binary tree.
a. true
b. false
Solution
Ans for Question 1
-> StackTop always point to the top element of the stack. So if it is null, then there is no element
in the stack.The stack is empty (option b)
Ans for Question 2
-> No, Stack is a LIFO property (Last In First Out). So bottom element is the first element added
to the stack ( Option b)
Ans for Question 3
-> The postfix expression will be x y - v w + * ( Option d)
Ans for Question 4
-> No, As for the FIFO property, The item added to the stack last will be the item removed
first.So it is false ( Option b)
Ans for Question 5
-> After push 3 and 7, The stack will be [ 3 7 ] and the top points to 7. When it perform pop()
then the top element will be popped( here 7 ). After this, the stack will be [ 3 ]. Now again is
push 5. So the stack will be [ 3 7 ]. Then y=s.pop(); y=7; So value of y=7. (option d)
Ans for Question 6
-> When we push 3 and 7 in the stack named s, the stack looks like [ 3 7 ] and top points to 7.
Now x=s.pop(). so x = 7 and stack look like [ 3 ]. Now again we insert 5. So, now it looks like [
3 5 ] and top = 5. Now y=s.pop(). so it returns the top element that is 5. So y=5.(Option c)
Ans for Question 7
-> That depends on how to implement it. We can make it both fixed size and variable no. But in
general, as link list is used, so it is variable size. So it is false( Option 7)
Ans for Question 8
-> True.memory allocation of the list is dynamical.
Ans for Question 9
-> No, There is no add delete operation, There is ENQUEUE and DEQUEUE operation.
ENQUEUE for insert element in Queue and DEQUEUE for remove element.(Option b)
Ans for Question 10
-> Yes,FIFO mean first in first out. That's in mountain in bank ( Option a)
Ans for Question 11
-> Yes, Front returns the first inserted element of the Queue.(Option a)

More Related Content

Similar to Q1. public void operationZ() throws StackUnderflowException {   .pdf

Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdfMemeMiner
 
Assignment week0 c++
Assignment  week0 c++Assignment  week0 c++
Assignment week0 c++Netaji Gandi
 
Mcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search trMcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search trAbramMartino96
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdfahsaan3123
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdfahsaan3123
 
Ds qb 2021 rma
Ds qb 2021 rmaDs qb 2021 rma
Ds qb 2021 rmaARAVINDRM2
 
Mid termexam review
Mid termexam reviewMid termexam review
Mid termexam reviewKevin Mackay
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arraystameemyousaf
 
The number of key comparisons in a sequential search depends on the .pdf
The number of key comparisons in a sequential search depends on the .pdfThe number of key comparisons in a sequential search depends on the .pdf
The number of key comparisons in a sequential search depends on the .pdfmichardsonkhaicarr37
 
هياكلبيانات
هياكلبياناتهياكلبيانات
هياكلبياناتRafal Edward
 
14review(abstract classandinterfaces)
14review(abstract classandinterfaces)14review(abstract classandinterfaces)
14review(abstract classandinterfaces)IIUM
 

Similar to Q1. public void operationZ() throws StackUnderflowException {   .pdf (20)

Lab 1
Lab 1Lab 1
Lab 1
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
Assignment week0 c++
Assignment  week0 c++Assignment  week0 c++
Assignment week0 c++
 
Mcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search trMcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search tr
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdf
 
MCQs on Stacks.pdf
MCQs on Stacks.pdfMCQs on Stacks.pdf
MCQs on Stacks.pdf
 
Chapter03
Chapter03Chapter03
Chapter03
 
Data structures
Data structuresData structures
Data structures
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
Ds qb 2021 rma
Ds qb 2021 rmaDs qb 2021 rma
Ds qb 2021 rma
 
Mid termexam review
Mid termexam reviewMid termexam review
Mid termexam review
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
 
The number of key comparisons in a sequential search depends on the .pdf
The number of key comparisons in a sequential search depends on the .pdfThe number of key comparisons in a sequential search depends on the .pdf
The number of key comparisons in a sequential search depends on the .pdf
 
CH4.pptx
CH4.pptxCH4.pptx
CH4.pptx
 
Data structures
Data structuresData structures
Data structures
 
Algo>Queues
Algo>QueuesAlgo>Queues
Algo>Queues
 
هياكلبيانات
هياكلبياناتهياكلبيانات
هياكلبيانات
 
Unit i(dsc++)
Unit i(dsc++)Unit i(dsc++)
Unit i(dsc++)
 
14review(abstract classandinterfaces)
14review(abstract classandinterfaces)14review(abstract classandinterfaces)
14review(abstract classandinterfaces)
 

More from fatoryoutlets

Write an informal paper that is exactly 3 pages long not counting th.pdf
Write an informal paper that is exactly 3 pages long not counting th.pdfWrite an informal paper that is exactly 3 pages long not counting th.pdf
Write an informal paper that is exactly 3 pages long not counting th.pdffatoryoutlets
 
Write a C program to find factorial of an integer n, where the user .pdf
Write a C program to find factorial of an integer n, where the user .pdfWrite a C program to find factorial of an integer n, where the user .pdf
Write a C program to find factorial of an integer n, where the user .pdffatoryoutlets
 
When was the black body mutation in drosophila melanogaster discover.pdf
When was the black body mutation in drosophila melanogaster discover.pdfWhen was the black body mutation in drosophila melanogaster discover.pdf
When was the black body mutation in drosophila melanogaster discover.pdffatoryoutlets
 
What is it that consumer researchers try to find among varying cultu.pdf
What is it that consumer researchers try to find among varying cultu.pdfWhat is it that consumer researchers try to find among varying cultu.pdf
What is it that consumer researchers try to find among varying cultu.pdffatoryoutlets
 
What are pros and cons of Symantec endpoint security softwareSo.pdf
What are pros and cons of Symantec endpoint security softwareSo.pdfWhat are pros and cons of Symantec endpoint security softwareSo.pdf
What are pros and cons of Symantec endpoint security softwareSo.pdffatoryoutlets
 
All of the following describe the International Accounting Standard .pdf
All of the following describe the International Accounting Standard .pdfAll of the following describe the International Accounting Standard .pdf
All of the following describe the International Accounting Standard .pdffatoryoutlets
 
The right and left sternocleidomastoid muscles of humans originate o.pdf
The right and left sternocleidomastoid muscles of humans originate o.pdfThe right and left sternocleidomastoid muscles of humans originate o.pdf
The right and left sternocleidomastoid muscles of humans originate o.pdffatoryoutlets
 
The code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdfThe code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdffatoryoutlets
 
the ability of the cardiac muscle cells to fire on their own is .pdf
the ability of the cardiac muscle cells to fire on their own is .pdfthe ability of the cardiac muscle cells to fire on their own is .pdf
the ability of the cardiac muscle cells to fire on their own is .pdffatoryoutlets
 
Template LinkedList;I am using templates to make some linkedLists.pdf
Template LinkedList;I am using templates to make some linkedLists.pdfTemplate LinkedList;I am using templates to make some linkedLists.pdf
Template LinkedList;I am using templates to make some linkedLists.pdffatoryoutlets
 
Surface water entering the North Atlantic may have a temperature of .pdf
Surface water entering the North Atlantic may have a temperature of .pdfSurface water entering the North Atlantic may have a temperature of .pdf
Surface water entering the North Atlantic may have a temperature of .pdffatoryoutlets
 
Suppose the rate of plant growth on Isle Royale supported an equilib.pdf
Suppose the rate of plant growth on Isle Royale supported an equilib.pdfSuppose the rate of plant growth on Isle Royale supported an equilib.pdf
Suppose the rate of plant growth on Isle Royale supported an equilib.pdffatoryoutlets
 
Print Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdf
Print Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdfPrint Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdf
Print Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdffatoryoutlets
 
Part A 1. Solid product forms during the addition of the bleach solu.pdf
Part A 1. Solid product forms during the addition of the bleach solu.pdfPart A 1. Solid product forms during the addition of the bleach solu.pdf
Part A 1. Solid product forms during the addition of the bleach solu.pdffatoryoutlets
 
Only 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdf
Only 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdfOnly 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdf
Only 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdffatoryoutlets
 
Note Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdfNote Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdffatoryoutlets
 
Negotiations are not usually faster in Deal focused cultures than re.pdf
Negotiations are not usually faster in Deal focused cultures than re.pdfNegotiations are not usually faster in Deal focused cultures than re.pdf
Negotiations are not usually faster in Deal focused cultures than re.pdffatoryoutlets
 
9. The tort of assault and the tort of battery A) can occur independe.pdf
9. The tort of assault and the tort of battery A) can occur independe.pdf9. The tort of assault and the tort of battery A) can occur independe.pdf
9. The tort of assault and the tort of battery A) can occur independe.pdffatoryoutlets
 
Jj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdf
Jj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdfJj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdf
Jj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdffatoryoutlets
 
If law enforcement fails to give the defendant their Miranda rights,.pdf
If law enforcement fails to give the defendant their Miranda rights,.pdfIf law enforcement fails to give the defendant their Miranda rights,.pdf
If law enforcement fails to give the defendant their Miranda rights,.pdffatoryoutlets
 

More from fatoryoutlets (20)

Write an informal paper that is exactly 3 pages long not counting th.pdf
Write an informal paper that is exactly 3 pages long not counting th.pdfWrite an informal paper that is exactly 3 pages long not counting th.pdf
Write an informal paper that is exactly 3 pages long not counting th.pdf
 
Write a C program to find factorial of an integer n, where the user .pdf
Write a C program to find factorial of an integer n, where the user .pdfWrite a C program to find factorial of an integer n, where the user .pdf
Write a C program to find factorial of an integer n, where the user .pdf
 
When was the black body mutation in drosophila melanogaster discover.pdf
When was the black body mutation in drosophila melanogaster discover.pdfWhen was the black body mutation in drosophila melanogaster discover.pdf
When was the black body mutation in drosophila melanogaster discover.pdf
 
What is it that consumer researchers try to find among varying cultu.pdf
What is it that consumer researchers try to find among varying cultu.pdfWhat is it that consumer researchers try to find among varying cultu.pdf
What is it that consumer researchers try to find among varying cultu.pdf
 
What are pros and cons of Symantec endpoint security softwareSo.pdf
What are pros and cons of Symantec endpoint security softwareSo.pdfWhat are pros and cons of Symantec endpoint security softwareSo.pdf
What are pros and cons of Symantec endpoint security softwareSo.pdf
 
All of the following describe the International Accounting Standard .pdf
All of the following describe the International Accounting Standard .pdfAll of the following describe the International Accounting Standard .pdf
All of the following describe the International Accounting Standard .pdf
 
The right and left sternocleidomastoid muscles of humans originate o.pdf
The right and left sternocleidomastoid muscles of humans originate o.pdfThe right and left sternocleidomastoid muscles of humans originate o.pdf
The right and left sternocleidomastoid muscles of humans originate o.pdf
 
The code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdfThe code in image3.cpp has the error as shown above, could you help .pdf
The code in image3.cpp has the error as shown above, could you help .pdf
 
the ability of the cardiac muscle cells to fire on their own is .pdf
the ability of the cardiac muscle cells to fire on their own is .pdfthe ability of the cardiac muscle cells to fire on their own is .pdf
the ability of the cardiac muscle cells to fire on their own is .pdf
 
Template LinkedList;I am using templates to make some linkedLists.pdf
Template LinkedList;I am using templates to make some linkedLists.pdfTemplate LinkedList;I am using templates to make some linkedLists.pdf
Template LinkedList;I am using templates to make some linkedLists.pdf
 
Surface water entering the North Atlantic may have a temperature of .pdf
Surface water entering the North Atlantic may have a temperature of .pdfSurface water entering the North Atlantic may have a temperature of .pdf
Surface water entering the North Atlantic may have a temperature of .pdf
 
Suppose the rate of plant growth on Isle Royale supported an equilib.pdf
Suppose the rate of plant growth on Isle Royale supported an equilib.pdfSuppose the rate of plant growth on Isle Royale supported an equilib.pdf
Suppose the rate of plant growth on Isle Royale supported an equilib.pdf
 
Print Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdf
Print Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdfPrint Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdf
Print Calculator Question 18 of 20 Sapling Learning Map do ment of Lu.pdf
 
Part A 1. Solid product forms during the addition of the bleach solu.pdf
Part A 1. Solid product forms during the addition of the bleach solu.pdfPart A 1. Solid product forms during the addition of the bleach solu.pdf
Part A 1. Solid product forms during the addition of the bleach solu.pdf
 
Only 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdf
Only 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdfOnly 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdf
Only 15 of the carbon-14 in a wooden bowl remains. How old is the b.pdf
 
Note Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdfNote Use Java Write a web server that is capable of processing only.pdf
Note Use Java Write a web server that is capable of processing only.pdf
 
Negotiations are not usually faster in Deal focused cultures than re.pdf
Negotiations are not usually faster in Deal focused cultures than re.pdfNegotiations are not usually faster in Deal focused cultures than re.pdf
Negotiations are not usually faster in Deal focused cultures than re.pdf
 
9. The tort of assault and the tort of battery A) can occur independe.pdf
9. The tort of assault and the tort of battery A) can occur independe.pdf9. The tort of assault and the tort of battery A) can occur independe.pdf
9. The tort of assault and the tort of battery A) can occur independe.pdf
 
Jj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdf
Jj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdfJj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdf
Jj_numjnamecityj1SorterParisj2PunchRomej3Reade.pdf
 
If law enforcement fails to give the defendant their Miranda rights,.pdf
If law enforcement fails to give the defendant their Miranda rights,.pdfIf law enforcement fails to give the defendant their Miranda rights,.pdf
If law enforcement fails to give the defendant their Miranda rights,.pdf
 

Recently uploaded

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 

Recently uploaded (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Q1. public void operationZ() throws StackUnderflowException {   .pdf

  • 1. Q1. public void operationZ() throws StackUnderflowException { if(stackTop == null) throw new StackUnderflowException(); stackTop = stackTop.link; }//end operationZ What does it mean if stackTop equals NULL in the operation above? a. The stack is full b. The stack is empty c. The element does not exist d. The stack is nonempty but not full Q2. The bottom element of the stack is the last element added to the stack. a. true b. false Q3. What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)? a. x v * y w - + b. - x y + v w * c. x * y + v * w - d. x y - v w + * Q4. The item added to the stack last will be the item removed last. a. true b. false Q5. StackClass s = new StackClass(50); int x, y, z; s.push(new IntElement(3)); s.push(new IntElement(7)); x = s.pop(); s.push(new IntElement(5)); y = s.pop();
  • 2. z = s.pop(); Given the sequence of operations above, what is the value of x? a. 0 b. 3 c. 5 d. 7 Q6. StackClass s = new StackClass(50); int x, y, z; s.push(new IntElement(3)); s.push(new IntElement(7)); x = s.pop(); s.push(new IntElement(5)); y = s.pop(); z = s.pop(); Given the sequence of operations above, what is the value of y? a. 0 b. 3 c. 5 d. 7 Q7. In a linked list implementation of a stack, only a fixed number of elements can be pushed onto the stack. a. true b. false Q8. In a linked representation, memory for the stack elements is allocated dynamically. a. true b. false Q9. Add and delete are two basic operations of queues. a. true b. false
  • 3. Q10. FIFO is similar to the way customers in line at a bank are serviced. a. true b. false Q11. The method front returns the first element in the queue. a. true b. false Q12. A technique in which one system models the behavior of another system is called simulation. a. true b. false Q13. In a(n) ____ queue, customers or jobs with higher priority are pushed to the front of the queue. a. circular b. priority c. linked d. array-based Q14. Whenever an application is modeled on a FIFO structure, ____ are used. a. lists b. queues c. stacks d. arrays Q15. In a priority queue, customers or jobs with higher priority are pushed to the back of the queue. a. true b. false Q16. Queue can be derived from the class ____. a. LinkedListClass b. stack c. list
  • 4. d. array Q17. One of the disadvantages of chaining is that if the item size is small, a considerable amount of space is wasted. a. true b. false Q18. Hashing collision resolution techniques are classified into which of the following categories? a. open addressing only b. chaining only c. closed addressing only d. both open addressing and chaining Q19. One requirement of linear search is that the item must be in the array. a. true b. false Q20. On average, the number of comparisons made by a sequential search is equal to one-third the size of the list. a. true b. false Q21. In linear search, you search an array starting from the middle component. a. true b. false Q22. In sequential search, the array must be ordered. a. true b. false Q23. If we want to design a search algorithm that is of an order less than log2n, then it ____ be comparison based. a. must b. could c. cannot
  • 5. d. should Q24. In chaining, the average number of comparisons for an unsuccessful search is equal to the load factor. a. true b. false Q25. Both random and quadratic probing eliminate ____. a. primary clustering b. secondary clustering c. rehashing d. random probing Q26. Merge sort uses a pivot just like quick sort. a. true b. false Q27. The insertion sort algorithm sorts the list by moving each element to its proper place. a. true b. false Q28. The functions implementing sorting algorithms are included as private members of the related class. a. true b. false Q29. Merge sort can be implemented for only array based lists. a. true b. false Q30. Insertion sort tries to reduce the number of key comparisons relative to which of the following? a. heap sort b. merge sort c. selection sort d. quick sort
  • 6. Q31. The worst case for the number of comparisons in quick sort is O(n2). a. true b. false Q32. Suppose that L is a list of n elements, where n > 0. Let A(n) denote the number of key comparisons in the average case of merge sort. Which of the following is true? a. A(n) = O(n log2n) b. A(n) = O(n log n) c. A(n) = O(n2 log n) d. A(n) = O(n2 log2n) Q33. The selection sort algorithm sorts a list by selecting the smallest element in the (unsorted portion of the) list, and then moving this smallest element to the ____ of the (unsorted) list. a. pivot b. top c. middle d. bottom Q34. Quick sort overcomes the worst case scenario of heap sort. a. true b. false Q35. The iterative preorder tree traversal function is known as ____. a. nonrecursive preorder traversal b. recursive preorder traversal c. preorder traversal d. nonrecursive postorder traversal Q36. In a binary search tree, the key in the ____ node is larger than every key in the left subtree and smaller than every key in the right subtree. a. child b. root c. right d. head
  • 7. Q37. Any node in a binary tree can be called a leaf node. a. true b. false Q38. There is a unique path from the ____ to every node in the binary tree. a. branch b. root c. reference d. info Q39. Each node in a binary tree contains data and a link to the left child and a link to the right child. a. true b. false Q40. In an AVL tree: 1) the height of the left and right subtrees of the root differ by at most 2, and 2) the left and right subtrees of the root are AVL trees. a. true b. false Q41. There are ____ cases to consider when deleting a node from a binary search tree. a. two b. three c. four d. five Q42. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. a. true b. false Q43. The adjacency matrix AG is a two-dimensional n x n matrix such that the (i, j)the entry of AG is 1 if there is an edge from vi to vj; otherwise, the (i, j)the entry is zero. a. true b. false
  • 8. Q44. The ____-first traversal of a graph is similar to traversing a binary tree level by level. a. height b. depth c. breadth d. width Q45. In an undirected graph G = (V, E), the elements of E are ordered pairs. a. true b. false Q46. A tree T is called a ____ tree of graph G if T is a subgraph of G such that V(T ) = V(G), that is, all the vertices of G are in T. a. spanning b. binary c. binary search d. short Q47. The edges connecting two vertices can be assigned a nonnegative real number, called the ____ of the edge. a. height b. weight c. depth d. level Q48. A graph G has a spanning tree if and only if G is disconnected. a. true b. false Q49. The two most common graph traversal algorithms are the height first traversal and breadth first traversal. a. true b. false Q50. The depth first traversal is similar to the postorder traversal of a binary tree. a. true b. falseQ1. public void operationZ() throws StackUnderflowException
  • 9. { if(stackTop == null) throw new StackUnderflowException(); stackTop = stackTop.link; }//end operationZ What does it mean if stackTop equals NULL in the operation above? a. The stack is full b. The stack is empty c. The element does not exist d. The stack is nonempty but not full Q2. The bottom element of the stack is the last element added to the stack. a. true b. false Q3. What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)? a. x v * y w - + b. - x y + v w * c. x * y + v * w - d. x y - v w + * Q4. The item added to the stack last will be the item removed last. a. true b. false Q5. StackClass s = new StackClass(50); int x, y, z; s.push(new IntElement(3)); s.push(new IntElement(7)); x = s.pop(); s.push(new IntElement(5)); y = s.pop(); z = s.pop();
  • 10. Given the sequence of operations above, what is the value of x? a. 0 b. 3 c. 5 d. 7 Q6. StackClass s = new StackClass(50); int x, y, z; s.push(new IntElement(3)); s.push(new IntElement(7)); x = s.pop(); s.push(new IntElement(5)); y = s.pop(); z = s.pop(); Given the sequence of operations above, what is the value of y? a. 0 b. 3 c. 5 d. 7 Q7. In a linked list implementation of a stack, only a fixed number of elements can be pushed onto the stack. a. true b. false Q8. In a linked representation, memory for the stack elements is allocated dynamically. a. true b. false Q9. Add and delete are two basic operations of queues. a. true b. false Q10. FIFO is similar to the way customers in line at a bank are serviced.
  • 11. a. true b. false Q11. The method front returns the first element in the queue. a. true b. false Q12. A technique in which one system models the behavior of another system is called simulation. a. true b. false Q13. In a(n) ____ queue, customers or jobs with higher priority are pushed to the front of the queue. a. circular b. priority c. linked d. array-based Q14. Whenever an application is modeled on a FIFO structure, ____ are used. a. lists b. queues c. stacks d. arrays Q15. In a priority queue, customers or jobs with higher priority are pushed to the back of the queue. a. true b. false Q16. Queue can be derived from the class ____. a. LinkedListClass b. stack c. list d. array
  • 12. Q17. One of the disadvantages of chaining is that if the item size is small, a considerable amount of space is wasted. a. true b. false Q18. Hashing collision resolution techniques are classified into which of the following categories? a. open addressing only b. chaining only c. closed addressing only d. both open addressing and chaining Q19. One requirement of linear search is that the item must be in the array. a. true b. false Q20. On average, the number of comparisons made by a sequential search is equal to one-third the size of the list. a. true b. false Q21. In linear search, you search an array starting from the middle component. a. true b. false Q22. In sequential search, the array must be ordered. a. true b. false Q23. If we want to design a search algorithm that is of an order less than log2n, then it ____ be comparison based. a. must b. could c. cannot d. should
  • 13. Q24. In chaining, the average number of comparisons for an unsuccessful search is equal to the load factor. a. true b. false Q25. Both random and quadratic probing eliminate ____. a. primary clustering b. secondary clustering c. rehashing d. random probing Q26. Merge sort uses a pivot just like quick sort. a. true b. false Q27. The insertion sort algorithm sorts the list by moving each element to its proper place. a. true b. false Q28. The functions implementing sorting algorithms are included as private members of the related class. a. true b. false Q29. Merge sort can be implemented for only array based lists. a. true b. false Q30. Insertion sort tries to reduce the number of key comparisons relative to which of the following? a. heap sort b. merge sort c. selection sort d. quick sort Q31. The worst case for the number of comparisons in quick sort is O(n2).
  • 14. a. true b. false Q32. Suppose that L is a list of n elements, where n > 0. Let A(n) denote the number of key comparisons in the average case of merge sort. Which of the following is true? a. A(n) = O(n log2n) b. A(n) = O(n log n) c. A(n) = O(n2 log n) d. A(n) = O(n2 log2n) Q33. The selection sort algorithm sorts a list by selecting the smallest element in the (unsorted portion of the) list, and then moving this smallest element to the ____ of the (unsorted) list. a. pivot b. top c. middle d. bottom Q34. Quick sort overcomes the worst case scenario of heap sort. a. true b. false Q35. The iterative preorder tree traversal function is known as ____. a. nonrecursive preorder traversal b. recursive preorder traversal c. preorder traversal d. nonrecursive postorder traversal Q36. In a binary search tree, the key in the ____ node is larger than every key in the left subtree and smaller than every key in the right subtree. a. child b. root c. right d. head Q37. Any node in a binary tree can be called a leaf node. a. true
  • 15. b. false Q38. There is a unique path from the ____ to every node in the binary tree. a. branch b. root c. reference d. info Q39. Each node in a binary tree contains data and a link to the left child and a link to the right child. a. true b. false Q40. In an AVL tree: 1) the height of the left and right subtrees of the root differ by at most 2, and 2) the left and right subtrees of the root are AVL trees. a. true b. false Q41. There are ____ cases to consider when deleting a node from a binary search tree. a. two b. three c. four d. five Q42. In an preorder traversal, the binary tree is traversed as follows: 1) Traverse the left subtree, 2) Visit the node, and 3) Traverse the right subtree. a. true b. false Q43. The adjacency matrix AG is a two-dimensional n x n matrix such that the (i, j)the entry of AG is 1 if there is an edge from vi to vj; otherwise, the (i, j)the entry is zero. a. true b. false Q44. The ____-first traversal of a graph is similar to traversing a binary tree level by level. a. height
  • 16. b. depth c. breadth d. width Q45. In an undirected graph G = (V, E), the elements of E are ordered pairs. a. true b. false Q46. A tree T is called a ____ tree of graph G if T is a subgraph of G such that V(T ) = V(G), that is, all the vertices of G are in T. a. spanning b. binary c. binary search d. short Q47. The edges connecting two vertices can be assigned a nonnegative real number, called the ____ of the edge. a. height b. weight c. depth d. level Q48. A graph G has a spanning tree if and only if G is disconnected. a. true b. false Q49. The two most common graph traversal algorithms are the height first traversal and breadth first traversal. a. true b. false Q50. The depth first traversal is similar to the postorder traversal of a binary tree. a. true b. false Solution
  • 17. Ans for Question 1 -> StackTop always point to the top element of the stack. So if it is null, then there is no element in the stack.The stack is empty (option b) Ans for Question 2 -> No, Stack is a LIFO property (Last In First Out). So bottom element is the first element added to the stack ( Option b) Ans for Question 3 -> The postfix expression will be x y - v w + * ( Option d) Ans for Question 4 -> No, As for the FIFO property, The item added to the stack last will be the item removed first.So it is false ( Option b) Ans for Question 5 -> After push 3 and 7, The stack will be [ 3 7 ] and the top points to 7. When it perform pop() then the top element will be popped( here 7 ). After this, the stack will be [ 3 ]. Now again is push 5. So the stack will be [ 3 7 ]. Then y=s.pop(); y=7; So value of y=7. (option d) Ans for Question 6 -> When we push 3 and 7 in the stack named s, the stack looks like [ 3 7 ] and top points to 7. Now x=s.pop(). so x = 7 and stack look like [ 3 ]. Now again we insert 5. So, now it looks like [ 3 5 ] and top = 5. Now y=s.pop(). so it returns the top element that is 5. So y=5.(Option c) Ans for Question 7 -> That depends on how to implement it. We can make it both fixed size and variable no. But in general, as link list is used, so it is variable size. So it is false( Option 7) Ans for Question 8 -> True.memory allocation of the list is dynamical. Ans for Question 9 -> No, There is no add delete operation, There is ENQUEUE and DEQUEUE operation. ENQUEUE for insert element in Queue and DEQUEUE for remove element.(Option b) Ans for Question 10 -> Yes,FIFO mean first in first out. That's in mountain in bank ( Option a) Ans for Question 11 -> Yes, Front returns the first inserted element of the Queue.(Option a)