A.Place queens in one row so that all can attack each other
B.Place queens on different boards with equal dimensions
C.Place queens on an board using only the main diagonal
D.Place queens on an board so that none attack each other
Correct Answer: Place queens on an board so that none attack each other
Explanation:
The problem requires placing queens so that no two share a row, column, or diagonal.
Incorrect! Try again.
2Which technique is commonly used to solve the n-Queens Problem?
n-Queens Problem
Easy
A.Merge sort
B.Hashing
C.Binary search
D.Backtracking
Correct Answer: Backtracking
Explanation:
Backtracking places queens one at a time and abandons any placement that causes a conflict.
Incorrect! Try again.
3What is a Hamiltonian circuit in a graph?
Hamiltonian Circuit
Easy
A.A tree that contains every graph vertex
B.A cycle that uses every edge exactly once
C.A path that starts and ends at different vertices
D.A cycle that visits every vertex exactly once
Correct Answer: A cycle that visits every vertex exactly once
Explanation:
A Hamiltonian circuit visits each vertex exactly once and returns to the starting vertex.
Incorrect! Try again.
4What does the Subset-Sum Problem ask?
Subset-Sum Problem
Easy
A.Whether the array is already sorted
B.Whether all elements have equal values
C.Whether a subset has a specified sum
D.Whether two subsets have equal sizes
Correct Answer: Whether a subset has a specified sum
Explanation:
The problem asks whether some subset of the given numbers adds up to a target value.
Incorrect! Try again.
5What is the main purpose of a bound in Branch and Bound?
Branch and Bound
Easy
A.To guarantee that every node is expanded
B.To sort all candidate solutions
C.To convert the problem into a graph
D.To estimate a node's best possible result
Correct Answer: To estimate a node's best possible result
Explanation:
A bound estimates the best result reachable from a node and helps decide whether to prune it.
Incorrect! Try again.
6When is a node commonly pruned in Branch and Bound?
Branch and Bound
Easy
A.When its solution is written as an array
B.When it cannot improve the current best solution
C.When it is the root node
D.When it has exactly two children
Correct Answer: When it cannot improve the current best solution
Explanation:
A node is pruned when its bound shows that exploring it cannot produce a better solution.
Incorrect! Try again.
7What is the usual objective of the Assignment Problem?
Assignment Problem
Easy
A.Assign every job to every worker
B.Arrange workers by their identification numbers
C.Place all jobs with a single worker
D.Assign jobs to workers at minimum total cost
Correct Answer: Assign jobs to workers at minimum total cost
Explanation:
The standard Assignment Problem seeks a one-to-one assignment with minimum total cost.
Incorrect! Try again.
8What is maximized in the standard Knapsack Problem?
Knapsack Problem
Easy
A.The number of rejected items
B.The capacity of the knapsack
C.The total item weight
D.The total value of selected items
Correct Answer: The total value of selected items
Explanation:
Items are selected to maximize total value without exceeding the knapsack's capacity.
Incorrect! Try again.
9In the Knapsack Problem, how many times may each item be selected?
Knapsack Problem
Easy
A.Zero or one time
B.Any positive number of times
C.Exactly two times
D.Any fractional amount
Correct Answer: Zero or one time
Explanation:
Each item is either included completely or excluded, which gives the name Knapsack.
Incorrect! Try again.
10What does the Traveling Salesman Problem seek?
Traveling Salesman Problem
Easy
A.A shortest path between two fixed cities
B.A minimum-cost tour visiting every city once
C.A route that avoids returning to its start
D.A maximum-cost route using every road
Correct Answer: A minimum-cost tour visiting every city once
Explanation:
The goal is a minimum-cost tour that visits each city once and returns to the starting city.
Incorrect! Try again.
11Why are approximation algorithms used?
Approximation Algorithms
Easy
A.To remove all constraints from a problem
B.To prove every problem belongs to P
C.To obtain near-optimal solutions efficiently
D.To make every input value identical
Correct Answer: To obtain near-optimal solutions efficiently
Explanation:
Approximation algorithms efficiently find solutions close to optimal for difficult optimization problems.
Incorrect! Try again.
12What does an approximation ratio describe?
Approximation Algorithms
Easy
A.The running time of a sorting algorithm
B.The number of variables in the input
C.The quality of an approximate solution
D.The number of optimal solutions available
Correct Answer: The quality of an approximate solution
Explanation:
The approximation ratio compares the value of an approximate solution with the optimal value.
Incorrect! Try again.
13What property must a vertex cover satisfy?
Vertex-Cover
Easy
A.It must include an endpoint of every edge
B.It must form a cycle through every vertex
C.It must contain only isolated vertices
D.It must contain every edge of the graph
Correct Answer: It must include an endpoint of every edge
Explanation:
A vertex cover is a set of vertices such that every edge has at least one endpoint in the set.
Incorrect! Try again.
14What is the objective of the Set-Covering Problem?
Set-Covering
Easy
A.Choose subsets that contain no common elements
B.Choose all subsets having the same size
C.Choose the fewest subsets that cover the universe
D.Choose the largest subset from the universe
Correct Answer: Choose the fewest subsets that cover the universe
Explanation:
Set covering seeks a minimum collection of subsets whose union contains every element in the universe.
Incorrect! Try again.
15What is minimized in the standard Bin Packing Problem?
Bin Packing Problems
Easy
A.The number of items packed
B.The capacity of every bin
C.The number of bins used
D.The weight of each item
Correct Answer: The number of bins used
Explanation:
The objective is to pack all items without exceeding bin capacity while using as few bins as possible.
Incorrect! Try again.
16What do complexity classes generally group together?
Complexity Classes
Easy
A.Programs written in the same language
B.Graphs containing the same number of edges
C.Problems with related computational requirements
D.Algorithms producing the same output values
Correct Answer: Problems with related computational requirements
Explanation:
Complexity classes group problems according to resources or properties such as time and verifiability.
Incorrect! Try again.
17What does the complexity class P contain?
P
Easy
A.Problems verifiable only with exponential time
B.Problems solvable in polynomial time
C.Problems solvable only with exponential memory
D.Problems having no known algorithms
Correct Answer: Problems solvable in polynomial time
Explanation:
P contains decision problems that a deterministic algorithm can solve in polynomial time.
Incorrect! Try again.
18What is a defining feature of problems in NP?
NP
Easy
A.Their proposed solutions can be verified in polynomial time
B.Their proposed solutions must be found in constant time
C.They cannot be solved by any computational method
D.They always require exponential space for verification
Correct Answer: Their proposed solutions can be verified in polynomial time
Explanation:
For a problem in NP, a proposed solution can be checked in polynomial time.
Incorrect! Try again.
19Which statement correctly describes an NP-Hard problem?
NP-Hard
Easy
A.It can only be a graph problem
B.It must have a polynomial-time algorithm
C.It is at least as hard as every problem in NP
D.It must always belong to P
Correct Answer: It is at least as hard as every problem in NP
Explanation:
Every problem in NP can be polynomially reduced to an NP-Hard problem; an NP-Hard problem need not be in NP.
Incorrect! Try again.
20When is a decision problem called NP-Complete?
NP-Complete Problems
Easy
A.When it is NP-Hard but not in NP
B.When it is both in NP and NP-Hard
C.When it is in P but not in NP
D.When it can be solved only by backtracking
Correct Answer: When it is both in NP and NP-Hard
Explanation:
An NP-Complete problem belongs to NP and is also at least as hard as every problem in NP.
Incorrect! Try again.
21Queens have already been placed at positions and on a board. In which column can a queen be safely placed in row without immediately attacking either queen?
n-Queens Problem
Medium
A.Column
B.Column
C.Column
D.Column
Correct Answer: Column
Explanation:
Position shares neither a column nor a diagonal with or . Each of the other columns causes an immediate conflict.
Incorrect! Try again.
22Each list gives the column positions of queens in rows through . Which list represents a valid solution to the -Queens problem?
n-Queens Problem
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
In , all columns are distinct and no two queens have equal row and column differences, so no queens attack diagonally.
Incorrect! Try again.
23An undirected graph has vertices and edges . Which sequence forms a Hamiltonian circuit?
Hamiltonian Circuit
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The sequence uses the edges , , , , and , visits every vertex once, and returns to the starting vertex.
Incorrect! Try again.
24For the set , which target cannot be obtained as the sum of a subset of ?
Subset-Sum Problem
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The other targets are , , and . No subset of sums to .
Incorrect! Try again.
25For a minimization assignment problem, a lower bound is computed by adding the minimum entry of each row while ignoring column conflicts. For the cost matrix , what is this lower bound?
Branch and Bound
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The row minima are , , and . Their sum is , which is a valid lower bound.
Incorrect! Try again.
26In a minimization problem, the current best complete solution has cost . Which live node can be safely pruned based only on its lower bound?
Branch and Bound
Medium
A.A node with bound
B.A node with bound
C.A node with bound
D.A node with bound
Correct Answer: A node with bound
Explanation:
A node with lower bound cannot produce a solution cheaper than the current cost , so it can be pruned.
Incorrect! Try again.
27Three workers must be assigned distinct jobs . Their cost matrix is . What is the minimum total assignment cost?
Assignment Problem
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Assign to job , to job , and to job . The total cost is .
Incorrect! Try again.
28A knapsack has capacity . Items have pairs , , , and . What is the maximum obtainable value?
Knapsack Problem
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Selecting the items of weights and exactly fills the capacity and gives value , which is optimal.
Incorrect! Try again.
29For cities , the symmetric distances are , , , , , and . Starting at , what tour is produced by the nearest-neighbor heuristic, and what is its cost?
Traveling Salesman Problem
Medium
A., cost
B., cost
C., cost
D., cost
Correct Answer: , cost
Explanation:
From , the nearest city is ; from , it is ; and then remains. The cost is .
Incorrect! Try again.
30A minimization algorithm has an approximation ratio of . If the optimal solution has cost , what is the largest cost guaranteed for the algorithm's solution?
Approximation Algorithms
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
The guarantee is , so the returned solution has cost at most .
Incorrect! Try again.
31The standard -approximation algorithm for Vertex Cover finds a maximal matching and selects both endpoints of every matched edge. If the matching contains edges, how many vertices does the algorithm select?
Vertex-Cover
Medium
A. vertices
B. vertices
C. vertices
D. vertices
Correct Answer: vertices
Explanation:
The matching edges have distinct endpoints. Selecting both endpoints of each of the edges gives vertices.
Incorrect! Try again.
32Let and let , , , and . Which sets are selected by the greedy Set-Cover algorithm?
Set-Covering
Medium
A. and
B. and
C. and
D. and
Correct Answer: and
Explanation:
Greedy first selects , which covers four elements. The uncovered elements are and , and covers both.
Incorrect! Try again.
33Bins have capacity . How many bins does First Fit Decreasing use for items with sizes ?
Bin Packing Problems
Medium
A. bins
B. bins
C. bins
D. bins
Correct Answer: bins
Explanation:
After decreasing-order placement, the bins can contain , , and . Thus, First Fit Decreasing uses bins.
Incorrect! Try again.
34Which relationship between standard complexity classes is known to be true?
Complexity Classes
Medium
A.
B.
C.
D.
Correct Answer:
Explanation:
Every problem solvable in deterministic polynomial time can also be solved in nondeterministic polynomial time. Whether remains unknown.
Incorrect! Try again.
35A decision problem has a deterministic algorithm whose running time is . What can be concluded from this information?
P
Medium
A.The problem is NP-hard
B.The problem is outside
C.The problem is NP-complete
D.The problem is in
Correct Answer: The problem is in
Explanation:
The running time is polynomial in the input size, so the decision problem belongs to .
Incorrect! Try again.
36For the Hamiltonian Circuit decision problem, which object serves as an appropriate polynomial-size certificate for a yes-instance?
NP
Medium
A.A table of shortest paths
B.A list of all graph subsets
C.A proof of graph connectivity
D.An ordering of all vertices
Correct Answer: An ordering of all vertices
Explanation:
An ordering specifies the proposed circuit. In polynomial time, a verifier can check that each vertex occurs once and each consecutive pair is connected.
Incorrect! Try again.
37If a problem is NP-hard, which statement follows from the definition of NP-hardness?
NP-Hard
Medium
A. has a polynomial-time verifier
B. has a polynomial-time algorithm
C.Every problem in reduces to
D. reduces to every problem in
Correct Answer: Every problem in reduces to
Explanation:
NP-hardness means that every problem in can be polynomial-time reduced to . The problem need not itself belong to .
Incorrect! Try again.
38Which pair of conditions is sufficient to classify a decision problem as NP-complete?
NP-Complete Problems
Medium
A. is in and is NP-hard
B. is in and is undecidable
C. is in and is NP-hard
D. is in and is exponential
Correct Answer: is in and is NP-hard
Explanation:
A decision problem is NP-complete exactly when it belongs to and every problem in polynomially reduces to it.
Incorrect! Try again.
39Suppose is NP-complete, , and belongs to . What can be concluded about ?
NP-Complete Problems
Medium
A. is not NP-hard
B. is undecidable
C. is NP-complete
D. is necessarily in
Correct Answer: is NP-complete
Explanation:
Because the NP-complete problem reduces to , problem is NP-hard. Since is also in , it is NP-complete.
Incorrect! Try again.
40What would follow if a deterministic polynomial-time algorithm were discovered for any one NP-complete problem?
NP-Complete Problems
Medium
A.
B.
C.
D. becomes undecidable
Correct Answer:
Explanation:
Every problem in reduces in polynomial time to an NP-complete problem. A polynomial-time solution for one would therefore give polynomial-time solutions for all problems in .
Incorrect! Try again.
41In an -Queens backtracking search, queens have been placed at , , , and , where each pair denotes . Which columns are currently legal for the queen in row ?
n-Queens Problem
Hard
A.Columns and
B.Columns and
C.Columns and
D.Columns and
Correct Answer: Columns and
Explanation:
Used columns and diagonally attacked columns eliminate . Therefore, only columns and are legal in row .
Incorrect! Try again.
42Let be a simple graph with vertices. For every pair of nonadjacent vertices and , suppose . What follows from this condition?
Hamiltonian Circuit
Hard
A. necessarily contains a unique Hamiltonian circuit
B. necessarily contains an Eulerian circuit
C. necessarily contains a Hamiltonian circuit
D. necessarily has minimum degree at least
Correct Answer: necessarily contains a Hamiltonian circuit
Explanation:
Ore's theorem states that the given degree-sum condition is sufficient for a simple graph with to be Hamiltonian. It does not imply uniqueness or Eulerian structure.
Incorrect! Try again.
43An exact meet-in-the-middle algorithm solves Subset-Sum by dividing numbers into two equal-sized groups and generating all subset sums of each group. Ignoring polynomial factors, what are its typical time and space complexities?
Subset-Sum Problem
Hard
A. time and space
B. time and space
C. time and space
D. time and space
Correct Answer: time and space
Explanation:
Each half has about subset sums. Sorting or searching these lists introduces only polynomial factors, giving time and space up to such factors.
Incorrect! Try again.
44A branch-and-bound algorithm minimizes an objective and currently has an incumbent solution of cost . Three live nodes have valid lower bounds , , and . If only solutions strictly better than the incumbent matter, which nodes may be pruned immediately?
Branch and Bound
Hard
A.The nodes with bounds and
B.All three live nodes
C.Only the node with bound
D.The nodes with bounds and
Correct Answer: The nodes with bounds and
Explanation:
A minimization node cannot improve the incumbent when its lower bound is at least . The node with bound must remain because it could contain a cheaper solution.
Incorrect! Try again.
45For the assignment cost matrix what lower bound is obtained by first subtracting each row minimum and then subtracting each resulting column minimum?
Assignment Problem
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The row minima sum to . After row reduction, the first column has minimum and the other column minima are , so the bound is .
Incorrect! Try again.
46In a knapsack branch-and-bound node, the current solution has weight and profit , while capacity is . Remaining items, ordered by profit-to-weight ratio, are . What fractional-knapsack upper bound applies to this node?
Knapsack Problem
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
The remaining capacity is . Take the first item fully for profit , then take of the second for profit . The upper bound is .
Incorrect! Try again.
47For metric TSP, an algorithm doubles a minimum spanning tree, takes an Euler tour, and shortcuts repeated vertices. Which inequality justifies its approximation guarantee?
Traveling Salesman Problem
Hard
A.
B.
C.
D.
Correct Answer:
Explanation:
Doubling the MST costs , and metric shortcutting cannot increase cost. Removing an edge from an optimal tour yields a spanning tree, so .
Incorrect! Try again.
48Which statement correctly characterizes a fully polynomial-time approximation scheme for an optimization problem?
Approximation Algorithms
Hard
A.It runs polynomially in input length and with a guarantee
B.It runs polynomially in the numeric objective value and guarantees an additive error of
C.It runs pseudopolynomially in input length and returns an exact optimum when
D.It runs polynomially in input length for each fixed but may be exponential in
Correct Answer: It runs polynomially in input length and with a guarantee
Explanation:
An FPTAS is polynomial in both the encoded input length and . It gives a guarantee for maximization or a guarantee for minimization.
Incorrect! Try again.
49Let be any maximal matching in an unweighted graph, and let contain both endpoints of every edge in . Which statement is always true?
Vertex-Cover
Hard
A. is independent and
B. is a vertex cover only when is maximum
C. is a minimum vertex cover and
D. is a vertex cover and
Correct Answer: is a vertex cover and
Explanation:
If an edge had neither endpoint in , it could be added to , contradicting maximality. Every cover needs at least one distinct endpoint from each matching edge, so and .
Incorrect! Try again.
50For weighted Vertex-Cover, consider the LP relaxation with for every edge and . If all vertices satisfying are selected, what guarantee follows?
Vertex-Cover
Hard
A.The selected cover is optimal whenever the graph is connected
B.The selected cover has weight at most the LP optimum
C.The selected cover has weight at most twice the optimum
D.The selected cover has weight at most of optimum
Correct Answer: The selected cover has weight at most twice the optimum
Explanation:
Every edge has an endpoint with LP value at least , so the rounded set covers all edges. Its weight is at most twice the LP value, which is no greater than the integral optimum.
Incorrect! Try again.
51For weighted Set-Cover on universe , which greedy rule and worst-case guarantee form the standard approximation algorithm?
Set-Covering
Hard
A.Minimize cost per newly covered element; obtain an approximation
B.Maximize newly covered elements; obtain an exact solution
C.Maximize set cardinality per cost; obtain a constant-factor approximation
D.Minimize total set cost; obtain a approximation
Correct Answer: Minimize cost per newly covered element; obtain an approximation
Explanation:
Weighted greedy selects the set minimizing , where is already covered. Its general guarantee is the harmonic factor .
Incorrect! Try again.
52Bins have capacity , and item sizes are . What are, respectively, the numbers of bins used by First-Fit Decreasing and by an optimal packing?
Bin Packing Problems
Hard
A. and
B. and
C. and
D. and
Correct Answer: and
Explanation:
FFD produces loads , , , and . An optimal packing uses , , and ; total size is , proving that three bins are optimal.
Incorrect! Try again.
53Assume . If is NP-complete under polynomial-time many-one reductions, which conclusion is necessarily valid?
Complexity Classes
Hard
A. becomes complete only for coNP
B. is also NP-complete
C. is necessarily outside NP
D. is necessarily in
Correct Answer: is also NP-complete
Explanation:
The equality gives . For any , complementing a reduction from to yields a reduction from to , establishing NP-hardness.
Incorrect! Try again.
54A language has a deterministic polynomial-time verifier, and every certificate has length at most for a constant , where is the input length. Which classification follows unconditionally?
P
Hard
A.
B. is NP-complete
C.
D. is NP-hard but undecidable
Correct Answer:
Explanation:
There are at most binary certificates. A deterministic algorithm can enumerate all of them and run the polynomial-time verifier, giving an overall polynomial-time decision procedure.
Incorrect! Try again.
55Suppose a decision language has polynomial-length certificates verifiable in deterministic polynomial time for every yes-instance. What can be concluded from this fact alone?
NP
Hard
A., but neither membership in P nor NP-hardness follows
B., because every certificate can be checked efficiently
C., because no-instances reject all certificates
D. is NP-hard, because certificates encode solutions
Correct Answer: , but neither membership in P nor NP-hardness follows
Explanation:
Polynomially bounded, polynomial-time verifiable certificates establish membership in NP. They do not provide a polynomial-time method for finding certificates or a reduction proving NP-hardness.
Incorrect! Try again.
56Which statement about an NP-hard problem under polynomial-time many-one reductions is correct?
NP-Hard
Hard
A.It may lie outside NP and may even be undecidable
B.It must be reducible to every problem in NP
C.It must be a decidable decision problem in NP
D.It must have polynomially verifiable yes-certificates
Correct Answer: It may lie outside NP and may even be undecidable
Explanation:
NP-hardness requires every NP problem to reduce to the problem; it does not require the problem itself to belong to NP or even to be decidable. The reduction direction is from NP problems to the NP-hard problem.
Incorrect! Try again.
57A decision problem satisfies , and has a polynomial-time verifier with polynomial-length certificates. What is the strongest justified conclusion?
NP-Complete Problems
Hard
A. is NP-hard but not in NP
B. is NP-complete
C. is in coNP but need not be NP-hard
D. is in P because 3SAT reduces to it
Correct Answer: is NP-complete
Explanation:
Since 3SAT is NP-complete, establishes that is NP-hard. The verifier establishes , so is NP-complete.
Incorrect! Try again.
58To reduce Hamiltonian Circuit on an -vertex graph to metric-free TSP decision, construct a complete graph with edge weight for edges of and weight for nonedges. Which threshold makes the reduction correct?
Traveling Salesman Problem
Hard
A.A tour of cost at most
B.A tour of cost at most
C.A tour of cost at most
D.A tour of cost at most
Correct Answer: A tour of cost at most
Explanation:
Every tour has exactly edges and each edge costs at least . A tour costs at most exactly when all its edges have weight , which corresponds to a Hamiltonian circuit in .
Incorrect! Try again.
59Subset-Sum has a dynamic program running in time, where is the target, yet its decision version is NP-complete. Which explanation resolves this apparent contradiction?
Subset-Sum Problem
Hard
A. is exponential only because is encoded in binary
B.NP-completeness applies only when every number is encoded in unary
C. is pseudopolynomial because binary encoding may make exponential in input length
D.The dynamic program solves only the fractional version of Subset-Sum
Correct Answer: is pseudopolynomial because binary encoding may make exponential in input length
Explanation:
The input contains only bits for the target. Thus, a running time polynomial in the numeric value can be exponential in the encoded input length, consistent with weak NP-completeness.
Incorrect! Try again.
60For a minimization problem, a polynomial reduction creates instances satisfying: yes-instances have , while no-instances have , for a fixed . What would a polynomial-time -approximation imply?
Approximation Algorithms
Hard
A.It would decide the source problem in polynomial time by comparing its output with
B.It would provide only a randomized test with one-sided error
C.It would distinguish the cases only when the optimum is integral
D.It would yield a PTAS without implying an exact decision algorithm
Correct Answer: It would decide the source problem in polynomial time by comparing its output with
Explanation:
In a yes-instance, the approximation returns cost at most . In a no-instance, every feasible solution costs more than . Thus, the output separates the two cases, ruling out such an approximation unless the source problem is in P.
Incorrect! Try again.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill.
The rest comes out of a student's own pocket: the domain, the storage,
and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it.
What it pays for →