GATE 2012
82 questions
MCQ 821-mark 39 · 2-mark 43
Questions 36–40 of 82
Let G be a weighted graph with edge weights greater than one and G' be the graph constructed by squaring the weights of edges in G. Let T and T' be the minimum spanning trees of G and G', respectively, with total weights t and t'. Which of the following statements is TRUE?
Answer: (D)
If every weight is greater than 1, squaring does not change their order. So the same tree is still a minimum spanning tree. The total weight of the new tree is . It is not .
- The claim is not true in general.
- The claim does not hold when the tree has only one edge ().
- When some weights are equal, a graph can have more than one MST. So T' need not be the same as T.
No option is true in every case.
Answer: None of the above
- The claim is not true in general.
- The claim does not hold when the tree has only one edge ().
- When some weights are equal, a graph can have more than one MST. So T' need not be the same as T.
No option is true in every case.
Answer: None of the above
Consider the directed graph shown in the figure below. There are multiple shortest paths between vertices S and T. Which one will be reported by Dijkstra's shortest path algorithm? Assume that, in any iteration, the shortest path to a vertex v is updated only when a strictly shorter path to v is discovered
Answer: (D)
Run Dijkstra from S: B = 3, A = 4, D = 7 (via S).
- Take B: D via B is 7, not strictly shorter, so D's parent stays S.
- Take A: C = 5. Take C: E = 6 (D via C is 8, no change).
- Take E: T = 10 (via E), G = 8.
- Take D: T via D is 10, not strictly shorter, so T's parent stays E.
Path: S A C E T
Answer: SACET
- Take B: D via B is 7, not strictly shorter, so D's parent stays S.
- Take A: C = 5. Take C: E = 6 (D via C is 8, no change).
- Take E: T = 10 (via E), G = 8.
- Take D: T via D is 10, not strictly shorter, so T's parent stays E.
Path: S A C E T
Answer: SACET
Consider the set of strings on {0,1} in which, every substring of 3 symbols has at most two zeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings of length less than 3 are also in the language. A partially completed DFA that accepts this language is shown below.
The missing arcs in the DFA are
The missing arcs in the DFA are
Answer: (D)
Each state stores the last two symbols. These are the missing moves:
- From 00, input 0 gives three 0s the dead state q. From 00, input 1 goes 01.
- From 01, input 1 goes 11.
- From 10, input 0 goes 00.
- From 11, input 0 goes 10.
These match table D exactly.
Answer: D
- From 00, input 0 gives three 0s the dead state q. From 00, input 1 goes 01.
- From 01, input 1 goes 11.
- From 10, input 0 goes 00.
- From 11, input 0 goes 10.
These match table D exactly.
Answer: D
What is the complement of the language accepted by the NFA shown below? Assume ={a} and is the empty string.
Answer: (B)
The NFA moves to the final state after reading one a. The arcs then let it return and read more a's. So it accepts (a, aa, aaa, ...).
Over {a}, the one string that is not accepted is . So the complement = {}.
Answer: {}
Over {a}, the one string that is not accepted is . So the complement = {}.
Answer: {}
Given the language L = {ab, aa, baa}, which of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
Answer: (D)
Every string in is a concatenation of the pieces , , . The split is forced when read from the left. A piece starting with must be . A piece starting with is or , decided by the second symbol. So there is only one way to try.
1) : valid.
2) : valid.
3) : the last cannot start a piece , and the split is forced, so it is not in .
4) : valid.
So strings 1, 2 and 4 are in .
Answer: (D)
1) : valid.
2) : valid.
3) : the last cannot start a piece , and the split is forced, so it is not in .
4) : valid.
So strings 1, 2 and 4 are in .
Answer: (D)