GATE 2000
54 questions
MCQ 541-mark 54
Questions 36–40 of 54
Answer: (C)
Why C is always true. When DFS discovers , it goes next to an unvisited neighbour of if there is one. That neighbour becomes a child of and is the next new vertex, so would be a neighbour of . So if is not an edge, had no unvisited neighbour, and it has no child. That means is a leaf in .
Why A, B and D can fail. Take the graph to be the tree in the figure and let DFS visit children left to right. The visiting order is G, E, B, D, F, K, M, R. Here and .
- and are not joined by an edge, so A and B fail.
- The parent of is and the parent of is . They are different, so D fails. They only share the ancestor .
Answer: (C)
Answer: (C)
(D) True. Distinct weights give a unique MST.
(A) True. is the lightest edge of G, so it is the lightest edge across any cut it crosses. By the cut property it is in the MST.
(B) True. If were on a cycle, it would be the heaviest edge of that cycle, and the heaviest edge of a cycle is in no MST. So if it is in the MST, it is on no cycle, and removing it disconnects G.
(C) False. If is a bridge (for example, G is a tree), every spanning tree must include it. So an MST can contain .
Answer: (C)
Answer: (C)
Both languages are sets of strings over , so .
So . Both equal .
(A) and (B) are wrong because neither set is a proper subset of the other. (D) is wrong because both contain the empty string and every other string, so .
Answer: (C)
Answer: (D)
Look at all minimal DFAs with two states over . Both states must be reachable, so the start state goes to on . They must also be distinguishable, so exactly one state is final. (If none or both were final, one state would be enough.) The state goes back to or stays on . This gives four languages.
- loops, only final: .
- loops, only final: .
- goes back to , only final: .
- goes back to , only final: .
Option C, , needs only one state, so it is impossible. Options A and B each name only one of the four languages. Option D covers both the odd and the even case, so it is the best choice among the options.
Answer: (D)
(P1): Does a given finite state machine accept a given string?
(P2): Does a given context free grammar generate an infinite number of strings?
Which of the following statements is true?
Answer: (A)
P2: Remove useless symbols and put the grammar in Chomsky normal form with variables. Then the pumping lemma constant is , which we can compute from the grammar. The language is infinite if and only if it has a string of length from to .
- If such a string exists, pump it to get infinitely many strings.
- If the language is infinite, it has a string of length at least . Take the shortest one. If it were of length or more, pumping it down would remove at most symbols and give a shorter string still of length at least , a contradiction. So its length is below .
There are only finitely many strings in that length range, and the CYK algorithm tests each one. So P2 is decidable.
So both P1 and P2 are decidable.
Answer: (A)