InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
In an expression tree algorithm, what happens when an operand is encountered?(a) create one node pointing to a stack(b) pop the nodes from the stack(c) clear stack(d) merge all the nodesThis key question is from Trees in portion Trees of Data Structures & Algorithms II had been asked this question in my homework. |
|
Answer» Correct CHOICE is (a) CREATE one node pointing to a STACK |
|
| 2. |
What is the postfix expression for the following expression tree?(a) abcde++**(b) ab+cde+**(c) abc+de+**(d) abcd+*e+*This question is from Trees in portion Trees of Data Structures & Algorithms IThis question was posed to me in an international level competition. |
|
Answer» RIGHT answer is (b) ab+cde+** Easy explanation - If the GIVEN expression tree is evaluated, the POSTFIX expression ab+cde+** is OBTAINED. |
|
| 3. |
An expression tree’s nodes can be deleted by calling?(a) malloc(b) calloc(c) delete(d) freeOrigin of the question is Trees topic in division Trees of Data Structures & Algorithms II have been asked this question in examination. |
|
Answer» Right answer is (d) free |
|
| 4. |
++a*bc*+defg is an?(a) postfix expression(b) infix expression(c) prefix expression(d) invalid expressionThe origin of the question is Trees in division Trees of Data Structures & Algorithms IThis question was addressed to me in homework. |
|
Answer» RIGHT choice is (c) prefix EXPRESSION The BEST I can explain: It is a prefix expression obtained from a PREORDER traversal since it is of the form operator-operand-operand. |
|
| 5. |
An expression tree is created using?(a) postfix expression(b) prefix expression(c) infix expression(d) paranthesized expressionThis is a very interesting question from Trees in portion Trees of Data Structures & Algorithms IThis question was posed to me in an interview for internship. |
|
Answer» The correct CHOICE is (a) postfix expression |
|
| 6. |
Only infix expression can be made into an expression tree.(a) true(b) falseThe doubt is from Trees in portion Trees of Data Structures & Algorithms II had been asked this question in an online interview. |
|
Answer» The correct ANSWER is (B) false |
|
| 7. |
The average depth of a binary tree is given as?(a) O(N)(b) O(log N)(c) O(M log N)(d) O(√N)This question is from Trees topic in section Trees of Data Structures & Algorithms IThis question was posed to me during an interview. |
|
Answer» Correct choice is (d) O(√N) |
|
| 8. |
The expression obtained by recursively producing a left expression, followed by an operator, followed by recursively producing a right expression is called?(a) prefix expression(b) infix expression(c) postfix expression(d) paranthesized expressionMy query is from Trees topic in portion Trees of Data Structures & Algorithms IThis question was addressed to me in examination. |
|
Answer» Correct CHOICE is (b) INFIX EXPRESSION |
|
| 9. |
An expression tree is a kind of?(a) Binary search tree(b) Fibonacci tree(c) Binary tree(d) TreapI'd like to ask this question from Trees in division Trees of Data Structures & Algorithms IThis question was posed to me in a job interview. |
|
Answer» The correct CHOICE is (c) BINARY tree |
|
| 10. |
What does the other nodes of an expression tree(except leaves) contain?(a) only operands(b) only operators(c) both operands and operators(d) expressionMy question is taken from Trees topic in division Trees of Data Structures & Algorithms II have been asked this question during an interview for a job. |
|
Answer» Correct CHOICE is (b) only operators |
|
| 11. |
A node can have a minimum of one child.(a) true(b) falseI need to ask this question from Trees in portion Trees of Data Structures & Algorithms IThe question was asked by my college professor while I was bunking the class. |
|
Answer» RIGHT CHOICE is (a) true The BEST explanation: It is possible for a node to have at least ONE CHILD, as is the case with the unary minus operator. |
|
| 12. |
The leaves of an expression tree always contain?(a) operators(b) operands(c) null(d) expressionMy doubt stems from Trees topic in division Trees of Data Structures & Algorithms IThis question was posed to me in exam. |
|
Answer» CORRECT ANSWER is (B) operands The BEST I can explain: The leaves of an expression tree always contain the result of a given expression (i.e.) operands. |
|
| 13. |
Who invented k-d trees?(a) Arne Andersson(b) Jon Bentley(c) Jon Von Newmann(d) Rudolf BayerQuestion is from Trees topic in section Trees of Data Structures & Algorithms II got this question during an interview. |
|
Answer» Right option is (b) Jon BENTLEY |
|
| 14. |
The 2d search tree has the simple property that branching on odd levels is done with respect to the first key.(a) True(b) FalseI'd like to ask this question from Trees topic in division Trees of Data Structures & Algorithms IThis question was addressed to me during an online exam. |
|
Answer» Correct answer is (a) True |
|
| 15. |
What is the time taken for a range query for a perfectly balanced tree?(a) O(N)(b) O(log N)(c) O(√N+M)(d) O(√N)I want to ask this question from Trees topic in division Trees of Data Structures & Algorithms II got this question in an interview. |
|
Answer» The correct answer is (C) O(√N+M) |
|
| 16. |
Several kinds of queries are possible on a k-d called as?(a) partial queries(b) range queries(c) neighbour queries(d) search queriesThis interesting question is from Trees topic in chapter Trees of Data Structures & Algorithms II had been asked this question in homework. |
|
Answer» Right answer is (b) range queries |
|
| 17. |
Reducing search space by eliminating irrelevant trees is known as?(a) pruning(b) partial results(c) freeing space(d) traversingEnquiry is from Trees topic in chapter Trees of Data Structures & Algorithms IThis question was posed to me during an online exam. |
|
Answer» Correct answer is (a) pruning |
|
| 18. |
How many prime concepts are available in nearest neighbour search in a kd tree?(a) 1(b) 2(c) 3(d) 4The above asked question is from Trees in division Trees of Data Structures & Algorithms IThe question was asked by my school teacher while I was bunking the class. |
|
Answer» Correct answer is (c) 3 |
|
| 19. |
What is the run time of finding the nearest neighbour in a k-d tree?(a) O(2+ log N)(b) O( log N)(c) O(2^d log N)(d) O( N log N)My query is from Trees topic in chapter Trees of Data Structures & Algorithms IThe question was asked in homework. |
|
Answer» Right answer is (c) O(2^d log N) |
|
| 20. |
What is the worst case of finding the nearest neighbour?(a) O(N)(b) O(N log N)(c) O( log N)(d) O(N^3)Enquiry is from Trees topic in division Trees of Data Structures & Algorithms IThe question was asked during an interview. |
|
Answer» Correct answer is (a) O(N) |
|
| 21. |
Each level in a k-d tree is made of?(a) dimension only(b) cutting and dimension(c) color code of node(d) size of the levelI'd like to ask this question from Trees topic in section Trees of Data Structures & Algorithms II got this question by my college professor while I was bunking the class. |
|
Answer» CORRECT option is (B) CUTTING and dimension Explanation: Each level in a k-d tree is MADE of dimensions and cutting. Cutting and dimensions are used for INSERTION, deletion and searching purposes. |
|
| 22. |
What will be the correct sequence of insertion for the following k-d tree?(a) (30,40),(5,25),(70,70),(10,12),(50,30),(35,45)(b) (40,30),(5,25),(12,10),(70,70),(30,50),(45,35)(c) (30,40),(5,25),(10,12),(70,70),(50,30),(35,45)(d) (40,30),(25,5),(12,10),(70,70),(50,30),(45,35)My doubt stems from Trees in section Trees of Data Structures & Algorithms II got this question during an online exam. |
|
Answer» Right answer is (C) (30,40),(5,25),(10,12),(70,70),(50,30),(35,45) |
|
| 23. |
In a k-d tree, k originally meant?(a) number of dimensions(b) size of tree(c) length of node(d) weight of nodeThis key question is from Trees in portion Trees of Data Structures & Algorithms II got this question during an interview. |
|
Answer» CORRECT answer is (a) NUMBER of dimensions For explanation: INITIALLY, 2-d TREES were CREATED. Then, 3-d trees, 4-trees etc., where k meant the number of dimensions. |
|
| 24. |
Which of the following is the simplest data structure that supports range searching?(a) Heaps(b) binary search trees(c) AA-trees(d) K-d treesThe question is from Trees topic in portion Trees of Data Structures & Algorithms IThis question was posed to me in homework. |
|
Answer» The correct answer is (d) K-d TREES |
|
| 25. |
In a two-dimensional search tree, the root is arbitrarily chosen to be?(a) even(b) odd(c) depends on subtrees(d) 1My question is based upon Trees in division Trees of Data Structures & Algorithms II got this question in an international level competition. |
|
Answer» Correct answer is (b) odd |
|
| 26. |
Insertion into a 2-d tree is a trivial extension of insertion into a binary search tree.(a) true(b) falseQuery is from Trees in portion Trees of Data Structures & Algorithms IThis question was addressed to me in an online interview. |
|
Answer» Correct answer is (a) true |
|
| 27. |
In what time can a 2-d tree be constructed?(a) O(N)(b) O(N log N)(c) O(N^2)(d) O(M log N)My enquiry is from Trees topic in portion Trees of Data Structures & Algorithms IThis question was posed to me during a job interview. |
|
Answer» The correct answer is (b) O(N LOG N) |
|
| 28. |
Bigger the query rectangle the better is the query efficiency.(a) true(b) falseThis interesting question is from Trees topic in section Trees of Data Structures & Algorithms IThe question was posed to me in class test. |
|
Answer» Right choice is (b) false |
|
| 29. |
Efficiency of bin depends upon ___________(a) size of query and candidates(b) location of query and candidates(c) location and size of query and candidates(d) depends on the inputThe doubt is from Trees in chapter Trees of Data Structures & Algorithms IThe question was posed to me in homework. |
|
Answer» RIGHT option is (c) location and SIZE of query and candidates Explanation: Efficiency of BIN DEPENDS upon the location and size of query and candidates. It is SIMILAR to that of a hash table. |
|
| 30. |
What will be the time complexity of insertion operation if all the candidates are evenly spaced so that each bin has constant no. of candidates? (m = number of bins intersecting candidate intersects)(a) O(1)(b) O(m)(c) O(m^2)(d) O(log m)The query is from Trees in section Trees of Data Structures & Algorithms IThe question was asked in homework. |
|
Answer» Correct choice is (b) O(m) |
|
| 31. |
What will be the time complexity of delete operation if all the candidates are evenly spaced so that each bin has constant no. of candidates? (m = number of bins intersecting candidate intersects)(a) O(1)(b) O(m)(c) O(m^2)(d) O(log m)This interesting question is from Trees topic in chapter Trees of Data Structures & Algorithms II had been asked this question in my homework. |
|
Answer» Right option is (b) O(m) |
|
| 32. |
What will be the time complexity of query operation if all the candidates are evenly spaced so that each bin has constant no. of candidates? (k = number of bins query rectangle intersects)(a) O(1)(b) O(k)(c) O(k^2)(d) O(log k)Query is from Trees topic in section Trees of Data Structures & Algorithms IThis question was posed to me in examination. |
|
Answer» RIGHT answer is (B) O(k) The best I can EXPLAIN: The process of query becomes faster in a case when the number of candidates are equally DISTRIBUTED among the bins. In such a case the query operation becomes O(k). |
|
| 33. |
What is computational geometry?(a) study of geometry using a computer(b) study of geometry(c) study of algorithms(d) study of algorithms related to geometryThe query is from Trees topic in chapter Trees of Data Structures & Algorithms IThis question was posed to me during an interview. |
|
Answer» The correct CHOICE is (d) study of algorithms RELATED to geometry |
|
| 34. |
What is the worst case time complexity of insertion operation(n =no. of candidates)?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)My doubt is from Trees in section Trees of Data Structures & Algorithms II have been asked this question in exam. |
|
Answer» Right CHOICE is (a) O(1) |
|
| 35. |
What is the worst case time complexity of delete operation(n is the no. of candidates)?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)My question is from Trees in division Trees of Data Structures & Algorithms IThe question was asked in class test. |
|
Answer» The correct choice is (b) O(n) |
|
| 36. |
What is the worst case time complexity of query operation(n is the no. of candidates)?(a) O(1)(b) O(n)(c) O(log n)(d) O(n log n)Query is from Trees in chapter Trees of Data Structures & Algorithms IThe question was asked by my college professor while I was bunking the class. |
|
Answer» Correct answer is (B) O(n) |
|
| 37. |
Bin is an example of a range query data structure.(a) true(b) falseQuery is from Trees in division Trees of Data Structures & Algorithms IThe question was asked during an internship interview. |
|
Answer» The correct option is (a) true |
|
| 38. |
What is the use of the bin data structure?(a) to have efficient insertion(b) to have efficient deletion(c) to have efficient region query(d) to have efficient traversalI would like to ask this question from Trees in division Trees of Data Structures & Algorithms IThis question was posed to me in quiz. |
|
Answer» Right answer is (c) to have efficient region query |
|
| 39. |
What is the condition for an equivalence relation if two cities are related within a country?(a) the two cities should have a one-way connection(b) the two cities should have a two-way connection(c) the two cities should be in different countries(d) no equivalence relation will exist between two citiesMy enquiry is from Trees topic in portion Trees of Data Structures & Algorithms II have been asked this question in semester exam. |
|
Answer» Right answer is (b) the TWO cities should have a two-way connection |
|
| 40. |
What is the total time spent for N-1 merges in a dynamic equivalence problem?(a) O(N)(b) O(log N)(c) O(N log N)(d) O(M log N)The above asked question is from Trees in section Trees of Data Structures & Algorithms IThe question was asked in unit test. |
|
Answer» The CORRECT CHOICE is (c) O(N log N) |
|
| 41. |
How many strategies are followed to solve a dynamic equivalence problem?(a) 1(b) 2(c) 3(d) 4Asked question is from Trees in section Trees of Data Structures & Algorithms IThe question was asked in an internship interview. |
|
Answer» RIGHT choice is (b) 2 The BEST I can explain: There are two strategies INVOLVED to SOLVE a dynamic equivalence problem- executing find instruction in worst-case time and executing union instruction in worst-case time. |
|
| 42. |
In the Union/Find algorithm, the ranks of the nodes on a path will increase monotonically from?(a) leaf to root(b) root to node(c) root to leaf(d) left subtree to right subtreeQuestion is taken from Trees in section Trees of Data Structures & Algorithms IThis question was addressed to me in my homework. |
|
Answer» Right choice is (a) leaf to root |
|
| 43. |
What is the worst-case running time of unions done by size and path compression?(a) O(N)(b) O(logN)(c) O(N logN)(d) O(M logN)My question is based upon Trees topic in section Trees of Data Structures & Algorithms IThe question was asked by my school teacher while I was bunking the class. |
|
Answer» RIGHT CHOICE is (d) O(M logN) For explanation: The worst case running time of a union operation done by size and PATH compression is mathematically found to beO(M logN). |
|
| 44. |
What is the value for the number of nodes of rank r?(a) N(b) N/2(c) N/2^r(d) N^rThis intriguing question comes from Trees topic in portion Trees of Data Structures & Algorithms IThis question was addressed to me during an online exam. |
|
Answer» Correct CHOICE is (c) N/2^r |
|
| 45. |
When executing a sequence of Unions, a node of rank r must have at least 2^r descendants.(a) true(b) falseMy question comes from Trees in section Trees of Data Structures & Algorithms II have been asked this question in an interview for job. |
|
Answer» Correct choice is (a) true |
|
| 46. |
What is the depth of any tree if the union operation is performed by height?(a) O(N)(b) O(log N)(c) O(N log N)(d) O(M log N)My doubt is from Trees topic in division Trees of Data Structures & Algorithms II had been asked this question in semester exam. |
|
Answer» Correct choice is (B) O(LOG N) |
|
| 47. |
___________ is one of the earliest forms of a self-adjustment strategy used in splay trees, skew heaps.(a) Union by rank(b) Equivalence function(c) Dynamic function(d) Path compressionOrigin of the question is Trees topic in division Trees of Data Structures & Algorithms II had been asked this question at a job interview. |
|
Answer» Right choice is (d) PATH COMPRESSION |
|
| 48. |
What is the definition for Ackermann’s function?(a) A(1,i) = i+1 for i>=1(b) A(i,j) = i+j for i>=j(c) A(i,j) = i+j for i = j(d) A(1,i) = i+1 for i |
|
Answer» Correct option is (a) A(1,i) = i+1 for i>=1 |
|
| 49. |
Path Compression algorithm performs in which of the following operations?(a) Create operation(b) Insert operation(c) Find operation(d) Delete operationThis interesting question is from Trees topic in portion Trees of Data Structures & Algorithms IThe question was asked by my college professor while I was bunking the class. |
|
Answer» Right CHOICE is (C) Find operation |
|
| 50. |
What is the worst case efficiency for a path compression algorithm?(a) O(N)(b) O(log N)(c) O(N log N)(d) O(M log N)My doubt stems from Trees in section Trees of Data Structures & Algorithms IThis question was addressed to me in homework. |
|
Answer» RIGHT OPTION is (d) O(M log N) Best explanation: The worst case EFFICIENCY for a PATH COMPRESSION algorithm is mathematically found to be O(M log N). |
|