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

If a graph has v vertices and e edges then to obtain a spanning tree we have to delete

  1. A
    ? v edges.
  2. B
    ? v – e + 5 edges
  3. C
    ? v + e edges.
  4. D
    ? None of these
Show correct answer

Correct answer: D. ? None of these

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

What is generally true of Adjacency List and Adjacency Matrix representations of graphs?

  1. A
    ? Lists require less space than matrices but take longer to find the weight of an edge (v1,v2)
  2. B
    ? Lists require less space than matrices and they are faster to find the weight of an edge (v1,v2)
  3. C
    ? Lists require more space than matrices and they take longer to find the weight of an edge (v1,v2)
  4. D
    ? Lists require more space than matrices but are faster to find the weight of an edge (v1,v2)
Show correct answer

Correct answer: A. ? Lists require less space than matrices but take longer to find the weight of an edge (v1,v2)

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

If a problem is in NP, it must also be in P.

  1. A
    ? True
  2. B
    ? False
  3. C
    ? unknown
Show correct answer

Correct answer: C. ? unknown

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

An optimization problem is one in which you want to find,

  1. A
    ? Not a solution
  2. B
    ? An algorithm
  3. C
    ? Good solution
  4. D
    ? The best solution (Page 97)
Show correct answer

Correct answer: D. ? The best solution (Page 97)

Check community answers against your course notes.Question permalink ↗
CS502 · Midterm#26

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

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

Correct answer: B. ? ? (n2)

Check community answers against your course notes.Question permalink ↗
CS502 · Midterm#25

Is it possible to sort without making comparisons?

  1. A
    ? Yes
  2. B
    ? No
Show correct answer

Correct answer: A. ? Yes

Check community answers against your course notes.Question permalink ↗
CS502 · Midterm#24

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

  1. A
    It will take ? (1)
  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)

Check community answers against your course notes.Question permalink ↗
CS502 · Midterm#23

Consider the following Algorithm:
Factorial (n){
if (n=1)
return 1
else
return (n * Factorial(n-1))
Recurrence for the following algorithm is:

  1. A
    ? T(n) = T(n-1) +1
  2. B
    ? T(n) = nT(n-1) +1
  3. C
    ? T(n)= T(n-1) +n
  4. D
    ? T(n)=T(n(n-1)) +1
Show correct answer

Correct answer: D. ? T(n)=T(n(n-1)) +1

Check community answers against your course notes.Question permalink ↗
CS502 · Midterm#22

What is the total time to heapify?

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

Correct answer: A. ?(log n)

Check community answers against your course notes.Question permalink ↗
CS502 · Midterm#21

Due to left complete nature of binary tree, the heap can be stored in

  1. A
    Arrays
  2. B
    Structures
  3. C
    Link Lis
  4. D
    Stack
Show correct answer

Correct answer: A. Arrays

Check community answers against your course notes.Question permalink ↗