GATE 2003
107 questions
MCQ 1071-mark 107
Questions 71–75 of 107
Answer: (B)
Use Prim's algorithm and begin at vertex . At each step add the cheapest edge that joins a new vertex to the tree.
, , , , , , , , . Where two edges tie ( and at 2; and at 8; and at 4), either choice gives the same total weight.
The tree has edges for vertices. Total weight .
Answer: (B)
A single-source shortest path algorithm is executed on the weighted graph (V,E,w) with an arbitrary vertex v1 of V1 as the source. Which of the following can always be inferred from the path costs computed?
Answer: (B)
So the cost to a vertex is 0 exactly when can be reached from using only edges of .
- If all vertices of get cost 0, then each is reachable from inside , so is connected.
- If some vertex of gets a cost above 0, it cannot be reached from inside , so is not connected.
So the costs tell us whether is connected.
Other options: the cost counts only weight-1 edges, not all edges on the path, so A cannot be inferred. A connected need not be a clique (a path graph is connected), and it need not be a tree (it may have cycles). The costs cannot tell C or D.
Answer: (B)
Answer: (A)
(A) : cut a string after its last 0. The front part is a sequence of blocks , and the rest is . So it also denotes all strings.
(B) is built from the blocks and , so it cannot generate .
(C) needs the substring , so it cannot generate or .
(D) is wrong because (A) matches.
Answer: (A)
Let the language accepted by M be L. Let L1 be the language accepted by the NFA M1, obtained by changing the accepting state of M to a non-accepting state and by changing the non-accepting state of M to accepting states. Which of the following statements is true ?
Answer: (B)
Which strings does M1 accept?
The empty string : the start state is accepting.
Any non-empty string: its first symbol (0 or 1) takes to on the arrow labelled 0,1. Then has a loop on 0,1, so the machine can stay in for the rest of the string and end in the accepting state .
So , and (B) is true.
Swapping accepting states in an NFA does not give the complement, so (A) is not automatic. Check it with the string 1. In M, 1 takes to , which accepts, so 1 is in L. 1 is also in . So is not .
For (C) and (D): is in but not in L, because is not accepting in M. So and .
Answer: (B)
Let S denote the set of seven bit binary strings in which the first, the fourth, and the last bits are 1.
The number of strings in S that are accepted by M is
Answer: (C)
The DFA stays in its first state on , and a right after a single sends it back to the start. It reaches the final state only after two s in a row followed by a , and then stays final. So it accepts every string that has as a substring: .
A string in S has bits with . The substring can start at position , and it needs and .
- : needs , impossible.
- or : needs , impossible.
- : and fits.
- : and fits.
Case : , where the two bits are free. That gives 4 strings.
Case : , where the two bits are free. That gives 4 strings.
The string is in both cases. Total .
Answer: (C)