Data Structures Algorithms-II MCQs

Page No. 142

Which of the following is not true about subset sum problem?


athe recursive solution has a time complexity of O(2n)


bthere is no known solution that takes polynomial time


cthe recursive solution is slower than dynamic programming solution


dthe dynamic programming solution has a time complexity of O(n log n)



Recursive solution of subset sum problem is faster than dynamic problem solution in terms of time complexity.


atrue


bfalse


cA & B


d None of the above


View Answer false

Subset sum problem is an example of NP-complete problem.


atrue


bfalse


cA & B


dNone of the above


View Answer true

What is the worst case time complexity of dynamic programming solution of the subset sum problem(sum=given subset sum)?


aO(n)


bO(sum)


cO(n2)


d O(sum*n)


View Answer O(sum*n)

Which of the following is true about the time complexity of the recursive solution of the subset sum problem?


aIt has an exponential time complexity


b It has a linear time complexity


cIt has a logarithmic time complexity


d it has a time complexity of O(n2)



What is a subset sum problem?


afinding a subset of a set that has sum of elements equal to a given number


bchecking 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


cfinding the sum of elements present in a set


dfinding the sum of all the subsets of a set



Under what condition any set A will be a subset of B?


aif all elements of set B are also present in set A


bif all elements of set A are also present in set B


cif A contains more elements than B


dif B contains more elements than A



What will be the auxiliary space complexity of dynamic programming solution of set partition problem(sum=sum of set elements)?


aO(n log n)


bO(n2)


cO(2n)


dO(sum*n)


View Answer O(sum*n)

What will be the output for the given code?


atrue


bfalse


c4 6 2


d 12


View Answer true

Which of the following should be the base case for the recursive solution of a set partition problem?


aIf(sum%2!=0) return false; if(sum==0) return true;


bIf(sum%2!=0) return false; if(sum==0) return true; if (n ==0 && sum!= 0) return false;


cif (n ==0 && sum!= 0) return false;


dif(sum<0) return true; if (n ==0 && sum!= 0) return false;



Goto Page No.

Page 142 of 149

Alphabetical MCQs Categories

Here below You find all kind of categories of MCQs in alphabetical order.


"Comprehensive Collection of MCQs: Alphabetically Organized by Subject"

"Discover an extensive collection of multiple-choice questions (MCQs) neatly categorized by subject from A to Z. This resource is designed for anyone eager to explore various topics in a straightforward and organized manner. Whether you're a student preparing for exams, an educator seeking supplementary materials, or simply curious about different subjects, this compilation offers a convenient way to learn and assess your knowledge. With questions arranged alphabetically, navigation is effortless, allowing you to delve into subjects of interest at your own pace. Engage, learn, and expand your understanding with this accessible and comprehensive repository of MCQs!"


BolPakistan

bolpakistan.com.pk includes Job Mcqs and Pak Mcqs is the Top Largest Mcqs Forum in World, in which you can read Mcqs of All Subjects, PPSC test preparation, FPSC, NTS and PPSC PAST PAPERS, PPSC PAST MCQS. A Collection of Repeated MCQs for JOBs seekers.

Copyright © 2024, Designed & Developed by BolPakistan