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 worst case time complexity of dynamic programming solution of set partition problem(sum=sum of set elements)?(a) O(n)(b) O(sum)(c) O(n^2)(d) O(sum*n)The question was posed to me in an interview.This intriguing question originated from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right choice is (d) O(sum*n) |
|
| 2. |
Which of the following is true about the time complexity of the recursive solution of set partition problem?(a) It has an exponential time complexity(b) It has a linear time complexity(c) It has a logarithmic time complexity(d) it has a time complexity of O(n2)This question was posed to me by my school teacher while I was bunking the class.The above asked question is from Checksum, Complexity Classes & NP Complete Problems topic in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The CORRECT choice is (a) It has an EXPONENTIAL time complexity |
|
| 3. |
What is the set partition problem?(a) finding a subset of a set that has sum of elements equal to a given number(b) checking for the presence of a subset that has sum of elements equal to a given number(c) checking whether the set can be divided into two subsets of with equal sum of elements and printing true or false based on the result(d) finding subsets with equal sum of elementsThis question was posed to me in homework.The query is from Checksum, Complexity Classes & NP Complete Problems topic in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct option is (c) checking whether the set can be DIVIDED into two SUBSETS of with equal sum of elements and printing true or false based on the result |
|
| 4. |
What is meant by the power set of a set?(a) subset of all sets(b) set of all subsets(c) set of particular subsets(d) an empty setThis question was addressed to me during an online interview.The doubt is from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct ANSWER is (B) set of all subsets |
|
| 5. |
Which of the following is true about the time complexity of the recursive solution of the subset sum problem?(a) It has an exponential time complexity(b) It has a linear time complexity(c) It has a logarithmic time complexity(d) it has a time complexity of O(n2)The question was posed to me in examination.The query is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» CORRECT option is (a) It has an exponential TIME complexity Easiest explanation - Subset sum problem has both recursive as well as DYNAMIC PROGRAMMING solution. The recursive solution has an exponential time complexity as it will require to check for all subsets in WORST case. |
|
| 6. |
What is a subset sum problem?(a) finding a subset of a set that has sum of elements equal to a given number(b) checking for the presence of a subset that has sum of elements equal to a given number and printing true or false based on the result(c) finding the sum of elements present in a set(d) finding the sum of all the subsets of a setThis question was posed to me by my college professor while I was bunking the class.The origin of the question is Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct option is (b) checking for the presence of a subset that has sum of elements equal to a given number and printing TRUE or false based on the result |
|
| 7. |
Under what condition any set A will be a subset of B?(a) if all elements of set B are also present in set A(b) if all elements of set A are also present in set B(c) if A contains more elements than B(d) if B contains more elements than AThis question was posed to me in an international level competition.The doubt is from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right OPTION is (b) if all elements of SET A are also present in set B |
|
| 8. |
How many Hamiltonian paths does the following graph have?(a) 1(b) 2(c) 0(d) 3I had been asked this question in class test.Enquiry is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (c) 0 |
|
| 9. |
How many Hamiltonian paths does the following graph have?(a) 1(b) 2(c) 3(d) 4The question was posed to me in my homework.My doubt is from Checksum, Complexity Classes & NP Complete Problems in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct CHOICE is (a) 1 |
|
| 10. |
What is the time complexity for finding a Hamiltonian path for a graph having N vertices (using permutation)?(a) O(N!)(b) O(N! * N)(c) O(log N)(d) O(N)This question was addressed to me during an interview.My question is taken from Checksum, Complexity Classes & NP Complete Problems in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» RIGHT choice is (b) O(N! * N) To explain: For a graph having N vertices TRAVERSE the PERMUTATIONS in N! iterations and it traverses the permutations to SEE if adjacent vertices are connected or not takes N iterations (i.e.) O(N! * N). |
|
| 11. |
For a graph of degree three, in what time can a Hamiltonian path be found?(a) O(0.251^n)(b) O(0.401^n)(c) O(0.167^n)(d) O(0.151^n)This question was posed to me in quiz.This interesting question is from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct answer is (a) O(0.251^n) |
|
| 12. |
Who invented the inclusion-exclusion principle to solve the Hamiltonian path problem?(a) Karp(b) Leonard Adleman(c) Andreas Bjorklund(d) MartelloI had been asked this question during an interview.This question is from Checksum, Complexity Classes & NP Complete Problems in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (c) Andreas Bjorklund |
|
| 13. |
In graphs, in which all vertices have an odd degree, the number of Hamiltonian cycles through any fixed edge is always even.(a) true(b) falseThis question was posed to me in an online quiz.The origin of the question is Checksum, Complexity Classes & NP Complete Problems in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right option is (a) true |
|
| 14. |
In what time can the Hamiltonian path problem can be solved using dynamic programming?(a) O(N)(b) O(N log N)(c) O(N^2)(d) O(N^2 2^N)The question was posed to me in an international level competition.My enquiry is from Checksum, Complexity Classes & NP Complete Problems in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (d) O(N^2 2^N) |
|
| 15. |
Who formulated the first ever algorithm for solving the Hamiltonian path problem?(a) Martello(b) Monte Carlo(c) Leonard(d) BellmanI had been asked this question in an interview for internship.The query is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct choice is (a) Martello |
|
| 16. |
Which of the following problems is similar to that of a Hamiltonian path problem?(a) knapsack problem(b) closest pair problem(c) travelling salesman problem(d) assignment problemI had been asked this question by my college professor while I was bunking the class.My question is based upon Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» CORRECT option is (c) travelling salesman problem Easy explanation - HAMILTONIAN PATH problem is SIMILAR to that of a travelling salesman problem since both the problem traverses all the NODES in a graph exactly once. |
|
| 17. |
There is no existing relationship between a Hamiltonian path problem and Hamiltonian circuit problem.(a) true(b) falseThe question was asked during an interview.Origin of the question is Checksum, Complexity Classes & NP Complete Problems in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right CHOICE is (b) false |
|
| 18. |
Hamiltonian path problem is _________(a) NP problem(b) N class problem(c) P class problem(d) NP complete problemI got this question in a national level competition.My question is taken from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» CORRECT CHOICE is (d) NP complete problem The EXPLANATION is: HAMILTONIAN path problem is found to be NP complete. Hamiltonian cycle problem is ALSO an NP- complete problem. |
|
| 19. |
The problem of finding a path in a graph that visits every vertex exactly once is called?(a) Hamiltonian path problem(b) Hamiltonian cycle problem(c) Subset sum problem(d) Turnpike reconstruction problemThe question was asked in a national level competition.This interesting question is from Checksum, Complexity Classes & NP Complete Problems topic in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» RIGHT answer is (a) HAMILTONIAN path problem To explain: Hamiltonian path problem is a problem of finding a path in a GRAPH that visits every node exactly once whereas Hamiltonian CYCLE problem is finding a cycle in a graph. |
|
| 20. |
Which of the following algorithm can be used to solve the Hamiltonian path problem efficiently?(a) branch and bound(b) iterative improvement(c) divide and conquer(d) greedy algorithmThe question was posed to me in exam.The doubt is from Checksum, Complexity Classes & NP Complete Problems topic in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct answer is (a) branch and BOUND |
|
| 21. |
The choice of polynomial class has led to the development of an extensive theory called ________(a) computational complexity(b) time complexity(c) problem complexity(d) decision complexityI have been asked this question during an interview.My question is taken from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right CHOICE is (a) computational complexity |
|
| 22. |
Which of the following problems is not NP complete?(a) Hamiltonian circuit(b) Bin packing(c) Partition problem(d) Halting problemThe question was posed to me during an interview for a job.I'd like to ask this question from Checksum, Complexity Classes & NP Complete Problems in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct CHOICE is (d) HALTING problem |
|
| 23. |
How many steps are required to prove that a decision problem is NP complete?(a) 1(b) 2(c) 3(d) 4The question was asked by my college director while I was bunking the class.My question is taken from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right OPTION is (b) 2 |
|
| 24. |
To which of the following class does a CNF-satisfiability problem belong?(a) NP class(b) P class(c) NP complete(d) NP hardI have been asked this question in an internship interview.Question is taken from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct choice is (c) NP complete |
|
| 25. |
How many conditions have to be met if an NP- complete problem is polynomially reducible?(a) 1(b) 2(c) 3(d) 4I had been asked this question by my college professor while I was bunking the class.My query is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct choice is (b) 2 |
|
| 26. |
A non-deterministic algorithm is said to be non-deterministic polynomial if the time-efficiency of its verification stage is polynomial.(a) true(b) falseI had been asked this question in an interview for internship.My question is taken from Checksum, Complexity Classes & NP Complete Problems topic in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct choice is (a) true |
|
| 27. |
How many stages of procedure does a non-deterministic algorithm consist of?(a) 1(b) 2(c) 3(d) 4This question was addressed to me in my homework.My enquiry is from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (B) 2 |
|
| 28. |
Halting problem is an example for?(a) decidable problem(b) undecidable problem(c) complete problem(d) trackable problemI had been asked this question in exam.My enquiry is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct OPTION is (b) UNDECIDABLE problem |
|
| 29. |
To which class does the Euler’s circuit problem belong?(a) P class(b) NP class(c) Partition class(d) Complete classI had been asked this question in an interview for job.I'm obligated to ask this question of Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» RIGHT choice is (a) P class For explanation: EULER’s circuit problem can be SOLVED in polynomial time. It can be solved in O(N^2). |
|
| 30. |
The Euler’s circuit problem can be solved in?(a) O(N)(b) O( N log N)(c) O(log N)(d) O(N^2)I have been asked this question in an interview for job.I'd like to ask this question from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct CHOICE is (d) O(N^2) |
|
| 31. |
Problems that cannot be solved by any algorithm are called?(a) tractable problems(b) intractable problems(c) undecidable problems(d) decidable problemsThe question was asked during an online interview.I want to ask this question from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right ANSWER is (C) UNDECIDABLE problems |
|
| 32. |
_________ is the class of decision problems that can be solved by non-deterministic polynomial algorithms.(a) NP(b) P(c) Hard(d) CompleteI had been asked this question during an online interview.I'd like to ask this question from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right answer is (a) NP |
|
| 33. |
The sum and composition of two polynomials are always polynomials.(a) true(b) falseI had been asked this question in an interview.The origin of the question is Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (a) true |
|
| 34. |
Problems that can be solved in polynomial time are known as?(a) intractable(b) tractable(c) decision(d) completeThe question was asked during an internship interview.The doubt is from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct answer is (b) tractable |
|
| 35. |
The worst-case efficiency of solving a problem in polynomial time is?(a) O(p(n))(b) O(p( n log n))(c) O(p(n^2))(d) O(p(m log n))I had been asked this question by my college director while I was bunking the class.Asked question is from Checksum, Complexity Classes & NP Complete Problems in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» CORRECT answer is (a) O(p(n)) The EXPLANATION is: The worst-case EFFICIENCY of solving an PROBLEM in polynomial TIME is O(p(n)) where p(n) is the polynomial time of input size. |
|
| 36. |
What is the rate of the hamming code of parity bit m=8?(a) 0.94(b) 0.92(c) 0.90(d) 0.97The question was posed to me by my school principal while I was bunking the class.My question comes from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The CORRECT choice is (d) 0.97 |
|
| 37. |
For a hamming code of parity bit m=8, what is the total bits and data bits?(a) (255, 247)(b) (127, 119)(c) (31, 26)(d) (0, 8)This question was addressed to me in quiz.Query is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct OPTION is (a) (255, 247) |
|
| 38. |
What is the code rate of a repetition Hamming code (3, 1)?(a) 1(b) 3(c) 1/3(d) 1.3I got this question in an interview.This interesting question is from Checksum, Complexity Classes & NP Complete Problems topic in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right choice is (C) 1/3 |
|
| 39. |
An Extended hamming code is also called as __________(a) SEDDEC(b) SEDDED(c) SECDED(d) SECDECI got this question by my college director while I was bunking the class.Query is from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» RIGHT option is (c) SECDED The best I can explain: An Extended Hamming code is also called as SECDED (Single ERROR Correction DOUBLE Error Detection). The most popular codes are (72, 64) code and (127,120) code. |
|
| 40. |
________ is the mechanism of sending data bits multiple times to ensure consistency.(a) Repetition(b) Duplication(c) Mirroring(d) RedundancyThe question was posed to me in a national level competition.My doubt is from Checksum, Complexity Classes & NP Complete Problems in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (a) REPETITION |
|
| 41. |
Including a parity bit along with the data surely detects the errors.(a) true(b) falseThis question was posed to me in a job interview.My enquiry is from Checksum, Complexity Classes & NP Complete Problems in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct ANSWER is (B) false |
|
| 42. |
A two-out-of-five code consists of _________(a) Two 0s and three 1s(b) Three 0s and two 1s(c) Four 0s and one 1s(d) One 0s and four 1sI have been asked this question by my school teacher while I was bunking the class.The question is from Checksum, Complexity Classes & NP Complete Problems topic in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct option is (B) Three 0S and two 1s |
|
| 43. |
What is the rate of hamming codes?(a) 1-[r/(2^r-1)](b) 1-(r/2^r)(c) 1+(r/2^r)(d) r/2^r+1This question was posed to me in a job interview.I want to ask this question from Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (a) 1-[r/(2^r-1)] |
|
| 44. |
What is the message length ‘k’ of a Hamming(7,4) code?(a) 2^r-1(b) 2^r-r+1(c) 2^r-r-1(d) 2^r+1-rThis question was posed to me during an internship interview.My question is based upon Checksum, Complexity Classes & NP Complete Problems topic in portion Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» RIGHT answer is (c) 2^r-r-1 Easiest EXPLANATION - Hamming CODES are a class of binary linear codes, hence r>=2. For a hamming(7,4) code, the message length ‘k’ is 2^r-r-1 where r is the parity BIT. Here, r=3. |
|
| 45. |
What is the total block length ‘n’ of a Hamming code?(a) 2^r(b) 2^r-1(c) 2^r-1-1(d) 2^r+1The question was asked in unit test.I want to ask this question from Checksum, Complexity Classes & NP Complete Problems topic in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Correct option is (B) 2^R-1 |
|
| 46. |
Who invented Hamming codes?(a) Richard Hamming(b) Ross Hamming(c) Shannon(d) HuffmanThis question was addressed to me in an online quiz.My doubt stems from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right choice is (a) RICHARD Hamming |
|
| 47. |
Hamming codes can be used for both single-bit error and burst error detection and correction.(a) True(b) FalseThe question was posed to me in semester exam.The question is from Checksum, Complexity Classes & NP Complete Problems topic in chapter Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» Right answer is (b) False |
|
| 48. |
Why do we require hamming codes?(a) Error correction(b) Encryption only(c) Decryption(d) Bit stuffingThe question was posed to me in a job interview.Origin of the question is Checksum, Complexity Classes & NP Complete Problems topic in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The correct option is (a) ERROR correction |
|
| 49. |
What is the minimal Hamming distance between any two correct codewords?(a) 1(b) 2(c) 3(d) 4I have been asked this question at a job interview.This question is from Checksum, Complexity Classes & NP Complete Problems in division Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The CORRECT option is (C) 3 |
|
| 50. |
The most common hamming codes are a generalized version of?(a) Hamming(7, 4) code(b) Hamming(8, 4) code(c) Hamming(6, 3) code(d) Hamming(5, 7) codeI have been asked this question by my school teacher while I was bunking the class.I want to ask this question from Checksum, Complexity Classes & NP Complete Problems in section Checksum, Complexity Classes & NP Complete Problems of Data Structures & Algorithms II |
|
Answer» The CORRECT choice is (a) HAMMING(7, 4) code |
|