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#50

A p × q matrix A can be multiplied with a q × r matrix B. The result will be a p × r matrix C. There are (p . r)
total entries in C and each takes _________ to compute.

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

Correct answer: A. ? O (q)

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

Dynamic programming algorithms need to store the results of intermediate sub-problems.

  1. A
    ? True
  2. B
    ? False
Show correct answer

Correct answer: A. ? True

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

In counting sort, once we know the ranks, we simply _________ numbers to their final positions in an output
array.

  1. A
    ? Delete
  2. B
    ? copy
  3. C
    ? Mark
  4. D
    ? arrange
Show correct answer

Correct answer: B. ? copy

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

Merge sort is stable sort, but not an in-place algorithm

  1. A
    ? True
  2. B
    ? False
Show correct answer

Correct answer: A. ? True

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

After partitioning array in Quick sort, pivot is placed in a position such that

  1. A
    ? Values smaller than pivot are on left and larger than pivot are on right (Page 48)
  2. B
    ? Values larger than pivot are on left and smaller than pivot are on right
  3. C
    ? Pivot is the first element of array
  4. D
    ? Pivot is the last element of array
Show correct answer

Correct answer: A. ? Values smaller than pivot are on left and larger than pivot are on right (Page 48)

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

We do sorting to,

  1. A
    ? keep elements in random positions
  2. B
    ? keep the algorithm run in linear order
  3. C
    ? keep the algorithm run in (log n) order
  4. D
    ? keep elements in increasing or decreasing order
Show correct answer

Correct answer: D. ? keep elements in increasing or decreasing order

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

The difference between Prim’s algorithm and Dijkstra’s algorithm is that Dijkstra’s algorithm uses a different
key.

  1. A
    ?True
  2. B
    ? False
Show correct answer

Correct answer: A. ?True

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

Dijkstra’s algorithm is operates by maintaining a subset of vertices

  1. A
    ? True
  2. B
    ? False
Show correct answer

Correct answer: A. ? True

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

In the clique cover problem, for two vertices to be in the same group, they must be adjacent to each other.

  1. A
    ? True
  2. B
    ? False
Show correct answer

Correct answer: A. ? True

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

The term “coloring” came form the original application which was in architectural design.

  1. A
    ? True
  2. B
    ? False
Show correct answer

Correct answer: B. ? False

Check community answers against your course notes.Question permalink ↗