CS502
Fundamentals of
Algorithms Final
Term Solved
MCQs
Question No:
Question No: 1 ( Marks: 1 ) - Please choose one
An optimization problem is one in which you want to find,
► Not a solution
► An algorithm
► Good solution
► The best solution
3
Question No: 21 ( Marks: 1 ) - Please choose one
We do sorting to,
► keep elements in random positions
► keep the algorithm run in linear order
► keep the algorithm run in (log n) order
► keep elements in increasing or decreasing order
Question No: 24 ( Marks: 1 ) - Please choose one
In counting sort, once we know the ranks, we simply _________ numbers to their final positions in an output
array.
► Delete
► copy
► Mark
► arrange
Question No: 25 ( Marks: 1 ) - Please choose one
Dynamic programming algorithms need to store the results of intermediate sub-problems.
► True
► False
4
Question No: 13 ( Marks: 1 )
- Please choose one
Shortest path problems can be solved efficiently by modeling the road map as a graph.
► True
► False
5
Question No: 26 ( Marks: 1 ) - Please choose one
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.
► O (q)
► O (1)
► O (n2)
► O (n3)
Question No: 1 ( Marks: 1 ) - Please choose one
_______________ is a graphical representation of an algorithm
► notation
► notation
► Flowchart
► Asymptotic notation
Question No: 2 ( Marks: 1 ) - Please choose one
Which of the following is calculated with big o notation?
►Lower bounds
►Upper bounds
►Both upper and lower bound
►Medium bounds
Question No: 3 ( Marks: 1 ) - Please choose one
Merge sort makes two recursive calls. Which statement is true after these recursive calls finish, but before the
merge step?
►The array elements form a heap
►Elements in each half of the array are sorted amongst themselves
►Elements in the first half of the array are less than or equal to elements in the second half of the array
►None of the above
6
Question No: 16 ( Marks: 1 )
- Please choose one
The term “coloring” came form the original application which was in architectural design.
► True
► False
7
Question No: 4 ( Marks: 1 ) - Please choose one
Who invented Quick sort procedure?
►Hoare
►Sedgewick
►Mellroy
►Coreman
Question No: 8 ( Marks: 1 ) - Please choose one
Can an adjacency matrix for a directed graph ever not be square in shape?
►Yes
►No
Question No: 9 ( Marks: 1 ) - Please choose one
One of the clever aspects of heaps is that they can be stored in arrays without using any____________.
►Pointers
►constants
►variables
►functions
8
Question No: 17 ( Marks: 1 ) - Please
choose one
In the clique cover problem, for two vertices to be in the same group, they must be adjacent to
each other. ► True
► False
9
- Please choose one
10
- Please choose one
Question No: 11 ( Marks: 1 ) - Please choose one
Non-optimal or greedy algorithm for money change takes____________
►O(k)
►O(kN)
►O(2k)
►O(N)
Question No: 12 ( Marks: 1 ) - Please choose one
The Huffman codes provide a method of encoding data inefficiently when coded using ASCII standard.
►True
►False
Question No: 13 ( Marks: 1 ) - Please choose one
Using ASCII standard the string abacdaacac will be encoded with __________ bits.
►80
►160
►320
►100
Question No: 14 ( Marks: 1 ) - Please choose one
Using ASCII standard the string abacdaacac will be encoded with 160 bits.
►True
►False
11
- Please choose one
12
- Please choose one
Question No: 21 ( Marks: 1 ) - Please choose one
Depth first search is shortest path algorithm that works on un-weighted graphs.
►True
►False
13
- Please choose one
14
- Please choose one
Question No: 24 ( Marks: 1 )
Floyd-Warshall algorithm is a dynamic programming algorithm; the genius of the algorithm is in the clever
recursive formulation of the shortest path problem.
►True
►Flase
Question No: 26 ( Marks: 1 ) - Please choose one
The term coloring came from the original application which was in map drawing.
►True
►False
Question No: 27 ( Marks: 1 ) - Please choose one
In the clique cover problem, for two vertices to be in the same group, they must be_______________each
other.
►Apart from
►Far from
►Near to
►Adjacent to
15
- Please choose one
16
- Please choose one
Question No: 29 ( Marks: 1 )
In greedy algorithm, at each phase, you take the________ you can get right now, without regard for future
consequences.
►Worst
►Minimum
►Good
►Best
Question No: 1 ( Marks: 1 ) - Please choose one
If a problem is in NP-complete, it must also be in NP.
► True
► False
Question No: 2 ( Marks: 1 ) - Please choose one
If there are n items, there are _______ possible combinations of the items.
►2
►n
►2^n
►3^n
Question No: 3 ( Marks: 1 ) - Please choose one
Using ASCII code, each character is represented by a fixed-length code word of ________ bits per character.
►4
►6
►8
►10
4 ( Marks: 1 ) - Please choose one
Question No: ( Marks: 1 ) - Please choose one
Question No: 8 ( Marks: 1 ) - Please choose one
In ______ Knapsack Problem, limitation is that an item can either be put in the bag or not-fractional items
are not allowed.
►0
►1
►0/1
►Fractional
10
In Knapsack Problem, value and weight both are to be under consideration.
►True
►False
Question No: 11 ( Marks: 1 ) - Please choose one
Time complexity of DP based algorithm for computing the minimum cost of chain matrix Multiplication is
________ .
►log n
►n
►n2
►n3
Question No: 12 ( Marks: 1 ) - Please choose one
In DP based solution of knapsack problem, to compute entries of V we will imply a/an _______ approach.
►Subjective
►Inductive
►Brute force
►Combination
Question No: ( Marks: 1 ) - Please choose one
Question No: 13 ( Marks: 1 ) - Please choose one
A greedy algorithm sometimes works well for optimization problems.
►True
►False
Question No: 14 ( Marks: 1 ) - Please choose one
In Huffman encoding, frequency of each character can be determined by parsing the message and __________
how many times each character (or symbol) appears.
►Printing
►Incrementing
►Counting
►Deleting
Question No: ( Marks: 1 ) - Please choose one
16 ( Marks: 1 )
The Huffman codes provide a method of _________ data efficiently.
►Reading
►Encoding
►Decoding
►Printing
Question No: 17 ( Marks: 1 ) - Please choose one
In _______ based solution of knapsack problem, we consider 2 cases, Leave object Or Take object.
►Brute force
►Dynamic programming
Question No: 18 ( Marks: 1 ) - Please choose one
Those problems in which Greedy finds good, but not always best is called a greedy________.
►Algorithm
►Solution
►Heuristic
►Result
Question No: 21 ( Marks: 1 ) - Please choose one
Question No: ( Marks: 1 ) - Please choose one
Question No: ( Marks: 1 ) - Please choose one
Question # 1 of 10 ( Marks: 1 ) Please choose one
What algorithm technique is used in the implementation of Kruskal solution for the MST?
►Greedy Technique
►Divide-and-Conquer Technique
►Dynamic Programming Technique
►The algorithm combines more than one of the above techniques
\
Question No: ( Marks: 1 ) - Please choose one
What is the time complexity to extract a vertex from the priority queue in Prim’s algorithm?
►O (log E)
► (V)
► (V+E)
►O (log V)
Question # 1 of 10 ( Marks: 1 ) Please
choose one
You have an adjacency list for G, what is the time complexity to compute Graph transpose
G^T.?
► (V + E)
► (V E)
► (V)
► (V^2)
Question # 1 of 10 ( Marks: 1 ) Please
choose one
There is relationship between number of back edges and number of cycles in DFS
►Both are equal.
►Cycles are half of back edges.
►Cycles are one fourth of back edges.
►There is no relationship between back edges and number of cycles.
Question No: ( Marks: 1 ) - Please choose one
Question # 1 of 10 ( Marks: 1 ) Please choose one
In in-place sorting algorithm is one that uses arrays for storage :
►An additional array
►No additional array
►Both of above may be true according to algorithm ►More
than 3 arrays of one dimension.
Question # 1 of 10 ( Marks: 1 ) Please choose one
In stable sorting algorithm
►One array is used
►In which duplicating elements are not handled.
►More then one arrays are required.
►Duplicating elements remain in same relative position after sorting.
Question # 1 of 10 ( Marks: 1 ) Please choose one
Which sorting algorithm is faster :
►O(n^2)
►O(nlogn)
►O(n+k)
►O(n^3)
Question # 1 of 10 ( Marks: 1 ) Please choose one
In Quick sort algorithm, constants hidden in T(n lg n) are
►Large
►Medium
►Not known
►Small