Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 4 MCQsDynamic Programming
ECAP538 ·
60 questions. Pick an option to check it.
Dynamic programming solves subproblems and stores their results so they do not need to be solved repeatedly.
Question 2 of 60 · General method · Easy
Which property means that a problem contains repeatedly occurring subproblems?
Not quite. Try another option.
Answer: Overlapping subproblems
Overlapping subproblems occur when the same smaller problems are solved multiple times.
Question 3 of 60 · General method · Easy
Which property allows an optimal solution to be constructed from optimal solutions to smaller subproblems?
Not quite. Try another option.
Answer: Optimal substructure
Optimal substructure means that an optimal solution contains optimal solutions to its subproblems.
Question 4 of 60 · General method · Easy
What is memoization in dynamic programming?
Not quite. Try another option.
Answer: A top-down method that caches results
Memoization uses recursion and saves computed subproblem results for later reuse.
Question 5 of 60 · General method · Easy
What is tabulation in dynamic programming?
Not quite. Try another option.
Answer: Filling a table from smaller subproblems
Tabulation is a bottom-up technique that fills a table using previously computed smaller cases.
Question 6 of 60 · General method · Easy
Why does dynamic programming commonly use a table?
Not quite. Try another option.
Answer: To store subproblem results
The table records solutions to subproblems so they can be reused efficiently.
Question 7 of 60 · General method · Easy
Which statement describes Bellman's principle of optimality?
Not quite. Try another option.
Answer: An optimal solution includes optimal subsolutions
Bellman's principle states that the remaining decisions of an optimal solution must also be optimal for the resulting subproblem.
Question 8 of 60 · Chained matrix multiplication · Easy
What is optimized in the chained matrix multiplication problem?
Not quite. Try another option.
Answer: The number of scalar multiplications
The problem finds a parenthesization that minimizes the total number of scalar multiplications.
Question 9 of 60 · Chained matrix multiplication · Easy
What can change when a matrix chain is parenthesized differently?
Not quite. Try another option.
Answer: The scalar multiplication cost
Different parenthesizations produce the same result but may require different numbers of scalar multiplications.
Question 10 of 60 · Chained matrix multiplication · Easy
How many matrix multiplication operations are required to multiply a chain of matrices?
Not quite. Try another option.
Answer:
Combining matrices into one product requires exactly matrix multiplication operations.
Question 11 of 60 · Chained matrix multiplication · Easy
What is the cost of multiplying a matrix by a matrix using the standard method?
Not quite. Try another option.
Answer: scalar multiplications
The resulting matrix has entries, and each entry requires scalar multiplications, giving .
Question 12 of 60 · Chained matrix multiplication · Easy
What is the scalar multiplication cost of multiplying a matrix by a matrix?
Not quite. Try another option.
Answer:
The cost is scalar multiplications.
Question 13 of 60 · Chained matrix multiplication · Easy
In matrix-chain dynamic programming, what does the base case equal?
Not quite. Try another option.
Answer:
A single matrix requires no matrix multiplication, so its multiplication cost is .
Question 14 of 60 · Chained matrix multiplication · Easy
What is the usual time complexity of the dynamic programming algorithm for matrix-chain multiplication?
Not quite. Try another option.
Answer:
The standard algorithm considers chain lengths, starting positions, and split positions, resulting in time.
Question 15 of 60 · Optimal storage on tapes · Easy
What is the main objective of optimal storage on tapes?
Not quite. Try another option.
Answer: Minimize mean retrieval time
Optimal tape storage arranges files so that their average retrieval time is as small as possible.
Question 16 of 60 · Optimal storage on tapes · Easy
For files with equal retrieval probabilities, how should files be ordered on one tape?
Not quite. Try another option.
Answer: In increasing order of length
Placing shorter files first minimizes the cumulative access times and therefore the mean retrieval time.
Question 17 of 60 · Optimal storage on tapes · Easy
Which file should be placed first when file lengths are , , and units and access probabilities are equal?
Not quite. Try another option.
Answer: The file of length
With equal access probabilities, files are stored in increasing order of length, so the length- file comes first.
Question 18 of 60 · Optimal storage on tapes · Easy
If files of lengths , , and are stored in that order, what is the retrieval time of the third file?
Not quite. Try another option.
Answer: units
The third file is reached after passing through all three files, so its retrieval time is units.
Question 19 of 60 · Optimal storage on tapes · Easy
For files of lengths , , and stored in that order, what is the mean retrieval time?
Not quite. Try another option.
Answer: units
The retrieval times are , , and , so the mean is units.
Question 20 of 60 · Optimal storage on tapes · Easy
Why are shorter files generally placed before longer files on a tape?
Not quite. Try another option.
Answer: They reduce cumulative retrieval times
A file near the beginning affects the retrieval time of later files, so placing shorter files first reduces cumulative delay.
Question 21 of 60 · General method · Medium
Which combination of properties most directly justifies solving a problem using dynamic programming?
Not quite. Try another option.
Answer: Optimal substructure and overlapping subproblems
Dynamic programming is effective when optimal solutions contain optimal subsolutions and the same subproblems occur repeatedly.
Question 22 of 60 · General method · Medium
A memoized algorithm computes with base cases and . How many distinct states are evaluated when computing ?
Not quite. Try another option.
Answer: states
Memoization evaluates each state from through once, giving distinct states.
Question 23 of 60 · General method · Medium
For the 0/1 knapsack problem, let be the maximum value using the first items with capacity . If item has weight and value , which recurrence is correct?
Not quite. Try another option.
Answer:
The recurrence compares excluding item with including it once and using the remaining capacity.
Question 24 of 60 · General method · Medium
What is the length of the longest common subsequence of and ?
Not quite. Try another option.
Answer:
The sequence appears in both strings in the same relative order, so the LCS length is .
Question 25 of 60 · General method · Medium
In a DAG shortest-path dynamic program, denotes the shortest distance from source to vertex . Which recurrence applies when vertices are processed in topological order?
Not quite. Try another option.
Answer:
Every path to ends at an incoming edge , so the minimum predecessor distance plus edge weight is selected.
Question 26 of 60 · General method · Medium
A two-dimensional DP recurrence uses only the previous row and already computed entries of the current row. Which optimization is generally valid?
Not quite. Try another option.
Answer: Replace the table with one or two rows
Rows that can no longer affect future computations may be discarded, reducing space while preserving the required dependencies.
Question 27 of 60 · Chained matrix multiplication · Medium
Matrices , , and have dimensions , , and . What is the minimum number of scalar multiplications needed to compute ?
Not quite. Try another option.
Answer:
Using costs , which is less than the alternative.
Question 28 of 60 · Chained matrix multiplication · Medium
For matrices with dimension sequence , which parenthesization has minimum multiplication cost?
Not quite. Try another option.
Answer: with cost
The costs are for , for , and for multiplying the results, totaling .
Question 29 of 60 · Chained matrix multiplication · Medium
Let matrix have dimensions . In the matrix-chain recurrence, what is the multiplication cost when the chain is split after ?
Not quite. Try another option.
Answer:
The two resulting matrices have dimensions and , giving cost .
Question 30 of 60 · Chained matrix multiplication · Medium
How many complete parenthesizations are possible for a chain of five matrices?
Not quite. Try another option.
Answer:
The number is the Catalan number .
Question 31 of 60 · Chained matrix multiplication · Medium
What are the standard time and auxiliary table-space complexities of dynamic programming for a chain of matrices?
Not quite. Try another option.
Answer: time and space
There are subchains, and each examines up to split positions.
Question 32 of 60 · Chained matrix multiplication · Medium
Besides the minimum-cost table, what information should be stored to reconstruct an optimal matrix-chain parenthesization?
Not quite. Try another option.
Answer: The split index for each subchain
Recording the optimal split for every subchain allows the parenthesization to be reconstructed recursively.
Question 33 of 60 · Chained matrix multiplication · Medium
Matrices , , and have dimensions , , and . How many fewer scalar multiplications does use than ?
Not quite. Try another option.
Answer:
costs , while costs , so the difference is .
Question 34 of 60 · Chained matrix multiplication · Medium
Why are matrix-chain DP table entries usually filled in increasing order of chain length?
Not quite. Try another option.
Answer: Each entry depends on shorter subchains
Every candidate split uses solutions for two shorter chains, so those entries must already be available.
Question 35 of 60 · Optimal storage on tapes · Medium
Four files have lengths , , , and . Assuming equal retrieval probabilities and one tape, what order minimizes mean retrieval time?
Not quite. Try another option.
Answer:
With equal probabilities, arranging files in nondecreasing order of length minimizes the sum of retrieval times.
Question 36 of 60 · Optimal storage on tapes · Medium
Files of lengths , , and are stored in that order on one tape. What is their mean retrieval time if each file is equally likely to be requested?
Not quite. Try another option.
Answer:
The retrieval times are , , and , so the mean is .
Question 37 of 60 · Optimal storage on tapes · Medium
For unequal access probabilities, file has length and probability . Which ordering rule minimizes expected retrieval time on one tape?
Not quite. Try another option.
Answer: Nondecreasing order of
The weighted completion-time rule places files in nondecreasing order of the ratio .
Question 38 of 60 · Optimal storage on tapes · Medium
File has length and access probability ; file has length and probability . What is the optimal order and expected retrieval time?
Not quite. Try another option.
Answer: with expected time
Since , comes first. The expected time is .
Question 39 of 60 · Optimal storage on tapes · Medium
Files , , and have values , , and . Which order minimizes expected retrieval time?
Not quite. Try another option.
Answer:
The ratios are , , and approximately , so their increasing order is .
Question 40 of 60 · Optimal storage on tapes · Medium
Files of lengths , , , and are placed on two tapes as and , with each pair stored in the shown order. Assuming equal access probabilities, what is the mean retrieval time?
Not quite. Try another option.
Answer:
The retrieval times are , , , and . Their mean is .
Question 41 of 60 · General method · Hard
A dynamic program merges multiple partial solutions into the same state. Which condition is essential for this state compression to preserve optimality?
Not quite. Try another option.
Answer: Merged histories must have identical feasible continuations and identical incremental continuation costs.
A state is sufficient only when it retains all information affecting future feasibility and cost. Past costs may differ because the DP can retain only the best one.
Question 42 of 60 · General method · Hard
A top-down memoized DP is evaluated on an acyclic state graph. Exactly states are reachable from the initial state, and their transition lists contain edges in total. Each transition takes constant time. What is the tight running-time bound?
Not quite. Try another option.
Answer:
Memoization evaluates each reachable state once and inspects each outgoing transition once, giving time.
Question 43 of 60 · General method · Hard
The standard 0/1 knapsack DP runs in time, where is an integer capacity encoded in binary. Which classification is most accurate?
Not quite. Try another option.
Answer: It is pseudopolynomial because may be exponential in .
The numeric value , rather than its encoding length , appears in the bound. Thus is pseudopolynomial.
Question 44 of 60 · General method · Hard
A DP with states uses rolling arrays to reduce value-table memory to . The complete optimal decision sequence must later be produced without asymptotically increasing the running time. Which modification provides the general guarantee?
Not quite. Try another option.
Answer: Store one selected predecessor for every DP state and backtrack from the optimum.
Rolling values generally discard reconstruction information. Recording one optimal predecessor per state guarantees reconstruction, although it restores memory.
Question 45 of 60 · General method · Hard
In a resource-constrained minimization DP, labels at the same logical state are pairs of accumulated cost and resource consumption. Under the usual monotonicity assumption that having less remaining resource cannot improve future feasibility, when can label safely be discarded?
Not quite. Try another option.
Answer: When another label satisfies and .
The first label is no more expensive and consumes no more resource, so every continuation feasible from the second label is matched or improved.
Question 46 of 60 · General method · Hard
Consider the finite-horizon recurrence with known values . Which evaluation order is valid even if the underlying state-transition graph contains cycles?
Not quite. Try another option.
Answer: Evaluate layers in increasing order of , starting from .
Every layer depends only on the completed layer . Adding the horizon dimension makes dependencies acyclic even when states can revisit one another.
Question 47 of 60 · Chained matrix multiplication · Hard
Matrices have dimensions , , , and , respectively. What is the minimum number of scalar multiplications?
Not quite. Try another option.
Answer:
The optimal parenthesization is , costing .
Question 48 of 60 · Chained matrix multiplication · Hard
For a chain of matrices, how many split points are examined in total by the standard bottom-up matrix-chain DP?
Not quite. Try another option.
Answer:
The number is .
Question 49 of 60 · Chained matrix multiplication · Hard
A matrix-chain split table contains , , , and . Which parenthesization does it encode?
Not quite. Try another option.
Answer:
The root split separates from ; the left subchain then splits after .
Question 50 of 60 · Chained matrix multiplication · Hard
Let have dimensions . If an optimal solution for splits after , what scalar-multiplication term must be added to the two subproblem costs?
Not quite. Try another option.
Answer:
The two resulting matrices have dimensions and , so combining them costs .
Question 51 of 60 · Chained matrix multiplication · Hard
How many complete parenthesizations exist for a chain of matrices?
Not quite. Try another option.
Answer:
The count is the Catalan number .
Question 52 of 60 · Chained matrix multiplication · Hard
For dimensions , a greedy algorithm repeatedly multiplies the adjacent pair with the smallest immediate cost. What costs do the greedy and optimal solutions obtain, respectively?
Not quite. Try another option.
Answer: and
The greedy sequence costs . The optimal parenthesization costs .
Question 53 of 60 · Chained matrix multiplication · Hard
Suppose each matrix in a chain may optionally be transposed before multiplication, provided the resulting products are dimensionally compatible. Why is the standard interval state generally insufficient?
Not quite. Try another option.
Answer: The state must also represent possible boundary dimensions or orientations of the subchain result.
Different orientation choices can give the same interval different output dimensions. Those dimensions affect compatibility and future multiplication costs.
Question 54 of 60 · Chained matrix multiplication · Hard
All four matrices in a chain are square matrices of dimension , and ordinary multiplication is used. How many parenthesizations achieve the minimum scalar-multiplication cost?
Not quite. Try another option.
Answer:
Every parenthesization performs three multiplications and therefore has cost . There are parenthesizations.
Question 55 of 60 · Optimal storage on tapes · Hard
Four files have pairs , , , and . For one sequential tape, which order minimizes expected retrieval time, and what is that expectation?
Not quite. Try another option.
Answer: with expectation
Smith's rule orders files by increasing length-to-probability ratio. The weighted completion sum is .
Question 56 of 60 · Optimal storage on tapes · Hard
Seven equally likely files have lengths and are stored optimally across three identical tapes. Retrieval starts at the beginning of the selected tape. What is the minimum mean retrieval time?
Not quite. Try another option.
Answer:
Cyclic placement gives tapes , , and . Their retrieval-time sums are , , and , so the mean is .
Question 57 of 60 · Optimal storage on tapes · Hard
On a single tape, adjacent files and have positive lengths and access probabilities . Under what condition is placing before no worse than placing before ?
Not quite. Try another option.
Answer:
Comparing the two orders gives , which is equivalent to ordering by nondecreasing .
Question 58 of 60 · Optimal storage on tapes · Hard
For equally likely files and identical tapes, which construction yields an optimal arrangement under the standard sequential-retrieval model?
Not quite. Try another option.
Answer: Sort by nondecreasing length and assign files cyclically across the tapes.
Cyclic assignment gives shorter files positions with larger contribution coefficients in the total retrieval-time sum, minimizing that sum by an exchange argument.
Question 59 of 60 · Optimal storage on tapes · Hard
When access probabilities differ and files may be assigned to multiple tapes, which statement is correct?
Not quite. Try another option.
Answer: Each tape must follow nondecreasing , but choosing the tape allocation remains a global problem.
An adjacent-exchange argument enforces Smith's rule within each tape. Unlike the equal-probability case, a simple cyclic allocation is not generally optimal.
Question 60 of 60 · Optimal storage on tapes · Hard
A single tape contains several positive-length files. File has access probability , while every other file has positive access probability. What must hold in every optimal ordering if all lengths are positive?
Not quite. Try another option.
Answer: Every positive-probability file appears before .
Placing before a requested file delays that file by 's positive length while contributing no weighted benefit. Thus must be last.
That's unit 4
Answer a few questions and your score shows up here.
Nearly through. Did unit 4 of ECAP538 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 4 of ECAP538 save you a night before the exam?
Then you can help keep it free for the next batch. 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.