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. |
Trie is also known as _________(a) Digital Tree(b) Treap(c) Binomial Tree(d) 2-3 TreeI want to ask this question from Trie topic in chapter Trie of Data Structures & Algorithms IThis question was addressed to me in a job interview. |
|
Answer» Correct choice is (a) Digital Tree |
|
| 2. |
What traversal over trie gives the lexicographical sorting of the set of the strings?(a) postorder(b) preorders(c) inorder(d) level orderI need to ask this question from Trie in chapter Trie of Data Structures & Algorithms IThis question was posed to me in homework. |
|
Answer» CORRECT option is (c) inorder Easy explanation - In trie, we store the strings in such a way that there is ONE node for EVERY COMMON prefix. Therefore the inorder traversal over trie gives the lexicographically sorted SET of strings. |
|
| 3. |
Which of the following is the efficient data structure for searching words in dictionaries?(a) BST(b) Linked List(c) Balancded BST(d) TrieMy question comes from Trie in chapter Trie of Data Structures & Algorithms IThis question was addressed to me in semester exam. |
|
Answer» Correct CHOICE is (d) Trie |
|
| 4. |
Which of the following special type of trie is used for fast searching of the full texts?(a) Ctrie(b) Hash tree(c) Suffix tree(d) T treeOrigin of the question is Trie topic in chapter Trie of Data Structures & Algorithms II got this question in a job interview. |
|
Answer» Correct choice is (c) Suffix tree |
|
| 5. |
Which of the following is not true?(a) Trie requires less storage space than hashing(b) Trie allows listing of all the words with same prefix(c) Tries are collision free(d) Trie is also known as prefix treeQuestion is taken from Trie topic in division Trie of Data Structures & Algorithms II had been asked this question in an online quiz. |
|
Answer» CORRECT answer is (a) Trie requires less storage space than hashing Easiest explanation - Both the hashing and the trie provides searching in the LINEAR TIME. But trie requires EXTRA space for storage and it is collision free. And trie allows finding all the strings with same prefix, so it is also called prefix tree. |
|
| 6. |
A program to search a contact from phone directory can be implemented efficiently using ______(a) a BST(b) a trie(c) a balanced BST(d) a binary treeMy question is based upon Trie in division Trie of Data Structures & Algorithms II had been asked this question in class test. |
|
Answer» The CORRECT choice is (b) a trie |
|
| 7. |
What can be the maximum depth of the trie with n strings and m as the maximum sting the length?(a) log2n(b) log2m(c) n(d) mMy doubt is from Trie in division Trie of Data Structures & Algorithms IThis question was addressed to me at a job interview. |
|
Answer» The correct choice is (d) m |
|
| 8. |
Which of the following is true about the trie?(a) root is letter a(b) path from root to the leat yields the string(c) children of nodes are randomly ordered(d) each node stores the associated keysThis intriguing question originated from Trie topic in section Trie of Data Structures & Algorithms II had been asked this question during an online exam. |
|
Answer» RIGHT answer is (b) path from root to the leat YIELDS the string Easiest explanation - A trie is an ordered tree where (i) the root represents an empty string(“”) (ii) each NODE other than root is labeled with a character (III) the children of a nodes are lexicographically ordered (iv) the paths from the leaves to the root yields the strings. |
|
| 9. |
Auto complete and spell checkers can be implemented efficiently using the trie.(a) True(b) FalseEnquiry is from Trie in portion Trie of Data Structures & Algorithms IThis question was posed to me during an interview for a job. |
|
Answer» CORRECT answer is (a) True Explanation: TRIE PROVIDES fast searching and storing of the words. And tries STORES words in lexicographical order so, trie is the efficient data structure for implementation of spell checkers and AUTO complete. |
|
| 10. |
What is the other name for Suffix Tree?(a) Array(b) Stack(c) Priority Queue(d) PAT TreeAsked question is from Suffix Tree topic in division Trie of Data Structures & Algorithms IThis question was posed to me in my homework. |
|
Answer» Correct CHOICE is (d) PAT Tree |
|
| 11. |
Which tree allows fast implementation of string operation?(a) Rope Tree(b) Suffix Tree(c) Tango Tree(d) Top TreeQuestion is taken from Suffix Tree in section Trie of Data Structures & Algorithms IThe question was asked in quiz. |
|
Answer» Correct option is (B) Suffix Tree |
|
| 12. |
How much time does construction of suffix tree take?(a) O (log M)(b) O (M!)(c) Exponential to Length of Tree(d) Linear to Length of TreeMy doubt stems from Suffix Tree topic in division Trie of Data Structures & Algorithms II have been asked this question in an online quiz. |
|
Answer» Right ANSWER is (d) Linear to Length of Tree |
|
| 13. |
How much space does construction of suffix tree takes?(a) O (log M)(b) Exponential to Length of Tree(c) O (M!)(d) Linear to Length of TreeOrigin of the question is Suffix Tree topic in section Trie of Data Structures & Algorithms IThis question was addressed to me at a job interview. |
|
Answer» Correct option is (d) Linear to Length of Tree |
|
| 14. |
Which tree provides a linear time solution for substring operation?(a) Rope Tree(b) Suffix Tree(c) Tango Tree(d) Top TreeMy question is based upon Suffix Tree topic in division Trie of Data Structures & Algorithms II had been asked this question by my college professor while I was bunking the class. |
|
Answer» Correct ANSWER is (b) SUFFIX Tree |
|
| 15. |
Who proposed the concept of Suffix Tree?(a) Weiner(b) Samuel F. B. Morse(c) Friedrich Clemens Gerke(d) Alexander MorseThis interesting question is from Suffix Tree topic in division Trie of Data Structures & Algorithms IThe question was asked in examination. |
|
Answer» Right OPTION is (a) Weiner |
|
| 16. |
Who among the following provided the first online contribution of Suffix Tree?(a) Weiner(b) Samuel F. B. Morse(c) Ukkonen(d) Alexander MorseMy question comes from Suffix Tree in division Trie of Data Structures & Algorithms IThis question was addressed to me in an internship interview. |
|
Answer» Right choice is (c) UKKONEN |
|
| 17. |
What is the time complexity of Uttkonen’s algorithm?(a) O (log n!)(b) O (n!)(c) O (n^2)(d) O (n log n)I need to ask this question from Suffix Tree in division Trie of Data Structures & Algorithms IThis question was posed to me in my homework. |
|
Answer» CORRECT option is (d) O (n log n) To explain: The concept of SUFFIX Tree was INTRODUCED by Weiner in 1973. UKKONEN provided the FIRST online contribution of Suffix tree which had the time complexity of the fastest algorithm of that period. Ukkonen’s algorithm had a time complexity of n log n. |
|
| 18. |
Who among the following algorithm is used in external memory and compression of the suffix tree?(a) Weiner’s algorithm(b) Farach’s algorithm(c) Ukkonen’s algorithm(d) Alexander MorseOrigin of the question is Suffix Tree topic in section Trie of Data Structures & Algorithms IThis question was addressed to me by my college professor while I was bunking the class. |
|
Answer» Right choice is (b) Farach’s algorithm |
|
| 19. |
Who among the following provided the first suffix tree contribution for all alphabet?(a) Weiner(b) Farach(c) Ukkonen(d) Alexander MorseI would like to ask this question from Suffix Tree topic in portion Trie of Data Structures & Algorithms IThe question was asked in a national level competition. |
|
Answer» Correct CHOICE is (b) Farach |
|
| 20. |
Do all the nodes have at least two children in suffix tree.(a) True(b) FalseI want to ask this question from Suffix Tree topic in section Trie of Data Structures & Algorithms II have been asked this question during an interview. |
|
Answer» The correct choice is (b) False |
|
| 21. |
Which statement is correct of suffix tree with a string of length n?(a) The tree has n leaves.(b) The tree has n roots(c) Height of Tree is n(d) Depth of tree is nThe origin of the question is Suffix Tree in division Trie of Data Structures & Algorithms II had been asked this question in my homework. |
|
Answer» The correct option is (a) The tree has n leaves. |
|
| 22. |
Can the two edges that are coming out of a node have labels of string beginning with the same character?(a) True(b) FalseThis key question is from Suffix Tree topic in portion Trie of Data Structures & Algorithms II have been asked this question in semester exam. |
|
Answer» The correct choice is (b) False |
|
| 23. |
Which tree allows fast implementation of a set of string operation?(a) Rope Tree(b) Tango Tree(c) Generalized Suffix Tree(d) Top TreeThe above asked question is from Suffix Tree in chapter Trie of Data Structures & Algorithms II got this question in an interview for internship. |
|
Answer» Correct option is (c) Generalized Suffix Tree |
|
| 24. |
What is a time complexity for checking a string of length n is substring or not?(a) O (log n!)(b) O (n!)(c) O (n^2)(d) O (n)My question is taken from Suffix Tree in chapter Trie of Data Structures & Algorithms II have been asked this question by my college professor while I was bunking the class. |
|
Answer» Correct OPTION is (d) O (N) |
|
| 25. |
What is a time complexity for x pattern occurrence of length n?(a) O (log n!)(b) Ɵ (n!)(c) O (n^2)(d) Ɵ (n + x)I want to ask this question from Suffix tree topic in portion Trie of Data Structures & Algorithms II have been asked this question in an online quiz. |
|
Answer» The correct option is (d) Ɵ (n + x) |
|
| 26. |
What is a time complexity for finding the longest substring that is common in string S1 and S2 (n1 and n2 are the string lengths of strings s1, s2 respectively)?(a) O (log n!)(b) Ɵ (n!)(c) O (n^2+ n1)(d) Ɵ (n1 + n2)Question is taken from Suffix tree in chapter Trie of Data Structures & Algorithms II had been asked this question at a job interview. |
|
Answer» The correct answer is (d) Ɵ (N1 + n2) |
|
| 27. |
What is a time complexity for finding the longest substring that is repeated in a string?(a) O (log n!)(b) Ɵ (n!)(c) O (n^2+ n1)(d) Ɵ (n)This interesting question is from Suffix tree topic in chapter Trie of Data Structures & Algorithms IThis question was addressed to me during an internship interview. |
|
Answer» Right choice is (d) Ɵ (n) |
|
| 28. |
What is a time complexity for finding frequently occurring of a substring of minimum length in a string?(a) Ɵ (n)(b) Ɵ (n!)(c) O (n^2+ n1)(d) O (log n!)This interesting question is from Suffix tree in division Trie of Data Structures & Algorithms II got this question during an internship interview. |
|
Answer» RIGHT choice is (a) Ɵ (n) The best explanation: Suffix Tree allows FAST string operation. To check if a substring is present in a string of a length of n, the TIME complexity for such operation is found to be O (n). The time complexity for FINDING frequently occurring of a substring of minimum length in a string is Ɵ (n). |
|
| 29. |
What is a time complexity for finding the longest prefix that is common between suffix in a string?(a) Ɵ (n)(b) Ɵ (n!)(c) Ɵ (1)(d) O (log n!)This question is from Suffix tree in division Trie of Data Structures & Algorithms IThis question was posed to me in an interview. |
|
Answer» RIGHT option is (c) Ɵ (1) The best explanation: Suffix Tree allows fast string operation. To check if a substring is present in a string of a length of N, the time complexity for such operation is found to be O (n). The time complexity for finding the longest PREFIX that is COMMON between suffix in a string is Ɵ (1). |
|
| 30. |
What is a time complexity for finding all the maximal palindrome in a string?(a) Ɵ (n)(b) Ɵ (n!)(c) Ɵ (1)(d) O (log n!)Question is from Suffix tree in chapter Trie of Data Structures & Algorithms II have been asked this question in examination. |
|
Answer» CORRECT choice is (a) Ɵ (n) The explanation is: Palindrome is a string that is the same when READING forward as well as backward. To CHECK if a substring is present in a string of a LENGTH of n, the time complexity for such operation is found to be O (n). The time complexity for finding all the maximal palindrome in a string is Ɵ (n). |
|
| 31. |
What is a time complexity for finding all the tandem repeats?(a) Ɵ (n)(b) Ɵ (n!)(c) Ɵ (1)(d) O (n log n + z)Query is from Suffix tree topic in chapter Trie of Data Structures & Algorithms IThe question was posed to me at a job interview. |
|
Answer» The correct option is (a) Ɵ (n) |
|
| 32. |
What is a time complexity for finding the longest palindromic substring in a string by using the generalized suffix tree?(a) Linear Time(b) Exponential Time(c) Logarithmic Time(d) Cubic TimeThe above asked question is from Suffix tree in section Trie of Data Structures & Algorithms II got this question in an online interview. |
|
Answer» Right option is (a) Linear Time |
|
| 33. |
Which of the following algorithm of data compression uses a suffix tree?(a) Weiner’s algorithm(b) Farach’s algorithm(c) Lempel – Ziv – Welch’s algorithm(d) Alexander Morse’s algorithmThe question is from Suffix tree topic in chapter Trie of Data Structures & Algorithms IThe question was asked during an interview. |
|
Answer» The CORRECT option is (C) Lempel – Ziv – Welch’s algorithm |
|
| 34. |
Which of the following data clustering algorithm uses suffix tree in search engines?(a) Weiner’s algorithm(b) Farach’s algorithm(c) Lempel – Ziv – Welch’s algorithm(d) Suffix Tree ClusteringThis key question is from Suffix tree in chapter Trie of Data Structures & Algorithms II had been asked this question in an online quiz. |
|
Answer» Correct option is (d) Suffix Tree Clustering |
|
| 35. |
What is a time complexity for finding the total length of all string on all edges of a tree?(a) Ɵ (n)(b) Ɵ (n!)(c) Ɵ (1)(d) O (n^2)This is a very interesting question from Suffix tree topic in chapter Trie of Data Structures & Algorithms IThe question was posed to me by my college professor while I was bunking the class. |
|
Answer» Correct choice is (d) O (N^2) |
|
| 36. |
Can suffix tree be used in string problems occurring in a text editor.(a) True(b) FalseThe doubt is from Suffix tree in section Trie of Data Structures & Algorithms II got this question in an online quiz. |
|
Answer» RIGHT answer is (a) True The best I can explain: It is a compressed search tree or prefix tree in which keys contain the suffix of text values as the text POSITION. So, the suffix tree can be used in string PROBLEMS occurring in a text editor. The time TAKEN to solve the PROBLEM is linear to the length of the string. |
|
| 37. |
Can suffix tree be used in bioinformatics problems and solutions.(a) True(b) FalseThis interesting question is from Suffix tree in division Trie of Data Structures & Algorithms IThe question was posed to me during an internship interview. |
|
Answer» Right option is (a) True |
|
| 38. |
For what size of nodes, the worst case of usage of space in suffix tree seen?(a) n Nodes(b) 2^n Nodes(c) 2n nodes(d) n! nodesQuestion is taken from Suffix tree in division Trie of Data Structures & Algorithms IThe question was posed to me during an online exam. |
|
Answer» Right CHOICE is (c) 2n nodes |
|
| 39. |
What is a time complexity for inserting an alphabet in the tree using hash maps?(a) O (log n!)(b) O (n!)(c) O (n^2)(d) O (1)The origin of the question is Suffix tree topic in chapter Trie of Data Structures & Algorithms IThis question was addressed to me during an interview. |
|
Answer» The correct choice is (d) O (1) |
|