YOUR SUBJECT CS502 Fundamentals of AlgorithmsChange subject ↗
PRACTICE AT YOUR OWN PACE

CS502 practice questions

Think through the options before revealing the answer. Use the term filter to focus your revision.

260 questions
CS502 · Final-term only#190

main elements to a divide-and-conquer

  1. A
    ?Divide, conquer, combine (Page 27)
  2. B
    C.A.R. Hoa
Show correct answer

Correct answer: A. ?Divide, conquer, combine (Page 27)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#189

who invented the quick sort

  1. A
    ?C.A.R. Hoare
  2. B
    Divide, conquer, combine
Show correct answer

Correct answer: A. ?C.A.R. Hoare

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#188

Suppose we have three items as shown in the following table, and suppose the capacity of the knapsack is 50
i.e. W = 50.
Item Value Weight
1 60 10
2 100 20
3 120 30
The optimal solution is to pick

  1. A
    ? Items 1 and 2
  2. B
    ? Items 1 and 3
  3. C
    ? Items 2 and 3 (correct)
  4. D
    ? None of these
Show correct answer

Correct answer: C. ? Items 2 and 3 (correct)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#187

The Knapsack problem belongs to the domain of _______________ problems.

  1. A
    ? Optimization (Page 91)
  2. B
    ? NP Complete
  3. C
    ? Linear Solution
  4. D
    ? Sorting
Show correct answer

Correct answer: A. ? Optimization (Page 91)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#186

For Chain Matrix Multiplication we can not use divide and conquer approach because,

  1. A
    ? We do not know the optimum k (Page 86)
  2. B
    ? We use divide and conquer for sorting only
  3. C
    ? We can easily perform it in linear time
  4. D
    ? Size of data is not given
Show correct answer

Correct answer: A. ? We do not know the optimum k (Page 86)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#185

If there are ? (n2
) entries in edit distance matrix then the total running time is

  1. A
    ? ? (1)
  2. B
    ? ? (n2
    ) Click here for detail
  3. C
    ? ? (n)
  4. D
    ? ? (n log n)
Show correct answer

Correct answer: B. ? ? (n2
) Click here for detail

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#184

In Quick sort, we don’t have the control over the sizes of recursive calls

  1. A
    ? True (Page 40)
  2. B
    ? False
  3. C
    ? Less information to decide
  4. D
    ? Either true or false
Show correct answer

Correct answer: A. ? True (Page 40)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#183

When we call heapify then at each level the comparison performed takes time

  1. A
    ? It will take ? (1) (Page 43)
  2. B
    ? Time will vary according to the nature of input data
  3. C
    ? It can not be predicted
  4. D
    ? It will take ? (log n)
Show correct answer

Correct answer: A. ? It will take ? (1) (Page 43)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#182

Is it possible to sort without making comparisons?

  1. A
    ? Yes (Page 57)
  2. B
    ? No
Show correct answer

Correct answer: A. ? Yes (Page 57)

Check community answers against your course notes.Question permalink ↗
CS502 · Final-term only#181

Consider the following code:
For(j=1; j<n;j++)
For(k=1; k<15;k++)
For(l=5; l<n; l++)
{
Do_something_constant();
}
What is the order of execution for this code.

  1. A
    ? O(n)
  2. B
    ? O(n
    3
    )
  3. C
    ? O(n
    2
    log n)
  4. D
    ? O(n2
    )
Show correct answer

Correct answer: A. ? O(n)

Check community answers against your course notes.Question permalink ↗