In the name of ALLAH, the most beneficient, the most merciful

Fundamentals of Algorithms (CS502)

Multiple Choice Questions (MCQs)

Objective Questions

  1. Bellman-Ford allows negative weights edges and negative cost cycles.

    1. True
    2. False
  2. If a problem is in NP, it must also be in P.

    1. True
    2. False
    3. Unknown
  3. By breaking any edge on cycle created in free tree, the free ________ is restored.

    1. Edge
    2. Tree
    3. Cycle
    4. Vertex
  4. Dynamic Programming is a problem-solving approach in which ________.

    1. Problem is solved in Zero time
    2. Solution is developed only at final stage
    3. Both are correct
    4. Both are incorrect
  5. We say that two vertices u and v are mutually not reachable if u can reach v and vice versa.

    1. True
    2. False
  6. Although it requires more complicated data structures, Prim's algorithm for a minimum spanning tree is better than Kruskal's when the graph has a large number of vertices.

    1. True
    2. False
  7. Diagraphs are not used in communication and transportation networks.

    1. True
    2. False
  8. Dijkstra’s algorithm is operated by maintaining a subset of vertices.

    1. True
    2. False
  9. Which is true statement.

    1. Breadth first search is shortest path algorithm that works on un-weighted graphs
    2. Depth first search is shortest path algorithm that works on un-weighted graphs.
    3. Both of above are true.
    4. None of the given
  10. Strongly connected components are not affected by reversal of all edges in terms of vertices reachability.

    1. True
    2. False
  11. Networks are ________ in the sense that is possible from any location in the network to reach any other location in the digraph.

    1. Complete
    2. Incomplete
    3. Not graphs
    4. Transportation
  12. Counting sort assumes that the numbers to be sorted are in the range ________.

    1. k to n where n is large
    2. 1 to k where k is small
    3. k to n where k is small
    4. k to n where n is small
  13. Huffman algorithm uses a greedy approach to generate a postfix code T that minimizes the expected length B(T) of the encoded string.

    1. True
    2. False
  14. Shortest path problems can be solved efficiently by modeling the road map as a graph.

    1. True
    2. False
  15. The greedy part of the Huffman encoding algorithm is to first find two nodes with larger frequency.

    1. True
    2. False
  16. The difference between Prim’s algorithm and Dijkstra’s algorithm is that Dijkstra’s algorithm uses a different key.

    1. True
    2. False
  17. In strong components algorithm, first of all DFS is run for computing finish times of vertices.

    1. True
    2. False
  18. Maximum number of vertices in a Directed Graph may be |V2|

    1. True
    2. False
  19. A graph may contain ________.

    1. Exactly one MST
    2. Maximum one MST
    3. NO MST
    4. More than one MST
  20. Heap sort is a/an ________ and ________ sorting algorithm.

    1. Not in-place, not stable one
    2. In-place, stable one
    3. In-place, not stable one
    4. Not in-place, stable one
  21. In ________ algorithm, at any time, the subset of edges A forms a single tree.

    1. Kruskal's
    2. Prim's
    3. Both Kruskal's and Prim's
    4. None of the given
  22. An optimization problem is one in which you want to find,

    1. Not a solution
    2. An algorithm
    3. Good solution
    4. The best solution
  23. Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best free edge) when the gaph has relatively few edges.

    1. True
    2. False
  24. Chain matrix multiplication problem can be solved through ________ strategy.

    1. Dynamic programming
    2. Greedy
    3. Divide and conquer
    4. Sorting
  25. In the clique cover problem, for two vertices to be in the same group, they must be adjacent to each other.

    1. True
    2. False
  26. The Huffman algorithm finds an exponential solution

    1. True
    2. False
  27. Dijkestra’s single source shortest path algorithm works if all edges weights are non-negative and there are negative cost cycles.

    1. True
    2. False
  28. You have an adjacency list for G, what is the time compexity to compute Graph transpose G^T?

    1. (V+E)
    2. V.E
    3. V
    4. E
  29. In Prim's algorithm, we start with the root vertex r; it can be any vertex.

    1. True
    2. False
  30. The codeword assigned to characters by the Huffman algorithm have the property that no codeword is the postfix of any other.

    1. True
    2. False
  31. The term “coloring” came form the original application which was in architectural design.

    1. True
    2. False
  32. In kruskal's algorithm, the next edge is added to viable set A, if its adding does not induce a cycle.

    1. True
    2. False
  33. If a graph has v vertices and e edges then to obtain a spanning tree we have to delete

    1. v edges.
    2. v – e + 5 edges
    3. v + e edges.
    4. None of the given
  34. In strong components algorithm, first of all DFS is run for getting ________ times of vertices.

    1. Start
    2. Finish
    3. Both start & finish
    4. None of the given
  35. Consider the following adjacency list:
    CS502_0001
    Which of the following graph(s) describe(s) the above adjacency list?

    1. CS502_0002
    2. CS502_0003
    3. CS502_0004
    4. CS502_0005
  36. The Huffman algorithm finds a(n) ________ solution.

    1. Optimal
    2. Non-optimal
    3. Exponential
    4. Polynomial
  37. If there are Θ (n2) entries in edit distance matrix then each entry E (i, j) takes ________ time to compute.

    1. Θ (n)
    2. Θ (n2)
    3. Θ (1)
    4. Θ (n log n)
  38. Consider three matrices X, Y, Z of dimensions 1 × 2, 2 × 3, 3 × 4 respectively. The number of multiplications of X(YZ) is:

    1. 16
    2. 23
    3. 26
    4. 32
  39. In Dynamic Programming approach, we do not store the solution to each sub-problem in case if it reappears.

    1. True
    2. False
  40. We can use the optimal substructure property to devise a ________ formulation of the edit distance problem.

    1. Selective
    2. Optimum
    3. Iterative
    4. Recursive
  41. A free tree with n vertices have exactly n+1 edges.

    1. True
    2. False
  42. What is generally true of Adjacency List and Adjacency Matrix representations of graphs?

    1. Lists require less space than matrices but take longer to find the weight of an edge (v1,v2)
    2. Lists require less space than matrices and they are faster to find the weight of an edge (v1,v2)
    3. Lists require more space than matrices and they take longer to find the weight of an edge (v1,v2)
    4. Lists require more space than matrices but are faster to find the weight of an edge (v1,v2)
  43. Adding an edge to a free tree creates.

    1. A cycle
    2. A complete MST
    3. A partial MST
    4. A shortest path
  44. The Huffman algorithm finds a polynomial solution.

    1. True
    2. False
  45. Radix sort is not a non-comparative integer sorting algorithm.

    1. True
    2. False
  46. We say that two vertices u and v are mutually ________ if u can reach v and vice versa.

    1. Crossed
    2. Forward
    3. Reachable
    4. Nor Reachable
  47. In Dynamic Programming, our approach is to ________.

    1. Develop the solution in a top-down fashion
    2. Express the problem non-recursively
    3. Build the solution in a bottom-up fashion
    4. Input several sub-problems simultaneously
  48. You have an adjacency list for G, what is the time compexity to compute Graph transpose G^T.?

    1. ? (V + E)
    2. ? (V E)
    3. ?(V)
    4. ?(v^2)
  49. According to parenthesis lemma. vertex u is a descendent of v vertex if and only if,

    1. [d[u], f[u]] ⊆ [d[v], f[v]]
    2. [d[u], f[u]] ⊇ [d[v], f[v]]
    3. Unrelated
    4. Disjoint
  50. The ________ given by DFS allow us to determine whether the graph contains any cycles.

    1. Order
    2. Time stamps
    3. BFS traversing
    4. Topological sort