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. |
What is the minimum possible time complexity to find the number of steps to reach the end of an array?(a) O(n)(b) O(n^2)(c) O(n^3/2)(d) O(1)My question comes from Number of Jumps to Reach End-array Operation topic in chapter Arrays Types of Data Structures & Algorithms II have been asked this question during an interview. |
|
Answer» RIGHT choice is (a) O(n) Easy explanation - The MINIMUM POSSIBLE time complexity to REACH the end of an ARRAY is O(n). So a linear time complexity is possible. |
|
| 2. |
: It is not possible to reach the end of an array if starting element of the array is 0.(a) true(b) falseMy question is taken from Number of Jumps to Reach End-array Operation topic in division Arrays Types of Data Structures & Algorithms IThis question was posed to me by my college professor while I was bunking the class. |
|
Answer» Right option is (a) true |
|
| 3. |
In how many different ways we can reach the end of the array arr[]={1,3,5,8,9}?(a) 1(b) 2(c) 3(d) 4Asked question is from Number of Jumps to Reach End-array Operation topic in portion Arrays Types of Data Structures & Algorithms IThe question was asked in homework. |
|
Answer» The CORRECT answer is (d) 4 |
|
| 4. |
It is not possible to find the minimum number of steps to reach the end of an array in linear time.(a) true(b) falseI'm obligated to ask this question of Number of Jumps to Reach End-array Operation topic in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me by my school teacher while I was bunking the class. |
|
Answer» Right answer is (B) false |
|
| 5. |
What will be the minimum number of jumps required to reach the end of the array arr[] = {1,2,0,0,3,6,8,5}?(a) 1(b) 2(c) 3(d) not possible to reach the endAsked question is from Number of Jumps to Reach End-array Operation topic in division Arrays Types of Data Structures & Algorithms IThe question was posed to me in an interview for job. |
|
Answer» Correct answer is (d) not possible to reach the END |
|
| 6. |
What will be the minimum number of jumps required to reach the end of the array arr[] ={0,1,3,6,3,6,8,5}?(a) 1(b) 2(c) 3(d) not possible to reach the endThe above asked question is from Number of Jumps to Reach End-array Operation in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in an interview for internship. |
|
Answer» Right ANSWER is (d) not possible to reach the end |
|
| 7. |
What will be the minimum number of jumps required to reach the end of the array arr[] = {1,3,6,3,6,8,5}?(a) 1(b) 2(c) 3(d) not possible to reach the endThis is a very interesting question from Number of Jumps to Reach End-array Operation in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me in an internship interview. |
|
Answer» RIGHT option is (c) 3 To explain: Each element of the array represents the maximum NUMBER of STEPS that can be taken forward from that element. If the first element is 0 then it is not possible to reach the END. |
|
| 8. |
Predefined function reverse() in C++ is available under which header file?(a) math(b) stdio(c) stdlib(d) algorithmThis intriguing question comes from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms IThe question was posed to me by my school principal while I was bunking the class. |
|
Answer» Right answer is (d) ALGORITHM |
|
| 9. |
Which of the following is the predefined function for array reversal in javascript?(a) reverse()(b) arr_reverse()(c) array_reverse()(d) rev()This interesting question is from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms II got this question in final exam. |
|
Answer» Right answer is (a) REVERSE() |
|
| 10. |
Which of the following is the predefined function for array reversal in C++ ?(a) reverse()(b) arr_reverse()(c) array_reverse()(d) rev()My question is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms II had been asked this question in semester exam. |
|
Answer» Right option is (a) reverse() |
|
| 11. |
When array reversal and rotation is applied to the same array then the output produced will also be the same every time.(a) true(b) falseThis is a very interesting question from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me during an online interview. |
|
Answer» The correct choice is (B) false |
|
| 12. |
How many swaps are required for reversing an array having n elements where n is an even number?(a) (n-1) / 2(b) n/2(c) (n/2) – 1(d) (n+1)/2Question is from Arrays Types in chapter Arrays Types of Data Structures & Algorithms II had been asked this question in unit test. |
|
Answer» CORRECT CHOICE is (b) n/2 To EXPLAIN: The number of swaps required for an odd element and an even element array is different because in an odd element array the position of the middle element does not NEED to be CHANGED. So number of swaps required will be n/2. |
|
| 13. |
How many swaps are required for reversing an array having n elements where n is an odd number?(a) (n-1) / 2(b) n/2(c) (n/2) – 1(d) (n+1)/2My question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThe question was asked in an interview. |
|
Answer» The correct choice is (a) (n-1) / 2 |
|
| 14. |
What will be the resulting array after reversing arr[]={3,5,4,2}?(a) 2,3,5,4(b) 4,2,3,5(c) 5,4,2,3(d) 2,4,5,3Question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThis question was posed to me in my homework. |
|
Answer» The correct answer is (d) 2,4,5,3 |
|
| 15. |
Reversal algorithm and juggling algorithm for array rotation have the same time complexity.(a) True(b) FalseI would like to ask this question from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was posed to me in semester exam. |
|
Answer» The correct choice is (a) True |
|
| 16. |
What is the time complexity of the juggling algorithm to rotate an array?(a) O(1)(b) O(n)(c) O(d)(d) O(n*d)My query is from Arrays Types in portion Arrays Types of Data Structures & Algorithms II have been asked this question in an international level competition. |
|
Answer» The CORRECT answer is (b) O(n) |
|
| 17. |
Which of the following algorithm to rotate an array has the maximum time complexity?(a) rotate elements one by one(b) juggling algorithm(c) reversal algorithm(d) using a temporary arrayI would like to ask this question from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was posed to me in examination. |
|
Answer» Right ANSWER is (a) rotate elements one by one |
|
| 18. |
Predefined function rotate() in C++ is available under which header file?(a) math(b) stdio(c) stdlib(d) algorithmMy question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms II had been asked this question in semester exam. |
|
Answer» The CORRECT ANSWER is (d) algorithm |
|
| 19. |
How many arguments are required by the predefined function rotate() in C++?(a) 1(b) 2(c) 3(d) 4The query is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThe question was asked in class test. |
|
Answer» The correct OPTION is (c) 3 |
|
| 20. |
Which of the following is the predefined function for array reversal in C++?(a) rotate()(b) arr_rotate()(c) array_rotate()(d) rot()My question comes from Arrays Types in section Arrays Types of Data Structures & Algorithms II got this question by my school teacher while I was bunking the class. |
|
Answer» Right option is (a) ROTATE() |
|
| 21. |
What will be the auxiliary space complexity of the code to rotate an array by using the reversal algorithm (d = number of rotations)?(a) O(1)(b) O(n)(c) O(d)(d) O(n*d)The query is from Arrays Types in chapter Arrays Types of Data Structures & Algorithms II got this question by my college director while I was bunking the class. |
|
Answer» RIGHT answer is (a) O(1) Explanation: The reversal ALGORITHM for rotating an array does not require any AUXILIARY space. So the auxiliary space COMPLEXITY will be O(1). |
|
| 22. |
To rotate an array by using the algorithm of rotating its elements one by one is an in place algorithm.(a) true(b) falseThis question is from Arrays Types topic in section Arrays Types of Data Structures & Algorithms II got this question in a job interview. |
|
Answer» The CORRECT answer is (a) true |
|
| 23. |
What will be the resulting array after rotating arr[]={1, 2, 3, 4, 5} by 2?(a) 2, 1, 3, 4, 5(b) 3, 4, 5, 1, 2(c) 4, 5, 1, 2, 3(d) 1, 2, 3, 5, 4I need to ask this question from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThe question was posed to me in a national level competition. |
|
Answer» Correct OPTION is (b) 3, 4, 5, 1, 2 |
|
| 24. |
What is the space complexity of the code that uses merge sort for determining the number of inversions in an array?(a) O(n)(b) O(log n)(c) O(1)(d) O(n log n)My query is from Arrays Types in portion Arrays Types of Data Structures & Algorithms II have been asked this question in an international level competition. |
|
Answer» Right ANSWER is (a) O(n) |
|
| 25. |
The time complexity of the code that determines the number of inversions in an array using self balancing BST is lesser than that of the code that uses loops for the same purpose.(a) true(b) falseMy enquiry is from Arrays Types in division Arrays Types of Data Structures & Algorithms IThis question was posed to me during an online interview. |
|
Answer» Right choice is (a) true |
|
| 26. |
What is the time complexity of the code that uses self balancing BST for determining the number of inversions in an array?(a) O(n^2)(b) O(n)(c) O(log n)(d) O(n log n)I'd like to ask this question from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThis question was addressed to me in examination. |
|
Answer» Right answer is (d) O(n log n) |
|
| 27. |
What is the time complexity of the code that uses merge sort for determining the number of inversions in an array?(a) O(n^2)(b) O(n)(c) O(log n)(d) O(n log n)My doubt stems from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThe question was posed to me in an online interview. |
|
Answer» Right ANSWER is (d) O(n log n) |
|
| 28. |
The time complexity of the code that determines the number of inversions in an array using merge sort is lesser than that of the code that uses loops for the same purpose.(a) true(b) falseI want to ask this question from Arrays Types topic in section Arrays Types of Data Structures & Algorithms II had been asked this question in homework. |
|
Answer» The CORRECT choice is (a) true |
|
| 29. |
What is the condition for two elements arr[i] and arr[j] to form an inversion?(a) arr[i] arr[j] and i < jThe question is from Arrays Types topic in section Arrays Types of Data Structures & Algorithms IThe question was asked in an international level competition. |
|
Answer» Correct choice is (d) arr[i] > arr[J] and i < j |
|
| 30. |
How many inversions does a sorted array have?(a) 0(b) 1(c) 2(d) cannot be determinedI need to ask this question from Arrays Types in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in an interview for job. |
|
Answer» The correct option is (a) 0 |
|
| 31. |
What does the number of inversions in an array indicate?(a) mean value of the elements of array(b) measure of how close or far the array is from being sorted(c) the distribution of values in the array(d) median value of the elements of arrayThe origin of the question is Arrays Types in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in semester exam. |
|
Answer» Correct choice is (b) measure of how CLOSE or far the array is from being SORTED |
|
| 32. |
In what way the Symmetry Sparse Matrix can be stored efficiently?(a) Heap(b) Binary tree(c) Hash table(d) Adjacency ListThe above asked question is from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms IThe question was posed to me in an interview for job. |
|
Answer» RIGHT OPTION is (b) BINARY tree Best explanation: SINCE SYMMETRY Sparse Matrix arises as the adjacency matrix of the undirected graph. Hence it can be stored efficiently as an adjacency list. |
|
| 33. |
Which one of the following is a Special Sparse Matrix?(a) Band Matrix(b) Skew Matrix(c) Null matrix(d) Unit matrixThe doubt is from Arrays Types in section Arrays Types of Data Structures & Algorithms IThis question was addressed to me in quiz. |
|
Answer» CORRECT choice is (a) Band Matrix For explanation: A band matrix is a sparse matrix whose NON zero ELEMENTS are bounded to a diagonal band, comprising the main diagonal and zero or more diagonals on EITHER side. |
|
| 34. |
Is Sparse Matrix also known as Dense Matrix?(a) True(b) FalseI'm obligated to ask this question of Arrays Types in portion Arrays Types of Data Structures & Algorithms II got this question in unit test. |
|
Answer» The correct CHOICE is (b) False |
|
| 35. |
Which of the following is not the method to represent Sparse Matrix?(a) Dictionary of Keys(b) Linked List(c) Array(d) HeapI want to ask this question from Arrays Types topic in division Arrays Types of Data Structures & Algorithms II have been asked this question in a job interview. |
|
Answer» The correct choice is (d) Heap |
|
| 36. |
The matrix contains m rows and n columns. The matrix is called Sparse Matrix if ________(a) Total number of Zero elements > (m*n)/2(b) Total number of Zero elements = m + n(c) Total number of Zero elements = m/n(d) Total number of Zero elements = m-nI'm obligated to ask this question of Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms II have been asked this question in an online interview. |
|
Answer» Correct answer is (a) Total NUMBER of Zero elements > (m*N)/2 |
|
| 37. |
Is O(n) the Worst case Time Complexity for addition of two Sparse Matrix?(a) True(b) FalseMy enquiry is from Arrays Types in division Arrays Types of Data Structures & Algorithms II got this question in homework. |
|
Answer» The correct choice is (a) True |
|
| 38. |
Who coined the term Sparse Matrix?(a) Harry Markowitz(b) James Sylvester(c) Chris Messina(d) Arthur CayleyMy question is from Arrays Types in section Arrays Types of Data Structures & Algorithms II had been asked this question in a national level competition. |
|
Answer» Correct answer is (a) HARRY Markowitz |
|
| 39. |
What is the relation between Sparsity and Density of a matrix?(a) Sparsity = 1 – Density(b) Sparsity = 1 + Density(c) Sparsity = Density*Total number of elements(d) Sparsity = Density/Total number of elementsThe query is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms IThis question was posed to me in an international level competition. |
|
Answer» Correct choice is (a) Sparsity = 1 – DENSITY |
|
| 40. |
Which matrix has most of the elements (not all) as Zero?(a) Identity Matrix(b) Unit Matrix(c) Sparse Matrix(d) Zero MatrixThis key question is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms II got this question in unit test. |
|
Answer» Right choice is (c) SPARSE Matrix |
|
| 41. |
Matrix A when multiplied with Matrix C gives the Identity matrix I, what is C?(a) Identity matrix(b) Inverse of A(c) Square of A(d) Transpose of AThe origin of the question is Matrix in section Arrays Types of Data Structures & Algorithms IThe question was posed to me by my school principal while I was bunking the class. |
|
Answer» Right option is (b) INVERSE of A |
|
| 42. |
Which of the following is an advantage of matrices?(a) Internal complexity(b) Searching through a matrix is complex(c) Not space efficient(d) Graph PlottingAsked question is from Matrix topic in section Arrays Types of Data Structures & Algorithms IThis question was addressed to me in final exam. |
|
Answer» Right option is (d) Graph Plotting |
|
| 43. |
Which of the following don’t use matrices?(a) In solving linear equations(b) Image processing(c) Graph theory(d) Sorting numbersThe origin of the question is Matrix in division Arrays Types of Data Structures & Algorithms II got this question in exam. |
|
Answer» The correct ANSWER is (d) Sorting numbers |
|
| 44. |
Suffix array can be created in O(nlogn) time.(a) True(b) FalseThe origin of the question is Arrays Types in section Arrays Types of Data Structures & Algorithms II had been asked this question in class test. |
|
Answer» RIGHT answer is (a) True Easiest EXPLANATION - Suffix ARRAY can be constructed in O(n^2logn) time USING sorting algorithms but it is possible to BUILD the suffix array in O(nlogn) time using prefix doubling. |
|
| 45. |
What is the time required to locate the occurrences of a pattern P of length m in a string of length n using suffix array?(a) O(nm)(b) O(n^2)(c) O(mnlogn)(d) O(mlogn)My question comes from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms IThe question was posed to me in an interview for internship. |
|
Answer» Right option is (d) O(mlogn) |
|
| 46. |
LCP array and ______ is used to construct suffix tree.(a) Hash tree(b) Hash trie(c) Suffix array(d) Balanced treeQuestion is from Arrays Types in section Arrays Types of Data Structures & Algorithms II have been asked this question during a job interview. |
|
Answer» Correct option is (c) SUFFIX ARRAY |
|
| 47. |
What will be the suffix array of the string “engineering”?(a) 2 3 8 4 9 1 7 5 0 6 10(b) 5 0 6 1 4 9 1 7 0 2 3 8(c) 5 0 6 10 2 4 9 1 7 3 8(d) 5 0 6 10 2 3 8 4 9 1 7This interesting question is from Arrays Types topic in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me during an internship interview. |
|
Answer» The correct CHOICE is (d) 5 0 6 10 2 3 8 4 9 1 7 |
|
| 48. |
If comparison based sorting algorithm is used construct the suffix array, then what will be time required to construct the suffix array?(a) O(nlogn)(b) O(n^2)(c) O(n^2logn)(d) O(n^2) + O(logn)The doubt is from Arrays Types topic in portion Arrays Types of Data Structures & Algorithms II have been asked this question during an internship interview. |
|
Answer» Correct choice is (c) O(n^2logn) |
|
| 49. |
Suffix array is space efficient and faster than the suffix tree.(a) True(b) FasleMy query is from Arrays Types topic in division Arrays Types of Data Structures & Algorithms II got this question by my college professor while I was bunking the class. |
|
Answer» Right CHOICE is (b) Fasle |
|
| 50. |
Suffix array can be created by performing __________ traversal of a suffix tree.(a) breadth-first(b) level order(c) depth-first(d) either breadth-first or level orderI want to ask this question from Arrays Types topic in section Arrays Types of Data Structures & Algorithms IThis question was addressed to me in exam. |
|
Answer» Right answer is (c) depth-first |
|